summaryrefslogtreecommitdiff
path: root/ash
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2013-09-19 22:36:51 +0100
committerTorne (Richard Coles) <torne@google.com>2013-09-19 22:36:51 +0100
commitd0247b1b59f9c528cb6df88b4f2b9afaf80d181e (patch)
tree5c397fadc190cc71bffe2ffad1efc27a5b95309d /ash
parentf7571f5f07547e2f3e0addf48d1f2a7ec3632957 (diff)
downloadchromium_org-d0247b1b59f9c528cb6df88b4f2b9afaf80d181e.tar.gz
Merge from Chromium at DEPS revision 224184
This commit was generated by merge_to_master.py. Change-Id: Ia3424df5abed9bea642c522b9e2358dceabd8423
Diffstat (limited to 'ash')
-rw-r--r--ash/accelerators/accelerator_controller.cc12
-rw-r--r--ash/accelerators/accelerator_controller_unittest.cc2
-rw-r--r--ash/accelerators/accelerator_dispatcher.cc6
-rw-r--r--ash/accelerators/accelerator_filter.cc2
-rw-r--r--ash/accelerators/accelerator_filter.h2
-rw-r--r--ash/accelerators/accelerator_table.h4
-rw-r--r--ash/accelerators/exit_warning_handler.cc2
-rw-r--r--ash/accelerators/nested_dispatcher_controller_unittest.cc4
-rw-r--r--ash/ash.gyp90
-rw-r--r--ash/desktop_background/desktop_background_controller_unittest.cc2
-rw-r--r--ash/display/display_change_observer_chromeos_unittest.cc24
-rw-r--r--ash/display/display_controller.cc15
-rw-r--r--ash/display/display_controller.h2
-rw-r--r--ash/display/display_controller_unittest.cc140
-rw-r--r--ash/display/display_manager.cc2
-rw-r--r--ash/display/display_manager.h2
-rw-r--r--ash/display/event_transformation_handler.cc2
-rw-r--r--ash/display/event_transformation_handler.h2
-rw-r--r--ash/display/mirror_window_controller.cc7
-rw-r--r--ash/display/mouse_cursor_event_filter.cc15
-rw-r--r--ash/display/mouse_cursor_event_filter.h19
-rw-r--r--ash/display/mouse_cursor_event_filter_unittest.cc267
-rw-r--r--ash/display/root_window_transformers_unittest.cc2
-rw-r--r--ash/display/screen_position_controller.cc2
-rw-r--r--ash/display/shared_display_edge_indicator.cc6
-rw-r--r--ash/display/shared_display_edge_indicator.h13
-rw-r--r--ash/drag_drop/drag_drop_controller.cc20
-rw-r--r--ash/drag_drop/drag_drop_controller.h24
-rw-r--r--ash/drag_drop/drag_drop_controller_unittest.cc16
-rw-r--r--ash/drag_drop/drag_drop_tracker.cc2
-rw-r--r--ash/drag_drop/drag_drop_tracker.h2
-rw-r--r--ash/drag_drop/drag_drop_tracker_unittest.cc8
-rw-r--r--ash/extended_desktop_unittest.cc10
-rw-r--r--ash/keyboard_overlay/keyboard_overlay_view.cc2
-rw-r--r--ash/launcher/launcher.cc4
-rw-r--r--ash/launcher/launcher.h10
-rw-r--r--ash/launcher/launcher_button.cc20
-rw-r--r--ash/launcher/launcher_tooltip_manager.cc4
-rw-r--r--ash/launcher/launcher_tooltip_manager.h5
-rw-r--r--ash/launcher/launcher_tooltip_manager_unittest.cc11
-rw-r--r--ash/launcher/launcher_unittest.cc114
-rw-r--r--ash/launcher/launcher_view.cc14
-rw-r--r--ash/launcher/launcher_view.h2
-rw-r--r--ash/launcher/launcher_view_unittest.cc58
-rw-r--r--ash/magnifier/magnification_controller.cc20
-rw-r--r--ash/magnifier/partial_magnification_controller.h2
-rw-r--r--ash/root_window_controller.cc13
-rw-r--r--ash/root_window_controller.h8
-rw-r--r--ash/rotator/screen_rotation.cc6
-rw-r--r--ash/session_state_delegate.h5
-rw-r--r--ash/shelf/alternate_app_list_button.cc9
-rw-r--r--ash/shelf/background_animator.cc2
-rw-r--r--ash/shelf/background_animator.h12
-rw-r--r--ash/shelf/overflow_bubble.cc11
-rw-r--r--ash/shelf/overflow_bubble.h2
-rw-r--r--ash/shelf/overflow_button.cc13
-rw-r--r--ash/shelf/shelf_bezel_event_filter.h2
-rw-r--r--ash/shelf/shelf_layout_manager.cc35
-rw-r--r--ash/shelf/shelf_layout_manager.h4
-rw-r--r--ash/shelf/shelf_layout_manager_unittest.cc53
-rw-r--r--ash/shelf/shelf_widget.cc4
-rw-r--r--ash/shelf/shelf_widget_unittest.cc5
-rw-r--r--ash/shell.cc24
-rw-r--r--ash/shell.h15
-rw-r--r--ash/shell/app_list.cc2
-rw-r--r--ash/shell/cocoa/app-Info.plist34
-rw-r--r--ash/shell/cocoa/app.icnsbin147653 -> 0 bytes
-rw-r--r--ash/shell/cocoa/nibs/MainMenu.xib2163
-rw-r--r--ash/shell/cocoa/nibs/RootWindow.xib169
-rw-r--r--ash/shell/content_client/shell_browser_main_parts.cc2
-rw-r--r--ash/shell/panel_window.cc2
-rw-r--r--ash/shell/shell_delegate_impl.cc3
-rw-r--r--ash/shell/shell_main_parts_mac.mm30
-rw-r--r--ash/shell/window_type_launcher.cc11
-rw-r--r--ash/shell/window_type_launcher.h9
-rw-r--r--ash/shell_unittest.cc8
-rw-r--r--ash/system/brightness/tray_brightness.cc2
-rw-r--r--ash/system/chromeos/managed/tray_locally_managed_user.cc2
-rw-r--r--ash/system/chromeos/managed/tray_locally_managed_user_unittest.cc2
-rw-r--r--ash/system/chromeos/network/network_connect.cc23
-rw-r--r--ash/system/chromeos/network/network_icon_animation.cc5
-rw-r--r--ash/system/chromeos/network/network_icon_animation.h12
-rw-r--r--ash/system/chromeos/network/network_state_notifier.cc30
-rw-r--r--ash/system/chromeos/network/network_state_notifier.h12
-rw-r--r--ash/system/chromeos/network/tray_network_state_observer.cc4
-rw-r--r--ash/system/chromeos/network/tray_network_state_observer.h1
-rw-r--r--ash/system/chromeos/screen_security/screen_tray_item_unittest.cc2
-rw-r--r--ash/system/chromeos/tray_display.cc4
-rw-r--r--ash/system/chromeos/tray_display.h7
-rw-r--r--ash/system/chromeos/tray_display_unittest.cc40
-rw-r--r--ash/system/date/date_view.cc80
-rw-r--r--ash/system/date/date_view.h29
-rw-r--r--ash/system/date/date_view_unittest.cc66
-rw-r--r--ash/system/logout_button/logout_button_tray.cc2
-rw-r--r--ash/system/session_length_limit/tray_session_length_limit.cc4
-rw-r--r--ash/system/status_area_widget_delegate.cc21
-rw-r--r--ash/system/tray/default_system_tray_delegate.cc279
-rw-r--r--ash/system/tray/default_system_tray_delegate.h (renamed from ash/system/tray/test_system_tray_delegate.h)45
-rw-r--r--ash/system/tray/system_tray.cc6
-rw-r--r--ash/system/tray/system_tray.h1
-rw-r--r--ash/system/tray/system_tray_bubble.cc6
-rw-r--r--ash/system/tray/system_tray_delegate.cc9
-rw-r--r--ash/system/tray/system_tray_delegate.h3
-rw-r--r--ash/system/tray/system_tray_unittest.cc50
-rw-r--r--ash/system/tray/test_system_tray_delegate.cc312
-rw-r--r--ash/system/tray/tray_background_view.cc121
-rw-r--r--ash/system/tray/tray_background_view.h3
-rw-r--r--ash/system/tray/tray_bubble_wrapper.cc6
-rw-r--r--ash/system/tray/tray_bubble_wrapper.h2
-rw-r--r--ash/system/tray/tray_constants.cc11
-rw-r--r--ash/system/tray/tray_constants.h8
-rw-r--r--ash/system/tray/tray_event_filter.h4
-rw-r--r--ash/system/tray/tray_item_view.cc12
-rw-r--r--ash/system/tray/tray_item_view.h16
-rw-r--r--ash/system/tray/tray_utils.cc4
-rw-r--r--ash/system/user/tray_user.cc7
-rw-r--r--ash/system/user/tray_user_unittest.cc2
-rw-r--r--ash/system/web_notification/web_notification_tray_unittest.cc2
-rw-r--r--ash/test/ash_test_helper.cc6
-rw-r--r--ash/test/launcher_test_api.cc24
-rw-r--r--ash/test/launcher_test_api.h39
-rw-r--r--ash/test/test_activation_delegate.cc2
-rw-r--r--ash/test/test_activation_delegate.h2
-rw-r--r--ash/test/test_shell_delegate.cc3
-rw-r--r--ash/test/test_suite.cc8
-rw-r--r--ash/test/test_system_tray_delegate.cc74
-rw-r--r--ash/test/test_system_tray_delegate.h52
-rw-r--r--ash/test/ui_controls_factory_ash.cc4
-rw-r--r--ash/touch/touch_hud_debug.cc4
-rw-r--r--ash/touch/touch_hud_projection.cc20
-rw-r--r--ash/touch/touch_observer_hud.h2
-rw-r--r--ash/touch/touch_uma.cc4
-rw-r--r--ash/wm/app_list_controller.cc17
-rw-r--r--ash/wm/app_list_controller.h2
-rw-r--r--ash/wm/ash_focus_rules.cc2
-rw-r--r--ash/wm/base_layout_manager.h2
-rw-r--r--ash/wm/base_layout_manager_unittest.cc9
-rw-r--r--ash/wm/caption_buttons/alternate_frame_caption_button.cc (renamed from ash/wm/workspace/alternate_frame_caption_button.cc)10
-rw-r--r--ash/wm/caption_buttons/alternate_frame_caption_button.h (renamed from ash/wm/workspace/alternate_frame_caption_button.h)16
-rw-r--r--ash/wm/caption_buttons/frame_caption_button_container_view.cc (renamed from ash/wm/workspace/frame_caption_button_container_view.cc)10
-rw-r--r--ash/wm/caption_buttons/frame_caption_button_container_view.h (renamed from ash/wm/workspace/frame_caption_button_container_view.h)15
-rw-r--r--ash/wm/caption_buttons/frame_caption_button_container_view_unittest.cc (renamed from ash/wm/workspace/frame_caption_button_container_view_unittest.cc)16
-rw-r--r--ash/wm/caption_buttons/frame_maximize_button.cc (renamed from ash/wm/workspace/frame_maximize_button.cc)118
-rw-r--r--ash/wm/caption_buttons/frame_maximize_button.h (renamed from ash/wm/workspace/frame_maximize_button.h)28
-rw-r--r--ash/wm/caption_buttons/frame_maximize_button_unittest.cc (renamed from ash/wm/custom_frame_view_ash_unittest.cc)158
-rw-r--r--ash/wm/caption_buttons/maximize_bubble_controller.cc (renamed from ash/wm/maximize_bubble_controller.cc)14
-rw-r--r--ash/wm/caption_buttons/maximize_bubble_controller.h (renamed from ash/wm/maximize_bubble_controller.h)10
-rw-r--r--ash/wm/caption_buttons/maximize_bubble_frame_state.h (renamed from ash/wm/workspace/maximize_bubble_frame_state.h)8
-rw-r--r--ash/wm/custom_frame_view_ash.cc4
-rw-r--r--ash/wm/custom_frame_view_ash.h2
-rw-r--r--ash/wm/dock/docked_window_layout_manager.cc97
-rw-r--r--ash/wm/dock/docked_window_layout_manager.h18
-rw-r--r--ash/wm/dock/docked_window_layout_manager_unittest.cc218
-rw-r--r--ash/wm/dock/docked_window_resizer.cc131
-rw-r--r--ash/wm/dock/docked_window_resizer.h13
-rw-r--r--ash/wm/dock/docked_window_resizer_unittest.cc181
-rw-r--r--ash/wm/drag_window_resizer_unittest.cc46
-rw-r--r--ash/wm/event_rewriter_event_filter.cc2
-rw-r--r--ash/wm/event_rewriter_event_filter.h2
-rw-r--r--ash/wm/frame_painter.cc11
-rw-r--r--ash/wm/frame_painter.h12
-rw-r--r--ash/wm/frame_painter_unittest.cc7
-rw-r--r--ash/wm/gestures/long_press_affordance_handler.cc8
-rw-r--r--ash/wm/gestures/long_press_affordance_handler.h14
-rw-r--r--ash/wm/gestures/system_pinch_handler.cc2
-rw-r--r--ash/wm/gestures/tray_gesture_handler.cc2
-rw-r--r--ash/wm/gestures/two_finger_drag_handler.cc4
-rw-r--r--ash/wm/image_cursors.h1
-rw-r--r--ash/wm/mru_window_tracker.cc9
-rw-r--r--ash/wm/overlay_event_filter.cc2
-rw-r--r--ash/wm/overlay_event_filter.h2
-rw-r--r--ash/wm/overview/scoped_transform_overview_window.cc287
-rw-r--r--ash/wm/overview/scoped_transform_overview_window.h102
-rw-r--r--ash/wm/overview/window_overview.cc51
-rw-r--r--ash/wm/overview/window_overview.h15
-rw-r--r--ash/wm/overview/window_selector.cc110
-rw-r--r--ash/wm/overview/window_selector.h10
-rw-r--r--ash/wm/overview/window_selector_item.cc21
-rw-r--r--ash/wm/overview/window_selector_item.h69
-rw-r--r--ash/wm/overview/window_selector_panels.cc176
-rw-r--r--ash/wm/overview/window_selector_panels.h53
-rw-r--r--ash/wm/overview/window_selector_unittest.cc215
-rw-r--r--ash/wm/overview/window_selector_window.cc237
-rw-r--r--ash/wm/overview/window_selector_window.h71
-rw-r--r--ash/wm/panels/panel_frame_view.cc6
-rw-r--r--ash/wm/panels/panel_layout_manager.cc12
-rw-r--r--ash/wm/panels/panel_layout_manager.h3
-rw-r--r--ash/wm/panels/panel_layout_manager_unittest.cc14
-rw-r--r--ash/wm/panels/panel_window_event_handler.cc2
-rw-r--r--ash/wm/partial_screenshot_view.cc2
-rw-r--r--ash/wm/session_state_animator.cc14
-rw-r--r--ash/wm/stacking_controller.cc2
-rw-r--r--ash/wm/sticky_keys.cc4
-rw-r--r--ash/wm/sticky_keys.h2
-rw-r--r--ash/wm/system_gesture_event_filter.cc2
-rw-r--r--ash/wm/system_gesture_event_filter.h4
-rw-r--r--ash/wm/system_gesture_event_filter_unittest.cc4
-rw-r--r--ash/wm/system_modal_container_event_filter.cc2
-rw-r--r--ash/wm/system_modal_container_event_filter.h2
-rw-r--r--ash/wm/system_modal_container_layout_manager.cc2
-rw-r--r--ash/wm/system_modal_container_layout_manager_unittest.cc10
-rw-r--r--ash/wm/toplevel_window_event_handler.cc6
-rw-r--r--ash/wm/toplevel_window_event_handler.h2
-rw-r--r--ash/wm/toplevel_window_event_handler_unittest.cc4
-rw-r--r--ash/wm/user_activity_detector.cc2
-rw-r--r--ash/wm/user_activity_detector.h2
-rw-r--r--ash/wm/user_activity_detector_unittest.cc6
-rw-r--r--ash/wm/window_animations.cc10
-rw-r--r--ash/wm/window_animations_unittest.cc14
-rw-r--r--ash/wm/window_cycle_controller.cc4
-rw-r--r--ash/wm/window_cycle_controller_unittest.cc6
-rw-r--r--ash/wm/window_manager_unittest.cc10
-rw-r--r--ash/wm/window_util.cc2
-rw-r--r--ash/wm/workspace/auto_window_management.cc39
-rw-r--r--ash/wm/workspace/desktop_background_fade_controller.cc6
-rw-r--r--ash/wm/workspace/multi_window_resize_controller.cc2
-rw-r--r--ash/wm/workspace/phantom_window_controller.cc8
-rw-r--r--ash/wm/workspace/phantom_window_controller.h12
-rw-r--r--ash/wm/workspace/snap_sizer.cc54
-rw-r--r--ash/wm/workspace/snap_sizer.h10
-rw-r--r--ash/wm/workspace/snap_sizer_unittest.cc75
-rw-r--r--ash/wm/workspace/workspace_event_handler.cc4
-rw-r--r--ash/wm/workspace/workspace_layout_manager.cc40
-rw-r--r--ash/wm/workspace/workspace_layout_manager.h6
-rw-r--r--ash/wm/workspace/workspace_window_resizer.cc114
-rw-r--r--ash/wm/workspace/workspace_window_resizer.h24
-rw-r--r--ash/wm/workspace/workspace_window_resizer_unittest.cc11
-rw-r--r--ash/wm/workspace_controller.cc2
-rw-r--r--ash/wm/workspace_controller_unittest.cc2
229 files changed, 3701 insertions, 4654 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index 872b313689..108cb3b5a5 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -56,12 +56,12 @@
#include "ui/aura/root_window.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/accelerators/accelerator_manager.h"
-#include "ui/base/events/event.h"
-#include "ui/base/keycodes/keyboard_codes.h"
#include "ui/compositor/debug_utils.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animation_sequence.h"
#include "ui/compositor/layer_animator.h"
+#include "ui/events/event.h"
+#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/gfx/screen.h"
#include "ui/oak/oak.h"
#include "ui/views/controls/webview/webview.h"
@@ -592,7 +592,7 @@ bool AcceleratorController::PerformAction(int action,
return true;
case TOUCH_HUD_CLEAR: {
internal::RootWindowController* controller =
- internal::RootWindowController::ForActiveRootWindow();
+ internal::RootWindowController::ForTargetRootWindow();
if (controller->touch_hud_debug()) {
controller->touch_hud_debug()->Clear();
return true;
@@ -601,7 +601,7 @@ bool AcceleratorController::PerformAction(int action,
}
case TOUCH_HUD_MODE_CHANGE: {
internal::RootWindowController* controller =
- internal::RootWindowController::ForActiveRootWindow();
+ internal::RootWindowController::ForTargetRootWindow();
if (controller->touch_hud_debug()) {
controller->touch_hud_debug()->ChangeToNextMode();
return true;
@@ -743,7 +743,7 @@ bool AcceleratorController::PerformAction(int action,
break;
case SHOW_SYSTEM_TRAY_BUBBLE: {
internal::RootWindowController* controller =
- internal::RootWindowController::ForActiveRootWindow();
+ internal::RootWindowController::ForTargetRootWindow();
if (!controller->GetSystemTray()->HasSystemBubble()) {
controller->GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
return true;
@@ -752,7 +752,7 @@ bool AcceleratorController::PerformAction(int action,
}
case SHOW_MESSAGE_CENTER_BUBBLE: {
internal::RootWindowController* controller =
- internal::RootWindowController::ForActiveRootWindow();
+ internal::RootWindowController::ForTargetRootWindow();
internal::StatusAreaWidget* status_area_widget =
controller->shelf()->status_area_widget();
if (status_area_widget) {
diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc
index bc709b26d6..6c6355fe06 100644
--- a/ash/accelerators/accelerator_controller_unittest.cc
+++ b/ash/accelerators/accelerator_controller_unittest.cc
@@ -22,7 +22,7 @@
#include "ui/aura/test/test_window_delegate.h"
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h"
-#include "ui/base/events/event.h"
+#include "ui/events/event.h"
#if defined(USE_X11)
#include <X11/Xlib.h>
diff --git a/ash/accelerators/accelerator_dispatcher.cc b/ash/accelerators/accelerator_dispatcher.cc
index 91f01540f6..d023c6e27c 100644
--- a/ash/accelerators/accelerator_dispatcher.cc
+++ b/ash/accelerators/accelerator_dispatcher.cc
@@ -19,9 +19,9 @@
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/base/accelerators/accelerator.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_constants.h"
-#include "ui/base/events/event_utils.h"
+#include "ui/events/event.h"
+#include "ui/events/event_constants.h"
+#include "ui/events/event_utils.h"
#include "ui/views/controls/menu/menu_controller.h"
namespace ash {
diff --git a/ash/accelerators/accelerator_filter.cc b/ash/accelerators/accelerator_filter.cc
index 892beabff2..ab7acd3d89 100644
--- a/ash/accelerators/accelerator_filter.cc
+++ b/ash/accelerators/accelerator_filter.cc
@@ -10,7 +10,7 @@
#include "ui/aura/root_window.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/accelerators/accelerator_manager.h"
-#include "ui/base/events/event.h"
+#include "ui/events/event.h"
namespace ash {
namespace {
diff --git a/ash/accelerators/accelerator_filter.h b/ash/accelerators/accelerator_filter.h
index a43241a7f5..1df7637edd 100644
--- a/ash/accelerators/accelerator_filter.h
+++ b/ash/accelerators/accelerator_filter.h
@@ -8,7 +8,7 @@
#include "ash/ash_export.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_handler.h"
namespace ash {
namespace internal {
diff --git a/ash/accelerators/accelerator_table.h b/ash/accelerators/accelerator_table.h
index 6136c9eaa5..7d23adfe0b 100644
--- a/ash/accelerators/accelerator_table.h
+++ b/ash/accelerators/accelerator_table.h
@@ -7,8 +7,8 @@
#include "ash/ash_export.h"
#include "base/basictypes.h"
-#include "ui/base/events/event_constants.h"
-#include "ui/base/keycodes/keyboard_codes.h"
+#include "ui/events/event_constants.h"
+#include "ui/events/keycodes/keyboard_codes.h"
namespace ash {
diff --git a/ash/accelerators/exit_warning_handler.cc b/ash/accelerators/exit_warning_handler.cc
index 864286b30b..6ea635ac05 100644
--- a/ash/accelerators/exit_warning_handler.cc
+++ b/ash/accelerators/exit_warning_handler.cc
@@ -165,7 +165,7 @@ void ExitWarningHandler::CancelTimer() {
void ExitWarningHandler::Show() {
if (widget_)
return;
- aura::RootWindow* root_window = Shell::GetActiveRootWindow();
+ aura::RootWindow* root_window = Shell::GetTargetRootWindow();
ExitWarningWidgetDelegateView* delegate = new ExitWarningWidgetDelegateView;
gfx::Size rs = root_window->bounds().size();
gfx::Size ps = delegate->GetPreferredSize();
diff --git a/ash/accelerators/nested_dispatcher_controller_unittest.cc b/ash/accelerators/nested_dispatcher_controller_unittest.cc
index 8b0f6a5e86..4c07232f66 100644
--- a/ash/accelerators/nested_dispatcher_controller_unittest.cc
+++ b/ash/accelerators/nested_dispatcher_controller_unittest.cc
@@ -15,8 +15,8 @@
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h"
#include "ui/base/accelerators/accelerator.h"
-#include "ui/base/events/event_constants.h"
-#include "ui/base/events/event_utils.h"
+#include "ui/events/event_constants.h"
+#include "ui/events/event_utils.h"
#if defined(USE_X11)
#include <X11/Xlib.h>
diff --git a/ash/ash.gyp b/ash/ash.gyp
index 830e9d6a01..f815ac672d 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -297,6 +297,8 @@
'system/system_notifier.h',
'system/tray/actionable_view.cc',
'system/tray/actionable_view.h',
+ 'system/tray/default_system_tray_delegate.cc',
+ 'system/tray/default_system_tray_delegate.h',
'system/tray/fixed_sized_image_view.cc',
'system/tray/fixed_sized_image_view.h',
'system/tray/fixed_sized_scroll_view.cc',
@@ -315,8 +317,6 @@
'system/tray/system_tray_item.h',
'system/tray/system_tray_notifier.cc',
'system/tray/system_tray_notifier.h',
- 'system/tray/test_system_tray_delegate.cc',
- 'system/tray/test_system_tray_delegate.h',
'system/tray/throbber_view.cc',
'system/tray/throbber_view.h',
'system/tray/tray_background_view.cc',
@@ -386,6 +386,15 @@
'wm/base_layout_manager.h',
'wm/boot_splash_screen_chromeos.cc',
'wm/boot_splash_screen_chromeos.h',
+ 'wm/caption_buttons/alternate_frame_caption_button.cc',
+ 'wm/caption_buttons/alternate_frame_caption_button.h',
+ 'wm/caption_buttons/frame_caption_button_container_view.cc',
+ 'wm/caption_buttons/frame_caption_button_container_view.h',
+ 'wm/caption_buttons/frame_maximize_button.cc',
+ 'wm/caption_buttons/frame_maximize_button.h',
+ 'wm/caption_buttons/maximize_bubble_controller.cc',
+ 'wm/caption_buttons/maximize_bubble_controller.h',
+ 'wm/caption_buttons/maximize_bubble_frame_state.h',
'wm/coordinate_conversion.cc',
'wm/coordinate_conversion.h',
'wm/custom_frame_view_ash.cc',
@@ -424,12 +433,12 @@
'wm/lock_state_controller_impl2.cc',
'wm/lock_state_controller_impl2.h',
'wm/lock_state_observer.h',
- 'wm/maximize_bubble_controller.cc',
- 'wm/maximize_bubble_controller.h',
'wm/mru_window_tracker.cc',
'wm/mru_window_tracker.h',
'wm/overlay_event_filter.cc',
'wm/overlay_event_filter.h',
+ 'wm/overview/scoped_transform_overview_window.cc',
+ 'wm/overview/scoped_transform_overview_window.h',
'wm/overview/window_overview.cc',
'wm/overview/window_overview.h',
'wm/overview/window_selector.cc',
@@ -437,6 +446,10 @@
'wm/overview/window_selector_controller.cc',
'wm/overview/window_selector_controller.h',
'wm/overview/window_selector_delegate.h',
+ 'wm/overview/window_selector_item.cc',
+ 'wm/overview/window_selector_item.h',
+ 'wm/overview/window_selector_panels.cc',
+ 'wm/overview/window_selector_panels.h',
'wm/overview/window_selector_window.cc',
'wm/overview/window_selector_window.h',
'wm/panels/panel_frame_view.cc',
@@ -503,21 +516,14 @@
'wm/window_util.h',
'wm/workspace_controller.cc',
'wm/workspace_controller.h',
- 'wm/workspace/alternate_frame_caption_button.cc',
- 'wm/workspace/alternate_frame_caption_button.h',
'wm/workspace/auto_window_management.cc',
'wm/workspace/auto_window_management.h',
'wm/workspace/colored_window_controller.cc',
'wm/workspace/colored_window_controller.h',
'wm/workspace/desktop_background_fade_controller.cc',
'wm/workspace/desktop_background_fade_controller.h',
- 'wm/workspace/frame_caption_button_container_view.cc',
- 'wm/workspace/frame_caption_button_container_view.h',
- 'wm/workspace/frame_maximize_button.cc',
- 'wm/workspace/frame_maximize_button.h',
'wm/workspace/magnetism_matcher.cc',
'wm/workspace/magnetism_matcher.h',
- 'wm/workspace/maximize_bubble_frame_state.h',
'wm/workspace/multi_window_resize_controller.cc',
'wm/workspace/multi_window_resize_controller.h',
'wm/workspace/phantom_window_controller.cc',
@@ -534,22 +540,6 @@
'wm/workspace/workspace_window_resizer.h',
],
'conditions': [
- ['OS=="mac"', {
- 'sources/': [
- ['exclude', 'accelerators/accelerator_commands.cc'],
- ['exclude', 'accelerators/accelerator_commands.h'],
- ['exclude', 'accelerators/accelerator_controller.cc'],
- ['exclude', 'accelerators/accelerator_controller.h'],
- ['exclude', 'accelerators/accelerator_dispatcher.cc'],
- ['exclude', 'accelerators/accelerator_dispatcher.h'],
- ['exclude', 'accelerators/accelerator_filter.cc'],
- ['exclude', 'accelerators/accelerator_filter.h'],
- ['exclude', 'accelerators/exit_warning_handler.cc'],
- ['exclude', 'accelerators/exit_warning_handler.h'],
- ['exclude', 'accelerators/nested_dispatcher_controller.cc'],
- ['exclude', 'accelerators/nested_dispatcher_controller.h'],
- ],
- }],
['OS=="win"', {
'sources/': [
['exclude', 'host/root_window_host_factory.cc'],
@@ -606,6 +596,8 @@
'test/ash_test_helper.h',
'test/cursor_manager_test_api.cc',
'test/cursor_manager_test_api.h',
+ 'test/launcher_test_api.cc',
+ 'test/launcher_test_api.h',
'test/launcher_view_test_api.cc',
'test/launcher_view_test_api.h',
'test/display_manager_test_api.cc',
@@ -626,6 +618,8 @@
'test/test_suite.h',
'test/test_suite_init.h',
'test/test_suite_init.mm',
+ 'test/test_system_tray_delegate.cc',
+ 'test/test_system_tray_delegate.h',
'test/ui_controls_factory_ash.cc',
'test/ui_controls_factory_ash.h',
],
@@ -743,6 +737,7 @@
'system/chromeos/power/tray_power_unittest.cc',
'system/chromeos/screen_security/screen_tray_item_unittest.cc',
'system/chromeos/tray_display_unittest.cc',
+ 'system/date/date_view_unittest.cc',
'system/tray/system_tray_unittest.cc',
'system/user/tray_user_unittest.cc',
'system/web_notification/web_notification_tray_unittest.cc',
@@ -752,7 +747,8 @@
'touch/touch_observer_hud_unittest.cc',
'wm/ash_native_cursor_manager_unittest.cc',
'wm/base_layout_manager_unittest.cc',
- 'wm/custom_frame_view_ash_unittest.cc',
+ 'wm/caption_buttons/frame_caption_button_container_view_unittest.cc',
+ 'wm/caption_buttons/frame_maximize_button_unittest.cc',
'wm/dock/docked_window_layout_manager_unittest.cc',
'wm/dock/docked_window_resizer_unittest.cc',
'wm/drag_window_resizer_unittest.cc',
@@ -779,7 +775,6 @@
'wm/workspace_controller_test_helper.cc',
'wm/workspace_controller_test_helper.h',
'wm/workspace_controller_unittest.cc',
- 'wm/workspace/frame_caption_button_container_view_unittest.cc',
'wm/workspace/magnetism_matcher_unittest.cc',
'wm/workspace/multi_window_resize_controller_unittest.cc',
'wm/workspace/snap_sizer_unittest.cc',
@@ -809,22 +804,6 @@
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [ 4267, ],
}],
- ['OS=="mac"', {
- 'sources/': [
- ['exclude', 'accelerators/accelerator_controller_unittest.cc'],
- ['exclude', 'accelerators/accelerator_filter_unittest.cc'],
- ['exclude', 'accelerators/nested_dispatcher_controller_unittest.cc'],
- ['exclude', 'drag_drop/drag_drop_controller_unittest.cc'],
- ['exclude', 'tooltips/tooltip_controller_unittest.cc'],
- ],
- 'dependencies': [
- # Mac tests access resources via the 'AuraShell.app' directory.
- 'ash_shell',
- ],
- # Special linker instructions that avoids stripping Obj-C classes that
- # are not referenced in code, but are referenced in nibs.
- 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-ObjC']},
- }],
['use_x11!=1', {
'sources/': [
['exclude', 'display/display_change_observer_chromeos_unittest.cc'],
@@ -897,7 +876,6 @@
'shell/shell_main.cc',
'shell/shell_main_parts.cc',
'shell/shell_main_parts.h',
- 'shell/shell_main_parts_mac.mm',
'shell/toplevel_window.cc',
'shell/toplevel_window.h',
'shell/widgets.cc',
@@ -919,26 +897,6 @@
'../sandbox/sandbox.gyp:sandbox',
],
}],
- ['OS=="mac"', {
- 'product_name': 'AuraShell',
- 'mac_bundle': 1,
- 'sources/': [
- ['exclude', 'shell/shell_main_parts.cc'],
- ],
- 'mac_bundle_resources': [
- 'shell/cocoa/app.icns',
- 'shell/cocoa/app-Info.plist',
- 'shell/cocoa/nibs/MainMenu.xib',
- 'shell/cocoa/nibs/RootWindow.xib',
- '<!@pymod_do_main(repack_locales -o -p <(OS) -g <(grit_out_dir) -s <(SHARED_INTERMEDIATE_DIR) -x <(SHARED_INTERMEDIATE_DIR) <(locales))',
- ],
- 'mac_bundle_resources!': [
- 'shell/cocoa/app-Info.plist',
- ],
- 'xcode_settings': {
- 'INFOPLIST_FILE': 'shell/cocoa/app-Info.plist',
- },
- }],
],
},
],
diff --git a/ash/desktop_background/desktop_background_controller_unittest.cc b/ash/desktop_background/desktop_background_controller_unittest.cc
index b46b6e336e..fa13434acf 100644
--- a/ash/desktop_background/desktop_background_controller_unittest.cc
+++ b/ash/desktop_background/desktop_background_controller_unittest.cc
@@ -85,7 +85,7 @@ void RunAnimationForWidget(views::Widget* widget) {
ui::Layer* layer = widget->GetNativeView()->layer();
ui::LayerAnimatorTestController controller(layer->GetAnimator());
- ui::AnimationContainerElement* element = layer->GetAnimator();
+ gfx::AnimationContainerElement* element = layer->GetAnimator();
// Multiple steps are required to complete complex animations.
// TODO(vollick): This should not be necessary. crbug.com/154017
while (controller.animator()->is_animating()) {
diff --git a/ash/display/display_change_observer_chromeos_unittest.cc b/ash/display/display_change_observer_chromeos_unittest.cc
index dc8d492742..a437aec64c 100644
--- a/ash/display/display_change_observer_chromeos_unittest.cc
+++ b/ash/display/display_change_observer_chromeos_unittest.cc
@@ -30,28 +30,28 @@ TEST_F(DisplayChangeObserverTest, TestBlackListedDisplay) {
TEST_F(DisplayChangeObserverTest, GetResolutionList) {
OutputConfigurator::OutputSnapshot output;
- output.mode_infos[11] = OutputConfigurator::ModeInfo(1920, 1200, false);
+ output.mode_infos[11] = OutputConfigurator::ModeInfo(1920, 1200, false, 60);
// All non-interlaced (as would be seen with different refresh rates).
- output.mode_infos[12] = OutputConfigurator::ModeInfo(1920, 1080, false);
- output.mode_infos[13] = OutputConfigurator::ModeInfo(1920, 1080, false);
- output.mode_infos[14] = OutputConfigurator::ModeInfo(1920, 1080, false);
+ output.mode_infos[12] = OutputConfigurator::ModeInfo(1920, 1080, false, 80);
+ output.mode_infos[13] = OutputConfigurator::ModeInfo(1920, 1080, false, 70);
+ output.mode_infos[14] = OutputConfigurator::ModeInfo(1920, 1080, false, 60);
// Interlaced vs non-interlaced.
- output.mode_infos[15] = OutputConfigurator::ModeInfo(1280, 720, true);
- output.mode_infos[16] = OutputConfigurator::ModeInfo(1280, 720, false);
+ output.mode_infos[15] = OutputConfigurator::ModeInfo(1280, 720, true, 60);
+ output.mode_infos[16] = OutputConfigurator::ModeInfo(1280, 720, false, 60);
// Interlaced only.
- output.mode_infos[17] = OutputConfigurator::ModeInfo(1024, 768, true);
- output.mode_infos[18] = OutputConfigurator::ModeInfo(1024, 768, true);
+ output.mode_infos[17] = OutputConfigurator::ModeInfo(1024, 768, true, 70);
+ output.mode_infos[18] = OutputConfigurator::ModeInfo(1024, 768, true, 60);
// Mixed.
- output.mode_infos[19] = OutputConfigurator::ModeInfo(1024, 600, true);
- output.mode_infos[20] = OutputConfigurator::ModeInfo(1024, 600, false);
- output.mode_infos[21] = OutputConfigurator::ModeInfo(1024, 600, false);
+ output.mode_infos[19] = OutputConfigurator::ModeInfo(1024, 600, true, 60);
+ output.mode_infos[20] = OutputConfigurator::ModeInfo(1024, 600, false, 70);
+ output.mode_infos[21] = OutputConfigurator::ModeInfo(1024, 600, false, 60);
// Just one interlaced mode.
- output.mode_infos[22] = OutputConfigurator::ModeInfo(640, 480, true);
+ output.mode_infos[22] = OutputConfigurator::ModeInfo(640, 480, true, 60);
std::vector<Resolution> resolutions =
DisplayChangeObserver::GetResolutionList(output);
diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc
index 2141e0cbc1..8dde730514 100644
--- a/ash/display/display_controller.cc
+++ b/ash/display/display_controller.cc
@@ -141,7 +141,7 @@ class FocusActivationStore {
active_(NULL) {
}
- void Store() {
+ void Store(bool display_removed) {
if (!activation_client_) {
aura::RootWindow* root = Shell::GetPrimaryRootWindow();
activation_client_ = aura::client::GetActivationClient(root);
@@ -156,14 +156,17 @@ class FocusActivationStore {
tracker_.Add(active_);
// Deactivate the window to close menu / bubble windows.
- activation_client_->DeactivateWindow(active_);
+ if (display_removed)
+ activation_client_->DeactivateWindow(active_);
+
// Release capture if any.
capture_client_->SetCapture(NULL);
// Clear the focused window if any. This is necessary because a
// window may be deleted when losing focus (fullscreen flash for
// example). If the focused window is still alive after move, it'll
// be re-focused below.
- focus_client_->FocusWindow(NULL);
+ if (display_removed)
+ focus_client_->FocusWindow(NULL);
}
void Restore() {
@@ -386,7 +389,7 @@ void DisplayController::SetLayoutForCurrentDisplays(
to_set.primary_id = primary.id();
layout_store->RegisterLayoutForDisplayIdPair(
pair.first, pair.second, to_set);
- PreDisplayConfigurationChange();
+ PreDisplayConfigurationChange(false);
// TODO(oshima): Call UpdateDisplays instead.
UpdateDisplayBoundsForLayout();
// Primary's bounds stay the same. Just notify bounds change
@@ -711,9 +714,9 @@ void DisplayController::CloseMirrorWindow() {
mirror_window_controller_->Close();
}
-void DisplayController::PreDisplayConfigurationChange() {
+void DisplayController::PreDisplayConfigurationChange(bool display_removed) {
FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanging());
- focus_activation_store_->Store();
+ focus_activation_store_->Store(display_removed);
gfx::Point point_in_screen = Shell::GetScreen()->GetCursorScreenPoint();
gfx::Display display =
diff --git a/ash/display/display_controller.h b/ash/display/display_controller.h
index 97620fc93b..bbfd55a24f 100644
--- a/ash/display/display_controller.h
+++ b/ash/display/display_controller.h
@@ -166,7 +166,7 @@ class ASH_EXPORT DisplayController : public gfx::DisplayObserver,
virtual void CreateOrUpdateMirrorWindow(
const internal::DisplayInfo& info) OVERRIDE;
virtual void CloseMirrorWindow() OVERRIDE;
- virtual void PreDisplayConfigurationChange() OVERRIDE;
+ virtual void PreDisplayConfigurationChange(bool dispay_removed) OVERRIDE;
virtual void PostDisplayConfigurationChange() OVERRIDE;
private:
diff --git a/ash/display/display_controller_unittest.cc b/ash/display/display_controller_unittest.cc
index 5024ef9fbb..485e582919 100644
--- a/ash/display/display_controller_unittest.cc
+++ b/ash/display/display_controller_unittest.cc
@@ -15,11 +15,15 @@
#include "ash/test/ash_test_base.h"
#include "ash/test/cursor_manager_test_api.h"
#include "base/command_line.h"
+#include "ui/aura/client/activation_change_observer.h"
+#include "ui/aura/client/activation_client.h"
+#include "ui/aura/client/focus_change_observer.h"
+#include "ui/aura/client/focus_client.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/aura/test/event_generator.h"
#include "ui/aura/window_tracker.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_handler.h"
#include "ui/gfx/display.h"
#include "ui/gfx/screen.h"
#include "ui/views/widget/widget.h"
@@ -35,21 +39,47 @@ namespace {
const char kDesktopBackgroundView[] = "DesktopBackgroundView";
+template<typename T>
+class Resetter {
+ public:
+ explicit Resetter(T* value) : value_(*value) {
+ *value = 0;
+ }
+ ~Resetter() { }
+ T value() { return value_; }
+
+ private:
+ T value_;
+ DISALLOW_COPY_AND_ASSIGN(Resetter);
+};
+
class TestObserver : public DisplayController::Observer,
- public gfx::DisplayObserver {
+ public gfx::DisplayObserver,
+ public aura::client::FocusChangeObserver,
+ public aura::client::ActivationChangeObserver {
public:
TestObserver()
: changing_count_(0),
changed_count_(0),
bounds_changed_count_(0),
- changed_display_id_(0) {
+ changed_display_id_(0),
+ focus_changed_count_(0),
+ activation_changed_count_(0) {
Shell::GetInstance()->display_controller()->AddObserver(this);
Shell::GetScreen()->AddObserver(this);
+ aura::client::GetFocusClient(Shell::GetPrimaryRootWindow())->
+ AddObserver(this);
+ aura::client::GetActivationClient(Shell::GetPrimaryRootWindow())->
+ AddObserver(this);
}
virtual ~TestObserver() {
Shell::GetInstance()->display_controller()->RemoveObserver(this);
Shell::GetScreen()->RemoveObserver(this);
+ aura::client::GetFocusClient(Shell::GetPrimaryRootWindow())->
+ RemoveObserver(this);
+ aura::client::GetActivationClient(Shell::GetPrimaryRootWindow())->
+ RemoveObserver(this);
}
// Overridden from DisplayController::Observer
@@ -70,23 +100,42 @@ class TestObserver : public DisplayController::Observer,
virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE {
}
+ // Overridden from aura::client::FocusChangeObserver
+ virtual void OnWindowFocused(aura::Window* gained_focus,
+ aura::Window* lost_focus) OVERRIDE {
+ focus_changed_count_++;
+ }
+
+ // Overridden from aura::client::ActivationChangeObserver
+ virtual void OnWindowActivated(aura::Window* gained_active,
+ aura::Window* lost_active) OVERRIDE {
+ activation_changed_count_++;
+ }
+ virtual void OnAttemptToReactivateWindow(
+ aura::Window* request_active,
+ aura::Window* actual_active) OVERRIDE {
+ }
+
int CountAndReset() {
EXPECT_EQ(changing_count_, changed_count_);
- int count = changing_count_;
- changing_count_ = changed_count_ = 0;
- return count;
+ changed_count_ = 0;
+ return Resetter<int>(&changing_count_).value();
}
int64 GetBoundsChangedCountAndReset() {
- int count = bounds_changed_count_;
- bounds_changed_count_ = 0;
- return count;
+ return Resetter<int>(&bounds_changed_count_).value();
}
int64 GetChangedDisplayIdAndReset() {
- int64 id = changed_display_id_;
- changed_display_id_ = 0;
- return id;
+ return Resetter<int64>(&changed_display_id_).value();
+ }
+
+ int GetFocusChangedCountAndReset() {
+ return Resetter<int>(&focus_changed_count_).value();
+ }
+
+ int GetActivationChangedCountAndReset() {
+ return Resetter<int>(&activation_changed_count_).value();
}
private:
@@ -96,6 +145,9 @@ class TestObserver : public DisplayController::Observer,
int bounds_changed_count_;
int64 changed_display_id_;
+ int focus_changed_count_;
+ int activation_changed_count_;
+
DISALLOW_COPY_AND_ASSIGN(TestObserver);
};
@@ -258,10 +310,16 @@ TEST_F(DisplayControllerTest, SecondaryDisplayLayout) {
if (!SupportsMultipleDisplays())
return;
+ // Creates windows to catch activation change event.
+ scoped_ptr<aura::Window> w1(CreateTestWindowInShellWithId(1));
+ w1->Focus();
+
TestObserver observer;
UpdateDisplay("500x500,400x400");
EXPECT_EQ(1, observer.CountAndReset()); // resize and add
EXPECT_EQ(1, observer.GetBoundsChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
gfx::Insets insets(5, 5, 5, 5);
int64 secondary_display_id = ScreenAsh::GetSecondaryDisplay().id();
Shell::GetInstance()->display_manager()->UpdateWorkAreaOfDisplay(
@@ -271,11 +329,15 @@ TEST_F(DisplayControllerTest, SecondaryDisplayLayout) {
EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("500,0 400x400", GetSecondaryDisplay().bounds().ToString());
EXPECT_EQ("505,5 390x390", GetSecondaryDisplay().work_area().ToString());
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
// Layout the secondary display to the bottom of the primary.
SetSecondaryDisplayLayout(DisplayLayout::BOTTOM);
EXPECT_EQ(1, observer.CountAndReset());
EXPECT_EQ(1, observer.GetBoundsChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
EXPECT_EQ(secondary_display_id, observer.GetChangedDisplayIdAndReset());
EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("0,500 400x400", GetSecondaryDisplay().bounds().ToString());
@@ -285,6 +347,8 @@ TEST_F(DisplayControllerTest, SecondaryDisplayLayout) {
SetSecondaryDisplayLayout(DisplayLayout::LEFT);
EXPECT_EQ(1, observer.CountAndReset());
EXPECT_EQ(1, observer.GetBoundsChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
EXPECT_EQ(secondary_display_id, observer.GetChangedDisplayIdAndReset());
EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("-400,0 400x400", GetSecondaryDisplay().bounds().ToString());
@@ -294,6 +358,8 @@ TEST_F(DisplayControllerTest, SecondaryDisplayLayout) {
SetSecondaryDisplayLayout(DisplayLayout::TOP);
EXPECT_EQ(1, observer.CountAndReset());
EXPECT_EQ(1, observer.GetBoundsChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
EXPECT_EQ(secondary_display_id, observer.GetChangedDisplayIdAndReset());
EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("0,-400 400x400", GetSecondaryDisplay().bounds().ToString());
@@ -303,6 +369,8 @@ TEST_F(DisplayControllerTest, SecondaryDisplayLayout) {
SetSecondaryDisplayLayoutAndOffset(DisplayLayout::RIGHT, 300);
EXPECT_EQ(1, observer.CountAndReset()); // resize and add
EXPECT_EQ(1, observer.GetBoundsChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
EXPECT_EQ(secondary_display_id, observer.GetChangedDisplayIdAndReset());
EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("500,300 400x400", GetSecondaryDisplay().bounds().ToString());
@@ -311,6 +379,8 @@ TEST_F(DisplayControllerTest, SecondaryDisplayLayout) {
SetSecondaryDisplayLayoutAndOffset(DisplayLayout::RIGHT, 490);
EXPECT_EQ(1, observer.CountAndReset()); // resize and add
EXPECT_EQ(1, observer.GetBoundsChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
EXPECT_EQ(secondary_display_id, observer.GetChangedDisplayIdAndReset());
EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("500,400 400x400", GetSecondaryDisplay().bounds().ToString());
@@ -319,6 +389,8 @@ TEST_F(DisplayControllerTest, SecondaryDisplayLayout) {
EXPECT_EQ(secondary_display_id, observer.GetChangedDisplayIdAndReset());
EXPECT_EQ(1, observer.GetBoundsChangedCountAndReset());
EXPECT_EQ(1, observer.CountAndReset()); // resize and add
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("500,-300 400x400", GetSecondaryDisplay().bounds().ToString());
@@ -327,6 +399,8 @@ TEST_F(DisplayControllerTest, SecondaryDisplayLayout) {
EXPECT_EQ(secondary_display_id, observer.GetChangedDisplayIdAndReset());
EXPECT_EQ(1, observer.GetBoundsChangedCountAndReset());
EXPECT_EQ(1, observer.CountAndReset()); // resize and add
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("-200,500 400x400", GetSecondaryDisplay().bounds().ToString());
@@ -335,6 +409,8 @@ TEST_F(DisplayControllerTest, SecondaryDisplayLayout) {
EXPECT_EQ(secondary_display_id, observer.GetChangedDisplayIdAndReset());
EXPECT_EQ(1, observer.GetBoundsChangedCountAndReset());
EXPECT_EQ(1, observer.CountAndReset()); // resize and add
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("400,500 400x400", GetSecondaryDisplay().bounds().ToString());
@@ -342,6 +418,8 @@ TEST_F(DisplayControllerTest, SecondaryDisplayLayout) {
EXPECT_EQ(secondary_display_id, observer.GetChangedDisplayIdAndReset());
EXPECT_EQ(1, observer.GetBoundsChangedCountAndReset());
EXPECT_EQ(1, observer.CountAndReset()); // resize and add
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("-300,500 400x400", GetSecondaryDisplay().bounds().ToString());
@@ -350,18 +428,30 @@ TEST_F(DisplayControllerTest, SecondaryDisplayLayout) {
EXPECT_EQ(0, observer.GetChangedDisplayIdAndReset());
EXPECT_EQ(0, observer.GetBoundsChangedCountAndReset());
EXPECT_EQ(0, observer.CountAndReset()); // resize and add
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("-300,500 400x400", GetSecondaryDisplay().bounds().ToString());
+
+ UpdateDisplay("500x500");
+ EXPECT_LE(1, observer.GetFocusChangedCountAndReset());
+ EXPECT_LE(1, observer.GetActivationChangedCountAndReset());
}
TEST_F(DisplayControllerTest, BoundsUpdated) {
if (!SupportsMultipleDisplays())
return;
+ // Creates windows to catch activation change event.
+ scoped_ptr<aura::Window> w1(CreateTestWindowInShellWithId(1));
+ w1->Focus();
+
TestObserver observer;
SetDefaultDisplayLayout(DisplayLayout::BOTTOM);
UpdateDisplay("200x200,300x300"); // layout, resize and add.
EXPECT_EQ(1, observer.CountAndReset());
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
internal::DisplayManager* display_manager =
Shell::GetInstance()->display_manager();
@@ -375,21 +465,29 @@ TEST_F(DisplayControllerTest, BoundsUpdated) {
UpdateDisplay("400x400,200x200");
EXPECT_EQ(1, observer.CountAndReset()); // two resizes
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
EXPECT_EQ("0,0 400x400", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("0,400 200x200", GetSecondaryDisplay().bounds().ToString());
UpdateDisplay("400x400,300x300");
EXPECT_EQ(1, observer.CountAndReset());
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
EXPECT_EQ("0,0 400x400", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("0,400 300x300", GetSecondaryDisplay().bounds().ToString());
UpdateDisplay("400x400");
EXPECT_EQ(1, observer.CountAndReset());
+ EXPECT_LE(1, observer.GetFocusChangedCountAndReset());
+ EXPECT_LE(1, observer.GetActivationChangedCountAndReset());
EXPECT_EQ("0,0 400x400", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ(1, Shell::GetScreen()->GetNumDisplays());
UpdateDisplay("400x500*2,300x300");
EXPECT_EQ(1, observer.CountAndReset());
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays());
EXPECT_EQ("0,0 200x250", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("0,250 300x300", GetSecondaryDisplay().bounds().ToString());
@@ -397,25 +495,39 @@ TEST_F(DisplayControllerTest, BoundsUpdated) {
// No change
UpdateDisplay("400x500*2,300x300");
EXPECT_EQ(0, observer.CountAndReset());
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
// Rotation
int64 primary_id = GetPrimaryDisplay().id();
display_manager->SetDisplayRotation(primary_id, gfx::Display::ROTATE_90);
EXPECT_EQ(1, observer.CountAndReset());
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
display_manager->SetDisplayRotation(primary_id, gfx::Display::ROTATE_90);
EXPECT_EQ(0, observer.CountAndReset());
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
// UI scale is eanbled only on internal display.
int64 secondary_id = GetSecondaryDisplay().id();
gfx::Display::SetInternalDisplayId(secondary_id);
display_manager->SetDisplayUIScale(secondary_id, 1.125f);
EXPECT_EQ(1, observer.CountAndReset());
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
display_manager->SetDisplayUIScale(secondary_id, 1.125f);
EXPECT_EQ(0, observer.CountAndReset());
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
display_manager->SetDisplayUIScale(primary_id, 1.125f);
EXPECT_EQ(0, observer.CountAndReset());
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
display_manager->SetDisplayUIScale(primary_id, 1.125f);
EXPECT_EQ(0, observer.CountAndReset());
+ EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
+ EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
}
TEST_F(DisplayControllerTest, InvertLayout) {
@@ -891,12 +1003,12 @@ TEST_F(DisplayControllerTest, OverscanInsets) {
UpdateDisplay("400x300*2,600x400/o");
root_windows = Shell::GetAllRootWindows();
gfx::Point point;
- Shell::GetAllRootWindows()[1]->GetRootTransform().TransformPoint(point);
+ Shell::GetAllRootWindows()[1]->GetRootTransform().TransformPoint(&point);
EXPECT_EQ("15,10", point.ToString());
display_controller->SwapPrimaryDisplay();
point.SetPoint(0, 0);
- Shell::GetAllRootWindows()[1]->GetRootTransform().TransformPoint(point);
+ Shell::GetAllRootWindows()[1]->GetRootTransform().TransformPoint(&point);
EXPECT_EQ("15,10", point.ToString());
Shell::GetInstance()->RemovePreTargetHandler(&event_handler);
diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc
index 1c3edea282..9f6b7ea28e 100644
--- a/ash/display/display_manager.cc
+++ b/ash/display/display_manager.cc
@@ -636,7 +636,7 @@ void DisplayManager::UpdateDisplays(
return;
}
if (delegate_)
- delegate_->PreDisplayConfigurationChange();
+ delegate_->PreDisplayConfigurationChange(!removed_displays.empty());
size_t updated_index;
if (UpdateSecondaryDisplayBoundsForLayout(&new_displays, &updated_index) &&
diff --git a/ash/display/display_manager.h b/ash/display/display_manager.h
index 4699eeef1e..93c203b9a5 100644
--- a/ash/display/display_manager.h
+++ b/ash/display/display_manager.h
@@ -59,7 +59,7 @@ class ASH_EXPORT DisplayManager
virtual void CloseMirrorWindow() = 0;
// Called before and after the display configuration changes.
- virtual void PreDisplayConfigurationChange() = 0;
+ virtual void PreDisplayConfigurationChange(bool display_removed) = 0;
virtual void PostDisplayConfigurationChange() = 0;
};
diff --git a/ash/display/event_transformation_handler.cc b/ash/display/event_transformation_handler.cc
index cb33891edf..5f9e450933 100644
--- a/ash/display/event_transformation_handler.cc
+++ b/ash/display/event_transformation_handler.cc
@@ -12,8 +12,8 @@
#include "ash/wm/window_util.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
-#include "ui/base/events/event.h"
#include "ui/compositor/dip_util.h"
+#include "ui/events/event.h"
#include "ui/gfx/display.h"
#include "ui/gfx/screen.h"
diff --git a/ash/display/event_transformation_handler.h b/ash/display/event_transformation_handler.h
index b2a7167776..da9560f81a 100644
--- a/ash/display/event_transformation_handler.h
+++ b/ash/display/event_transformation_handler.h
@@ -7,7 +7,7 @@
#include "ash/ash_export.h"
#include "base/compiler_specific.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_handler.h"
namespace ash {
diff --git a/ash/display/mirror_window_controller.cc b/ash/display/mirror_window_controller.cc
index 1a338fec76..e923219e8d 100644
--- a/ash/display/mirror_window_controller.cc
+++ b/ash/display/mirror_window_controller.cc
@@ -34,6 +34,10 @@
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/gfx/native_widget_types.h"
+#if defined(USE_X11)
+#include "ui/base/x/x11_util.h"
+#endif
+
namespace ash {
namespace internal {
namespace {
@@ -43,8 +47,7 @@ namespace {
void DisableInput(XID window) {
long event_mask = ExposureMask | VisibilityChangeMask |
StructureNotifyMask | PropertyChangeMask;
- XSelectInput(base::MessagePumpX11::GetDefaultXDisplay(),
- window, event_mask);
+ XSelectInput(ui::GetXDisplay(), window, event_mask);
}
#endif
diff --git a/ash/display/mouse_cursor_event_filter.cc b/ash/display/mouse_cursor_event_filter.cc
index f3c3a746d4..3d97c27c8f 100644
--- a/ash/display/mouse_cursor_event_filter.cc
+++ b/ash/display/mouse_cursor_event_filter.cc
@@ -15,9 +15,9 @@
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
-#include "ui/base/events/event.h"
#include "ui/base/layout.h"
#include "ui/compositor/dip_util.h"
+#include "ui/events/event.h"
#include "ui/gfx/screen.h"
namespace ash {
@@ -38,6 +38,7 @@ const int kIndicatorThickness = 1;
MouseCursorEventFilter::MouseCursorEventFilter()
: mouse_warp_mode_(WARP_ALWAYS),
+ was_mouse_warped_(false),
drag_source_root_(NULL),
shared_display_edge_indicator_(new SharedDisplayEdgeIndicator) {
}
@@ -96,6 +97,17 @@ bool MouseCursorEventFilter::WarpMouseCursorIfNecessary(
if (Shell::GetScreen()->GetNumDisplays() <= 1 ||
mouse_warp_mode_ == WARP_NONE)
return false;
+
+ // Do not warp again right after the cursor was warped. Sometimes the offset
+ // is not long enough and the cursor moves at the edge of the destination
+ // display. See crbug.com/278885
+ // TODO(mukai): simplify the offset calculation below, it would not be
+ // necessary anymore with this flag.
+ if (was_mouse_warped_) {
+ was_mouse_warped_ = false;
+ return false;
+ }
+
const float scale_at_target = ui::GetDeviceScaleFactor(target_root->layer());
aura::RootWindow* root_at_point = wm::GetRootWindowAt(point_in_screen);
@@ -145,6 +157,7 @@ bool MouseCursorEventFilter::WarpMouseCursorIfNecessary(
if (dst_root->bounds().Contains(point_in_dst_screen)) {
DCHECK_NE(dst_root, root_at_point);
+ was_mouse_warped_ = true;
dst_root->MoveCursorTo(point_in_dst_screen);
return true;
}
diff --git a/ash/display/mouse_cursor_event_filter.h b/ash/display/mouse_cursor_event_filter.h
index 593448ff02..78f907483c 100644
--- a/ash/display/mouse_cursor_event_filter.h
+++ b/ash/display/mouse_cursor_event_filter.h
@@ -9,7 +9,7 @@
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_handler.h"
#include "ui/gfx/rect.h"
namespace aura {
@@ -50,22 +50,19 @@ class ASH_EXPORT MouseCursorEventFilter : public ui::EventHandler {
virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
private:
+ friend class DragWindowResizerTest;
+ friend class MouseCursorEventFilterTest;
+ FRIEND_TEST_ALL_PREFIXES(MouseCursorEventFilterTest, DoNotWarpTwice);
FRIEND_TEST_ALL_PREFIXES(MouseCursorEventFilterTest, SetMouseWarpModeFlag);
- FRIEND_TEST_ALL_PREFIXES(MouseCursorEventFilterTest, WarpMouse);
- FRIEND_TEST_ALL_PREFIXES(MouseCursorEventFilterTest,
- WarpMouseDifferentSizeDisplays);
- FRIEND_TEST_ALL_PREFIXES(MouseCursorEventFilterTest,
- WarpMouseDifferentScaleDisplays);
FRIEND_TEST_ALL_PREFIXES(MouseCursorEventFilterTest,
IndicatorBoundsTestOnRight);
FRIEND_TEST_ALL_PREFIXES(MouseCursorEventFilterTest,
IndicatorBoundsTestOnLeft);
FRIEND_TEST_ALL_PREFIXES(MouseCursorEventFilterTest,
IndicatorBoundsTestOnTopBottom);
- FRIEND_TEST_ALL_PREFIXES(MouseCursorEventFilterTest, CursorDeviceScaleFactor);
FRIEND_TEST_ALL_PREFIXES(DragWindowResizerTest, WarpMousePointer);
- FRIEND_TEST_ALL_PREFIXES(DragWindowResizerTest, CursorDeviceScaleFactor);
- FRIEND_TEST_ALL_PREFIXES(DragWindowResizerTest, MoveWindowAcrossDisplays);
+
+ void reset_was_mouse_warped_for_test() { was_mouse_warped_ = false; }
// Warps the mouse cursor to an alternate root window when the
// |point_in_screen|, which is the location of the mouse cursor,
@@ -80,6 +77,10 @@ class ASH_EXPORT MouseCursorEventFilter : public ui::EventHandler {
MouseWarpMode mouse_warp_mode_;
+ // This flag is used to suppress the accidental mouse warp back to the
+ // original display.
+ bool was_mouse_warped_;
+
// The bounds for warp hole windows. |dst_indicator_bounds_| is kept
// in the instance for testing.
gfx::Rect src_indicator_bounds_;
diff --git a/ash/display/mouse_cursor_event_filter_unittest.cc b/ash/display/mouse_cursor_event_filter_unittest.cc
index e4c1f554ed..e4a25a80cf 100644
--- a/ash/display/mouse_cursor_event_filter_unittest.cc
+++ b/ash/display/mouse_cursor_event_filter_unittest.cc
@@ -31,7 +31,29 @@ gfx::Display GetSecondaryDisplay() {
} // namespace
-typedef test::AshTestBase MouseCursorEventFilterTest;
+class MouseCursorEventFilterTest : public test::AshTestBase {
+ public:
+ MouseCursorEventFilterTest() {}
+ virtual ~MouseCursorEventFilterTest() {}
+
+ protected:
+ MouseCursorEventFilter* event_filter() {
+ return Shell::GetInstance()->mouse_cursor_filter();
+ }
+
+ bool WarpMouseCursorIfNecessary(aura::RootWindow* target_root,
+ gfx::Point point_in_screen) {
+ bool is_warped = event_filter()->WarpMouseCursorIfNecessary(
+ target_root, point_in_screen);
+ event_filter()->reset_was_mouse_warped_for_test();
+ return is_warped;
+ }
+
+ private:
+ MouseCursorEventFilter* event_filter_;
+
+ DISALLOW_COPY_AND_ASSIGN(MouseCursorEventFilterTest);
+};
// Verifies if the mouse pointer correctly moves to another display when there
// are two displays.
@@ -41,59 +63,40 @@ TEST_F(MouseCursorEventFilterTest, WarpMouse) {
UpdateDisplay("500x500,500x500");
- MouseCursorEventFilter* event_filter =
- Shell::GetInstance()->mouse_cursor_filter();
ASSERT_EQ(
DisplayLayout::RIGHT,
Shell::GetInstance()->display_manager()->layout_store()->
default_display_layout().position);
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
- bool is_warped = event_filter->WarpMouseCursorIfNecessary(root_windows[0],
- gfx::Point(11, 11));
- EXPECT_FALSE(is_warped);
- is_warped = event_filter->WarpMouseCursorIfNecessary(root_windows[1],
- gfx::Point(11, 11));
- EXPECT_FALSE(is_warped);
+ EXPECT_FALSE(WarpMouseCursorIfNecessary(root_windows[0], gfx::Point(11, 11)));
+ EXPECT_FALSE(WarpMouseCursorIfNecessary(root_windows[1], gfx::Point(11, 11)));
// Touch the right edge of the primary root window. Pointer should warp.
- is_warped = event_filter->WarpMouseCursorIfNecessary(root_windows[0],
- gfx::Point(499, 11));
- EXPECT_TRUE(is_warped);
+ EXPECT_TRUE(WarpMouseCursorIfNecessary(root_windows[0], gfx::Point(499, 11)));
EXPECT_EQ("501,11", // by 2px.
aura::Env::GetInstance()->last_mouse_location().ToString());
// Touch the left edge of the secondary root window. Pointer should warp.
- is_warped = event_filter->WarpMouseCursorIfNecessary(root_windows[1],
- gfx::Point(500, 11));
- EXPECT_TRUE(is_warped);
+ EXPECT_TRUE(WarpMouseCursorIfNecessary(root_windows[1], gfx::Point(500, 11)));
EXPECT_EQ("498,11", // by 2px.
aura::Env::GetInstance()->last_mouse_location().ToString());
// Touch the left edge of the primary root window.
- is_warped = event_filter->WarpMouseCursorIfNecessary(root_windows[0],
- gfx::Point(0, 11));
- EXPECT_FALSE(is_warped);
+ EXPECT_FALSE(WarpMouseCursorIfNecessary(root_windows[0], gfx::Point(0, 11)));
// Touch the top edge of the primary root window.
- is_warped = event_filter->WarpMouseCursorIfNecessary(root_windows[0],
- gfx::Point(11, 0));
- EXPECT_FALSE(is_warped);
+ EXPECT_FALSE(WarpMouseCursorIfNecessary(root_windows[0], gfx::Point(11, 0)));
// Touch the bottom edge of the primary root window.
- is_warped = event_filter->WarpMouseCursorIfNecessary(root_windows[0],
- gfx::Point(11, 499));
- EXPECT_FALSE(is_warped);
+ EXPECT_FALSE(WarpMouseCursorIfNecessary(root_windows[0],
+ gfx::Point(11, 499)));
// Touch the right edge of the secondary root window.
- is_warped = event_filter->WarpMouseCursorIfNecessary(root_windows[1],
- gfx::Point(999, 11));
- EXPECT_FALSE(is_warped);
+ EXPECT_FALSE(WarpMouseCursorIfNecessary(root_windows[1],
+ gfx::Point(999, 11)));
// Touch the top edge of the secondary root window.
- is_warped = event_filter->WarpMouseCursorIfNecessary(root_windows[1],
- gfx::Point(11, 0));
- EXPECT_FALSE(is_warped);
+ EXPECT_FALSE(WarpMouseCursorIfNecessary(root_windows[1], gfx::Point(11, 0)));
// Touch the bottom edge of the secondary root window.
- is_warped = event_filter->WarpMouseCursorIfNecessary(root_windows[1],
- gfx::Point(11, 499));
- EXPECT_FALSE(is_warped);
+ EXPECT_FALSE(WarpMouseCursorIfNecessary(root_windows[1],
+ gfx::Point(11, 499)));
}
// Verifies if the mouse pointer correctly moves to another display even when
@@ -104,8 +107,6 @@ TEST_F(MouseCursorEventFilterTest, WarpMouseDifferentSizeDisplays) {
UpdateDisplay("500x500,600x600"); // the second one is larger.
- MouseCursorEventFilter* event_filter =
- Shell::GetInstance()->mouse_cursor_filter();
ASSERT_EQ(
DisplayLayout::RIGHT,
Shell::GetInstance()->display_manager()->
@@ -116,17 +117,14 @@ TEST_F(MouseCursorEventFilterTest, WarpMouseDifferentSizeDisplays) {
// Touch the left edge of the secondary root window. Pointer should NOT warp
// because 1px left of (0, 500) is outside the primary root window.
- bool is_warped = event_filter->WarpMouseCursorIfNecessary(root_windows[1],
- gfx::Point(0, 500));
- EXPECT_FALSE(is_warped);
+ EXPECT_FALSE(WarpMouseCursorIfNecessary(root_windows[1], gfx::Point(0, 500)));
EXPECT_EQ("623,123", // by 2px.
aura::Env::GetInstance()->last_mouse_location().ToString());
// Touch the left edge of the secondary root window. Pointer should warp
// because 1px left of (0, 499) is inside the primary root window.
- is_warped = event_filter->WarpMouseCursorIfNecessary(root_windows[1],
- gfx::Point(500, 499));
- EXPECT_TRUE(is_warped);
+ EXPECT_TRUE(WarpMouseCursorIfNecessary(root_windows[1],
+ gfx::Point(500, 499)));
EXPECT_EQ("498,499", // by 2px.
aura::Env::GetInstance()->last_mouse_location().ToString());
}
@@ -139,8 +137,6 @@ TEST_F(MouseCursorEventFilterTest, WarpMouseDifferentScaleDisplays) {
UpdateDisplay("500x500,600x600*2");
- MouseCursorEventFilter* event_filter =
- Shell::GetInstance()->mouse_cursor_filter();
ASSERT_EQ(
DisplayLayout::RIGHT,
Shell::GetInstance()->display_manager()->
@@ -152,22 +148,47 @@ TEST_F(MouseCursorEventFilterTest, WarpMouseDifferentScaleDisplays) {
// This emulates the dragging back to the 2nd display, which has
// higher scale factor, by having 2nd display's root as target
// but have the edge of 1st display.
- bool is_warped =
- event_filter->WarpMouseCursorIfNecessary(root_windows[1],
- gfx::Point(498, 123));
- EXPECT_TRUE(is_warped);
+ EXPECT_TRUE(WarpMouseCursorIfNecessary(root_windows[1],
+ gfx::Point(498, 123)));
EXPECT_EQ("502,123",
aura::Env::GetInstance()->last_mouse_location().ToString());
// Touch the edge of 2nd display again and make sure it warps to
// 1st dislay.
- is_warped = event_filter->WarpMouseCursorIfNecessary(root_windows[1],
- gfx::Point(500, 123));
- EXPECT_TRUE(is_warped);
+ EXPECT_TRUE(WarpMouseCursorIfNecessary(root_windows[1],
+ gfx::Point(500, 123)));
EXPECT_EQ("496,123",
aura::Env::GetInstance()->last_mouse_location().ToString());
}
+TEST_F(MouseCursorEventFilterTest, DoNotWarpTwice) {
+ if (!SupportsMultipleDisplays())
+ return;
+
+ UpdateDisplay("500x500,600x600");
+
+ Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
+ aura::Env::GetInstance()->set_last_mouse_location(gfx::Point(623, 123));
+
+ // Touch the right edge of the primary root window. Pointer should warp.
+ EXPECT_TRUE(event_filter()->WarpMouseCursorIfNecessary(root_windows[0],
+ gfx::Point(499, 11)));
+ EXPECT_EQ("501,11", // by 2px.
+ aura::Env::GetInstance()->last_mouse_location().ToString());
+
+ // Touch the left edge of the secondary root window immediately. This should
+ // be ignored.
+ EXPECT_FALSE(event_filter()->WarpMouseCursorIfNecessary(root_windows[1],
+ gfx::Point(500, 11)));
+
+ // Touch the left edge of the secondary root window again, pointer should
+ // warp for this time.
+ EXPECT_TRUE(event_filter()->WarpMouseCursorIfNecessary(root_windows[1],
+ gfx::Point(500, 11)));
+ EXPECT_EQ("498,11", // by 2px.
+ aura::Env::GetInstance()->last_mouse_location().ToString());
+}
+
// Verifies if MouseCursorEventFilter::set_mouse_warp_mode() works as expected.
TEST_F(MouseCursorEventFilterTest, SetMouseWarpModeFlag) {
if (!SupportsMultipleDisplays())
@@ -175,23 +196,17 @@ TEST_F(MouseCursorEventFilterTest, SetMouseWarpModeFlag) {
UpdateDisplay("500x500,500x500");
- MouseCursorEventFilter* event_filter =
- Shell::GetInstance()->mouse_cursor_filter();
-
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
aura::Env::GetInstance()->set_last_mouse_location(gfx::Point(1, 1));
- event_filter->set_mouse_warp_mode(MouseCursorEventFilter::WARP_NONE);
- bool is_warped = event_filter->WarpMouseCursorIfNecessary(root_windows[0],
- gfx::Point(499, 11));
- EXPECT_FALSE(is_warped);
+ event_filter()->set_mouse_warp_mode(MouseCursorEventFilter::WARP_NONE);
+ EXPECT_FALSE(WarpMouseCursorIfNecessary(root_windows[0],
+ gfx::Point(499, 11)));
EXPECT_EQ("1,1",
aura::Env::GetInstance()->last_mouse_location().ToString());
- event_filter->set_mouse_warp_mode(MouseCursorEventFilter::WARP_ALWAYS);
- is_warped = event_filter->WarpMouseCursorIfNecessary(root_windows[0],
- gfx::Point(499, 11));
- EXPECT_TRUE(is_warped);
+ event_filter()->set_mouse_warp_mode(MouseCursorEventFilter::WARP_ALWAYS);
+ EXPECT_TRUE(WarpMouseCursorIfNecessary(root_windows[0], gfx::Point(499, 11)));
EXPECT_EQ("501,11",
aura::Env::GetInstance()->last_mouse_location().ToString());
}
@@ -208,51 +223,49 @@ TEST_F(MouseCursorEventFilterTest, IndicatorBoundsTestOnRight) {
Shell::GetInstance()->display_controller();
DisplayLayout layout(DisplayLayout::RIGHT, 0);
controller->SetLayoutForCurrentDisplays(layout);
- ash::internal::MouseCursorEventFilter* event_filter =
- Shell::GetInstance()->mouse_cursor_filter();
- event_filter->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
- EXPECT_EQ("359,16 1x344", event_filter->src_indicator_bounds_.ToString());
- EXPECT_EQ("360,0 1x360", event_filter->dst_indicator_bounds_.ToString());
- event_filter->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
- EXPECT_EQ("360,16 1x344", event_filter->src_indicator_bounds_.ToString());
- EXPECT_EQ("359,0 1x360", event_filter->dst_indicator_bounds_.ToString());
+ event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
+ EXPECT_EQ("359,16 1x344", event_filter()->src_indicator_bounds_.ToString());
+ EXPECT_EQ("360,0 1x360", event_filter()->dst_indicator_bounds_.ToString());
+ event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
+ EXPECT_EQ("360,16 1x344", event_filter()->src_indicator_bounds_.ToString());
+ EXPECT_EQ("359,0 1x360", event_filter()->dst_indicator_bounds_.ToString());
// Move 2nd display downwards a bit.
layout.offset = 5;
controller->SetLayoutForCurrentDisplays(layout);
- event_filter->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
+ event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
// This is same as before because the 2nd display's y is above
// the indicator's x.
- EXPECT_EQ("359,16 1x344", event_filter->src_indicator_bounds_.ToString());
- EXPECT_EQ("360,5 1x355", event_filter->dst_indicator_bounds_.ToString());
- event_filter->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
- EXPECT_EQ("360,21 1x339", event_filter->src_indicator_bounds_.ToString());
- EXPECT_EQ("359,5 1x355", event_filter->dst_indicator_bounds_.ToString());
+ EXPECT_EQ("359,16 1x344", event_filter()->src_indicator_bounds_.ToString());
+ EXPECT_EQ("360,5 1x355", event_filter()->dst_indicator_bounds_.ToString());
+ event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
+ EXPECT_EQ("360,21 1x339", event_filter()->src_indicator_bounds_.ToString());
+ EXPECT_EQ("359,5 1x355", event_filter()->dst_indicator_bounds_.ToString());
// Move it down further so that the shared edge is shorter than
// minimum hole size (160).
layout.offset = 200;
controller->SetLayoutForCurrentDisplays(layout);
- event_filter->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
- EXPECT_EQ("359,200 1x160", event_filter->src_indicator_bounds_.ToString());
- EXPECT_EQ("360,200 1x160", event_filter->dst_indicator_bounds_.ToString());
- event_filter->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
- EXPECT_EQ("360,200 1x160", event_filter->src_indicator_bounds_.ToString());
- EXPECT_EQ("359,200 1x160", event_filter->dst_indicator_bounds_.ToString());
+ event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
+ EXPECT_EQ("359,200 1x160", event_filter()->src_indicator_bounds_.ToString());
+ EXPECT_EQ("360,200 1x160", event_filter()->dst_indicator_bounds_.ToString());
+ event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
+ EXPECT_EQ("360,200 1x160", event_filter()->src_indicator_bounds_.ToString());
+ EXPECT_EQ("359,200 1x160", event_filter()->dst_indicator_bounds_.ToString());
// Now move 2nd display upwards
layout.offset = -5;
controller->SetLayoutForCurrentDisplays(layout);
- event_filter->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
- EXPECT_EQ("359,16 1x344", event_filter->src_indicator_bounds_.ToString());
- EXPECT_EQ("360,0 1x360", event_filter->dst_indicator_bounds_.ToString());
- event_filter->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
+ event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
+ EXPECT_EQ("359,16 1x344", event_filter()->src_indicator_bounds_.ToString());
+ EXPECT_EQ("360,0 1x360", event_filter()->dst_indicator_bounds_.ToString());
+ event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
// 16 px are reserved on 2nd display from top, so y must be
// (16 - 5) = 11
- EXPECT_EQ("360,11 1x349", event_filter->src_indicator_bounds_.ToString());
- EXPECT_EQ("359,0 1x360", event_filter->dst_indicator_bounds_.ToString());
+ EXPECT_EQ("360,11 1x349", event_filter()->src_indicator_bounds_.ToString());
+ EXPECT_EQ("359,0 1x360", event_filter()->dst_indicator_bounds_.ToString());
- event_filter->HideSharedEdgeIndicator();
+ event_filter()->HideSharedEdgeIndicator();
}
TEST_F(MouseCursorEventFilterTest, IndicatorBoundsTestOnLeft) {
@@ -266,24 +279,22 @@ TEST_F(MouseCursorEventFilterTest, IndicatorBoundsTestOnLeft) {
Shell::GetInstance()->display_controller();
DisplayLayout layout(DisplayLayout::LEFT, 0);
controller->SetLayoutForCurrentDisplays(layout);
- ash::internal::MouseCursorEventFilter* event_filter =
- Shell::GetInstance()->mouse_cursor_filter();
- event_filter->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
- EXPECT_EQ("0,16 1x344", event_filter->src_indicator_bounds_.ToString());
- EXPECT_EQ("-1,0 1x360", event_filter->dst_indicator_bounds_.ToString());
- event_filter->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
- EXPECT_EQ("-1,16 1x344", event_filter->src_indicator_bounds_.ToString());
- EXPECT_EQ("0,0 1x360", event_filter->dst_indicator_bounds_.ToString());
+ event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
+ EXPECT_EQ("0,16 1x344", event_filter()->src_indicator_bounds_.ToString());
+ EXPECT_EQ("-1,0 1x360", event_filter()->dst_indicator_bounds_.ToString());
+ event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
+ EXPECT_EQ("-1,16 1x344", event_filter()->src_indicator_bounds_.ToString());
+ EXPECT_EQ("0,0 1x360", event_filter()->dst_indicator_bounds_.ToString());
layout.offset = 250;
controller->SetLayoutForCurrentDisplays(layout);
- event_filter->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
- EXPECT_EQ("0,250 1x110", event_filter->src_indicator_bounds_.ToString());
- EXPECT_EQ("-1,250 1x110", event_filter->dst_indicator_bounds_.ToString());
- event_filter->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
- EXPECT_EQ("-1,250 1x110", event_filter->src_indicator_bounds_.ToString());
- EXPECT_EQ("0,250 1x110", event_filter->dst_indicator_bounds_.ToString());
- event_filter->HideSharedEdgeIndicator();
+ event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
+ EXPECT_EQ("0,250 1x110", event_filter()->src_indicator_bounds_.ToString());
+ EXPECT_EQ("-1,250 1x110", event_filter()->dst_indicator_bounds_.ToString());
+ event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
+ EXPECT_EQ("-1,250 1x110", event_filter()->src_indicator_bounds_.ToString());
+ EXPECT_EQ("0,250 1x110", event_filter()->dst_indicator_bounds_.ToString());
+ event_filter()->HideSharedEdgeIndicator();
}
TEST_F(MouseCursorEventFilterTest, IndicatorBoundsTestOnTopBottom) {
@@ -297,35 +308,33 @@ TEST_F(MouseCursorEventFilterTest, IndicatorBoundsTestOnTopBottom) {
Shell::GetInstance()->display_controller();
DisplayLayout layout(DisplayLayout::TOP, 0);
controller->SetLayoutForCurrentDisplays(layout);
- ash::internal::MouseCursorEventFilter* event_filter =
- Shell::GetInstance()->mouse_cursor_filter();
- event_filter->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
- EXPECT_EQ("0,0 360x1", event_filter->src_indicator_bounds_.ToString());
- EXPECT_EQ("0,-1 360x1", event_filter->dst_indicator_bounds_.ToString());
- event_filter->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
- EXPECT_EQ("0,-1 360x1", event_filter->src_indicator_bounds_.ToString());
- EXPECT_EQ("0,0 360x1", event_filter->dst_indicator_bounds_.ToString());
+ event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
+ EXPECT_EQ("0,0 360x1", event_filter()->src_indicator_bounds_.ToString());
+ EXPECT_EQ("0,-1 360x1", event_filter()->dst_indicator_bounds_.ToString());
+ event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
+ EXPECT_EQ("0,-1 360x1", event_filter()->src_indicator_bounds_.ToString());
+ EXPECT_EQ("0,0 360x1", event_filter()->dst_indicator_bounds_.ToString());
layout.offset = 250;
controller->SetLayoutForCurrentDisplays(layout);
- event_filter->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
- EXPECT_EQ("250,0 110x1", event_filter->src_indicator_bounds_.ToString());
- EXPECT_EQ("250,-1 110x1", event_filter->dst_indicator_bounds_.ToString());
- event_filter->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
- EXPECT_EQ("250,-1 110x1", event_filter->src_indicator_bounds_.ToString());
- EXPECT_EQ("250,0 110x1", event_filter->dst_indicator_bounds_.ToString());
+ event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
+ EXPECT_EQ("250,0 110x1", event_filter()->src_indicator_bounds_.ToString());
+ EXPECT_EQ("250,-1 110x1", event_filter()->dst_indicator_bounds_.ToString());
+ event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
+ EXPECT_EQ("250,-1 110x1", event_filter()->src_indicator_bounds_.ToString());
+ EXPECT_EQ("250,0 110x1", event_filter()->dst_indicator_bounds_.ToString());
layout.position = DisplayLayout::BOTTOM;
layout.offset = 0;
controller->SetLayoutForCurrentDisplays(layout);
- event_filter->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
- EXPECT_EQ("0,359 360x1", event_filter->src_indicator_bounds_.ToString());
- EXPECT_EQ("0,360 360x1", event_filter->dst_indicator_bounds_.ToString());
- event_filter->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
- EXPECT_EQ("0,360 360x1", event_filter->src_indicator_bounds_.ToString());
- EXPECT_EQ("0,359 360x1", event_filter->dst_indicator_bounds_.ToString());
-
- event_filter->HideSharedEdgeIndicator();
+ event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
+ EXPECT_EQ("0,359 360x1", event_filter()->src_indicator_bounds_.ToString());
+ EXPECT_EQ("0,360 360x1", event_filter()->dst_indicator_bounds_.ToString());
+ event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
+ EXPECT_EQ("0,360 360x1", event_filter()->src_indicator_bounds_.ToString());
+ EXPECT_EQ("0,359 360x1", event_filter()->dst_indicator_bounds_.ToString());
+
+ event_filter()->HideSharedEdgeIndicator();
}
// Verifies cursor's device scale factor is updated when a cursor has moved
@@ -344,15 +353,11 @@ TEST_F(MouseCursorEventFilterTest, CursorDeviceScaleFactor) {
ASSERT_EQ(2U, root_windows.size());
test::CursorManagerTestApi cursor_test_api(
Shell::GetInstance()->cursor_manager());
- MouseCursorEventFilter* event_filter =
- Shell::GetInstance()->mouse_cursor_filter();
EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor());
- event_filter->WarpMouseCursorIfNecessary(root_windows[0],
- gfx::Point(399, 200));
+ WarpMouseCursorIfNecessary(root_windows[0], gfx::Point(399, 200));
EXPECT_EQ(2.0f, cursor_test_api.GetDisplay().device_scale_factor());
- event_filter->WarpMouseCursorIfNecessary(root_windows[1],
- gfx::Point(400, 200));
+ WarpMouseCursorIfNecessary(root_windows[1], gfx::Point(400, 200));
EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor());
}
diff --git a/ash/display/root_window_transformers_unittest.cc b/ash/display/root_window_transformers_unittest.cc
index 39d500ceef..d426a63d82 100644
--- a/ash/display/root_window_transformers_unittest.cc
+++ b/ash/display/root_window_transformers_unittest.cc
@@ -21,7 +21,7 @@
#include "ui/aura/root_window_transformer.h"
#include "ui/aura/test/event_generator.h"
#include "ui/aura/window_tracker.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_handler.h"
#include "ui/gfx/display.h"
#include "ui/gfx/rect_conversions.h"
#include "ui/gfx/screen.h"
diff --git a/ash/display/screen_position_controller.cc b/ash/display/screen_position_controller.cc
index 8c37efeebe..b416d38624 100644
--- a/ash/display/screen_position_controller.cc
+++ b/ash/display/screen_position_controller.cc
@@ -197,7 +197,7 @@ void ScreenPositionController::SetBounds(aura::Window* window,
// Restore focused/active window.
if (tracker.Contains(focused)) {
aura::client::GetFocusClient(window)->FocusWindow(focused);
- ash::Shell::GetInstance()->set_active_root_window(
+ ash::Shell::GetInstance()->set_target_root_window(
focused->GetRootWindow());
} else if (tracker.Contains(active)) {
activation_client->ActivateWindow(active);
diff --git a/ash/display/shared_display_edge_indicator.cc b/ash/display/shared_display_edge_indicator.cc
index cfcf4bafdf..0e16cee0fd 100644
--- a/ash/display/shared_display_edge_indicator.cc
+++ b/ash/display/shared_display_edge_indicator.cc
@@ -10,7 +10,7 @@
#include "third_party/skia/include/core/SkColor.h"
#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/root_window.h"
-#include "ui/base/animation/throb_animation.h"
+#include "ui/gfx/animation/throb_animation.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/display.h"
#include "ui/gfx/screen.h"
@@ -88,7 +88,7 @@ void SharedDisplayEdgeIndicator::Show(const gfx::Rect& src_bounds,
dst_indicator_ = new IndicatorView;
CreateWidget(src_bounds, src_indicator_);
CreateWidget(dst_bounds, dst_indicator_);
- animation_.reset(new ui::ThrobAnimation(this));
+ animation_.reset(new gfx::ThrobAnimation(this));
animation_->SetThrobDuration(kIndicatorAnimationDurationMs);
animation_->StartThrobbing(-1 /* infinite */);
}
@@ -103,7 +103,7 @@ void SharedDisplayEdgeIndicator::Hide() {
}
void SharedDisplayEdgeIndicator::AnimationProgressed(
- const ui::Animation* animation) {
+ const gfx::Animation* animation) {
int value = animation->CurrentValueBetween(0, 255);
SkColor color = SkColorSetARGB(0xFF, value, value, value);
if (src_indicator_)
diff --git a/ash/display/shared_display_edge_indicator.h b/ash/display/shared_display_edge_indicator.h
index 762d067b45..d0d242d03f 100644
--- a/ash/display/shared_display_edge_indicator.h
+++ b/ash/display/shared_display_edge_indicator.h
@@ -8,14 +8,11 @@
#include "ash/ash_export.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
-#include "ui/base/animation/animation_delegate.h"
+#include "ui/gfx/animation/animation_delegate.h"
#include "ui/gfx/display.h"
namespace gfx {
class Rect;
-}
-
-namespace ui {
class ThrobAnimation;
}
@@ -29,7 +26,7 @@ namespace internal {
// SharedDisplayEdgeIndicator is responsible for showing a window that indicates
// the edge that a window can be dragged into another display.
-class ASH_EXPORT SharedDisplayEdgeIndicator : public ui::AnimationDelegate {
+class ASH_EXPORT SharedDisplayEdgeIndicator : public gfx::AnimationDelegate {
public:
SharedDisplayEdgeIndicator();
virtual ~SharedDisplayEdgeIndicator();
@@ -40,8 +37,8 @@ class ASH_EXPORT SharedDisplayEdgeIndicator : public ui::AnimationDelegate {
void Show(const gfx::Rect& src_bounds, const gfx::Rect& dst_bounds);
void Hide();
- // ui::AnimationDelegate overrides:
- virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
+ // gfx::AnimationDelegate overrides:
+ virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
private:
// Used to show the displays' shared edge where a window can be moved across.
@@ -51,7 +48,7 @@ class ASH_EXPORT SharedDisplayEdgeIndicator : public ui::AnimationDelegate {
views::View* dst_indicator_;
// Used to transition the opacity.
- scoped_ptr<ui::ThrobAnimation> animation_;
+ scoped_ptr<gfx::ThrobAnimation> animation_;
DISALLOW_COPY_AND_ASSIGN(SharedDisplayEdgeIndicator);
};
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc
index 8d587c496b..9c8f930f71 100644
--- a/ash/drag_drop/drag_drop_controller.cc
+++ b/ash/drag_drop/drag_drop_controller.cc
@@ -17,12 +17,12 @@
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
-#include "ui/base/animation/linear_animation.h"
#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/dragdrop/os_exchange_data.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_utils.h"
#include "ui/base/hit_test.h"
+#include "ui/events/event.h"
+#include "ui/events/event_utils.h"
+#include "ui/gfx/animation/linear_animation.h"
#include "ui/gfx/path.h"
#include "ui/gfx/point.h"
#include "ui/gfx/rect.h"
@@ -224,7 +224,6 @@ int DragDropController::StartDragAndDrop(
if (cancel_animation_)
cancel_animation_->End();
-#if !defined(OS_MACOSX)
if (should_block_during_drag_drop_) {
base::RunLoop run_loop(aura::Env::GetInstance()->GetDispatcher());
quit_closure_ = run_loop.QuitClosure();
@@ -232,7 +231,6 @@ int DragDropController::StartDragAndDrop(
base::MessageLoop::ScopedNestableTaskAllower allow_nested(loop);
run_loop.Run();
}
-#endif // !defined(OS_MACOSX)
if (!cancel_animation_.get() || !cancel_animation_->is_animating() ||
!pending_long_tap_.get()) {
@@ -471,17 +469,17 @@ void DragDropController::OnWindowDestroyed(aura::Window* window) {
////////////////////////////////////////////////////////////////////////////////
// DragDropController, protected:
-ui::LinearAnimation* DragDropController::CreateCancelAnimation(
+gfx::LinearAnimation* DragDropController::CreateCancelAnimation(
int duration,
int frame_rate,
- ui::AnimationDelegate* delegate) {
- return new ui::LinearAnimation(duration, frame_rate, delegate);
+ gfx::AnimationDelegate* delegate) {
+ return new gfx::LinearAnimation(duration, frame_rate, delegate);
}
////////////////////////////////////////////////////////////////////////////////
// DragDropController, private:
-void DragDropController::AnimationEnded(const ui::Animation* animation) {
+void DragDropController::AnimationEnded(const gfx::Animation* animation) {
cancel_animation_.reset();
// By the time we finish animation, another drag/drop session may have
@@ -520,14 +518,14 @@ void DragDropController::DoDragCancel(int drag_cancel_animation_duration_ms) {
quit_closure_.Run();
}
-void DragDropController::AnimationProgressed(const ui::Animation* animation) {
+void DragDropController::AnimationProgressed(const gfx::Animation* animation) {
gfx::Rect current_bounds = animation->CurrentValueBetween(
drag_image_initial_bounds_for_cancel_animation_,
drag_image_final_bounds_for_cancel_animation_);
drag_image_->SetBoundsInScreen(current_bounds);
}
-void DragDropController::AnimationCanceled(const ui::Animation* animation) {
+void DragDropController::AnimationCanceled(const gfx::Animation* animation) {
AnimationEnded(animation);
}
diff --git a/ash/drag_drop/drag_drop_controller.h b/ash/drag_drop/drag_drop_controller.h
index a23ed913f2..6471db249b 100644
--- a/ash/drag_drop/drag_drop_controller.h
+++ b/ash/drag_drop/drag_drop_controller.h
@@ -10,10 +10,10 @@
#include "base/memory/weak_ptr.h"
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/window_observer.h"
-#include "ui/base/animation/animation_delegate.h"
#include "ui/base/dragdrop/os_exchange_data.h"
-#include "ui/base/events/event_constants.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_constants.h"
+#include "ui/events/event_handler.h"
+#include "ui/gfx/animation/animation_delegate.h"
#include "ui/gfx/rect.h"
namespace aura {
@@ -21,7 +21,7 @@ class RootWindow;
class Window;
}
-namespace ui {
+namespace gfx {
class LinearAnimation;
}
@@ -40,7 +40,7 @@ class DragImageView;
class ASH_EXPORT DragDropController
: public aura::client::DragDropClient,
public ui::EventHandler,
- public ui::AnimationDelegate,
+ public gfx::AnimationDelegate,
public aura::WindowObserver {
public:
DragDropController();
@@ -78,10 +78,10 @@ class ASH_EXPORT DragDropController
// Helper method to create a LinearAnimation object that will run the drag
// cancel animation. Caller take ownership of the returned object. Protected
// for testing.
- virtual ui::LinearAnimation* CreateCancelAnimation(
+ virtual gfx::LinearAnimation* CreateCancelAnimation(
int duration,
int frame_rate,
- ui::AnimationDelegate* delegate);
+ gfx::AnimationDelegate* delegate);
// Actual implementation of |DragCancel()|. protected for testing.
virtual void DoDragCancel(int drag_cancel_animation_duration_ms);
@@ -89,10 +89,10 @@ class ASH_EXPORT DragDropController
private:
friend class ash::test::DragDropControllerTest;
- // Overridden from ui::AnimationDelegate:
- virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
- virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
- virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE;
+ // Overridden from gfx::AnimationDelegate:
+ virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE;
+ virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
+ virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE;
// Helper method to start drag widget flying back animation.
void StartCanceledAnimation(int animation_duration_ms);
@@ -115,7 +115,7 @@ class ASH_EXPORT DragDropController
gfx::Rect drag_image_initial_bounds_for_cancel_animation_;
gfx::Rect drag_image_final_bounds_for_cancel_animation_;
- scoped_ptr<ui::LinearAnimation> cancel_animation_;
+ scoped_ptr<gfx::LinearAnimation> cancel_animation_;
// Window that started the drag.
aura::Window* drag_source_window_;
diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc
index 7ca79ea0a0..ba461929e4 100644
--- a/ash/drag_drop/drag_drop_controller_unittest.cc
+++ b/ash/drag_drop/drag_drop_controller_unittest.cc
@@ -14,16 +14,16 @@
#include "ui/aura/client/capture_client.h"
#include "ui/aura/root_window.h"
#include "ui/aura/test/event_generator.h"
-#include "ui/base/animation/linear_animation.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/scoped_clipboard_writer.h"
#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/dragdrop/drag_utils.h"
#include "ui/base/dragdrop/os_exchange_data.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_utils.h"
#include "ui/base/gestures/gesture_types.h"
#include "ui/base/ui_base_switches.h"
+#include "ui/events/event.h"
+#include "ui/events/event_utils.h"
+#include "ui/gfx/animation/linear_animation.h"
#include "ui/gfx/image/image_skia_rep.h"
#include "ui/views/test/test_views_delegate.h"
#include "ui/views/view.h"
@@ -130,12 +130,12 @@ class DragTestView : public views::View {
DISALLOW_COPY_AND_ASSIGN(DragTestView);
};
-class CompletableLinearAnimation : public ui::LinearAnimation {
+class CompletableLinearAnimation : public gfx::LinearAnimation {
public:
CompletableLinearAnimation(int duration,
int frame_rate,
- ui::AnimationDelegate* delegate)
- : ui::LinearAnimation(duration, frame_rate, delegate),
+ gfx::AnimationDelegate* delegate)
+ : gfx::LinearAnimation(duration, frame_rate, delegate),
duration_(duration) {
}
@@ -191,10 +191,10 @@ class TestDragDropController : public internal::DragDropController {
drag_canceled_ = true;
}
- virtual ui::LinearAnimation* CreateCancelAnimation(
+ virtual gfx::LinearAnimation* CreateCancelAnimation(
int duration,
int frame_rate,
- ui::AnimationDelegate* delegate) OVERRIDE {
+ gfx::AnimationDelegate* delegate) OVERRIDE {
return new CompletableLinearAnimation(duration, frame_rate, delegate);
}
diff --git a/ash/drag_drop/drag_drop_tracker.cc b/ash/drag_drop/drag_drop_tracker.cc
index 9de464540a..4fd1de8f84 100644
--- a/ash/drag_drop/drag_drop_tracker.cc
+++ b/ash/drag_drop/drag_drop_tracker.cc
@@ -8,7 +8,7 @@
#include "ash/shell_window_ids.h"
#include "ash/wm/coordinate_conversion.h"
#include "ui/aura/root_window.h"
-#include "ui/base/events/event.h"
+#include "ui/events/event.h"
#include "ui/gfx/screen.h"
namespace ash {
diff --git a/ash/drag_drop/drag_drop_tracker.h b/ash/drag_drop/drag_drop_tracker.h
index d7212ef796..c20952c6be 100644
--- a/ash/drag_drop/drag_drop_tracker.h
+++ b/ash/drag_drop/drag_drop_tracker.h
@@ -8,7 +8,7 @@
#include "ash/ash_export.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
-#include "ui/base/events/event.h"
+#include "ui/events/event.h"
namespace aura {
class RootWindow;
diff --git a/ash/drag_drop/drag_drop_tracker_unittest.cc b/ash/drag_drop/drag_drop_tracker_unittest.cc
index c0a9e91fa5..1c485b3d5e 100644
--- a/ash/drag_drop/drag_drop_tracker_unittest.cc
+++ b/ash/drag_drop/drag_drop_tracker_unittest.cc
@@ -77,7 +77,7 @@ TEST_F(DragDropTrackerTest, MAYBE_GetTarget) {
EXPECT_EQ("300,100 100x100", window1->GetBoundsInScreen().ToString());
// Make RootWindow0 active so that capture window is parented to it.
- Shell::GetInstance()->set_active_root_window(root_windows[0]);
+ Shell::GetInstance()->set_target_root_window(root_windows[0]);
// Start tracking from the RootWindow1 and check the point on RootWindow0 that
// |window0| covers.
@@ -98,7 +98,7 @@ TEST_F(DragDropTrackerTest, MAYBE_GetTarget) {
EXPECT_NE(window1.get(), GetTarget(gfx::Point(50, 250)));
// Make RootWindow1 active so that capture window is parented to it.
- Shell::GetInstance()->set_active_root_window(root_windows[1]);
+ Shell::GetInstance()->set_target_root_window(root_windows[1]);
// Start tracking from the RootWindow1 and check the point on RootWindow0 that
// |window0| covers.
@@ -140,7 +140,7 @@ TEST_F(DragDropTrackerTest, MAYBE_ConvertEvent) {
window1->Show();
// Make RootWindow0 active so that capture window is parented to it.
- Shell::GetInstance()->set_active_root_window(root_windows[0]);
+ Shell::GetInstance()->set_target_root_window(root_windows[0]);
// Start tracking from the RootWindow0 and converts the mouse event into
// |window0|'s coodinates.
@@ -169,7 +169,7 @@ TEST_F(DragDropTrackerTest, MAYBE_ConvertEvent) {
EXPECT_EQ(original01.flags(), converted01->flags());
// Make RootWindow1 active so that capture window is parented to it.
- Shell::GetInstance()->set_active_root_window(root_windows[1]);
+ Shell::GetInstance()->set_target_root_window(root_windows[1]);
// Start tracking from the RootWindow1 and converts the mouse event into
// |window0|'s coodinates.
diff --git a/ash/extended_desktop_unittest.cc b/ash/extended_desktop_unittest.cc
index 31dbd15ec7..a6a9107319 100644
--- a/ash/extended_desktop_unittest.cc
+++ b/ash/extended_desktop_unittest.cc
@@ -24,7 +24,7 @@
#include "ui/aura/test/window_test_api.h"
#include "ui/aura/window.h"
#include "ui/base/cursor/cursor.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_handler.h"
#include "ui/gfx/display.h"
#include "ui/gfx/screen.h"
#include "ui/views/controls/textfield/textfield.h"
@@ -222,7 +222,7 @@ TEST_F(ExtendedDesktopTest, SystemModal) {
views::Widget* widget_on_1st = CreateTestWidget(gfx::Rect(10, 10, 100, 100));
EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView()));
EXPECT_EQ(root_windows[0], widget_on_1st->GetNativeView()->GetRootWindow());
- EXPECT_EQ(root_windows[0], Shell::GetActiveRootWindow());
+ EXPECT_EQ(root_windows[0], Shell::GetTargetRootWindow());
// Open system modal. Make sure it's on 2nd root window and active.
views::Widget* modal_widget = views::Widget::CreateWindowWithContextAndBounds(
@@ -232,7 +232,7 @@ TEST_F(ExtendedDesktopTest, SystemModal) {
modal_widget->Show();
EXPECT_TRUE(wm::IsActiveWindow(modal_widget->GetNativeView()));
EXPECT_EQ(root_windows[1], modal_widget->GetNativeView()->GetRootWindow());
- EXPECT_EQ(root_windows[1], Shell::GetActiveRootWindow());
+ EXPECT_EQ(root_windows[1], Shell::GetTargetRootWindow());
aura::test::EventGenerator& event_generator(GetEventGenerator());
@@ -240,14 +240,14 @@ TEST_F(ExtendedDesktopTest, SystemModal) {
event_generator.MoveMouseToCenterOf(widget_on_1st->GetNativeView());
event_generator.ClickLeftButton();
EXPECT_TRUE(wm::IsActiveWindow(modal_widget->GetNativeView()));
- EXPECT_EQ(root_windows[1], Shell::GetActiveRootWindow());
+ EXPECT_EQ(root_windows[1], Shell::GetTargetRootWindow());
// Close system modal and so clicking a widget should work now.
modal_widget->Close();
event_generator.MoveMouseToCenterOf(widget_on_1st->GetNativeView());
event_generator.ClickLeftButton();
EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView()));
- EXPECT_EQ(root_windows[0], Shell::GetActiveRootWindow());
+ EXPECT_EQ(root_windows[0], Shell::GetTargetRootWindow());
}
TEST_F(ExtendedDesktopTest, TestCursor) {
diff --git a/ash/keyboard_overlay/keyboard_overlay_view.cc b/ash/keyboard_overlay/keyboard_overlay_view.cc
index 2144caa4e8..2847653ca5 100644
--- a/ash/keyboard_overlay/keyboard_overlay_view.cc
+++ b/ash/keyboard_overlay/keyboard_overlay_view.cc
@@ -9,8 +9,8 @@
#include "base/strings/utf_string_conversions.h"
#include "content/public/browser/browser_context.h"
#include "grit/ash_strings.h"
-#include "ui/base/events/event.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/events/event.h"
#include "ui/gfx/screen.h"
#include "ui/views/widget/widget.h"
#include "ui/web_dialogs/web_dialog_delegate.h"
diff --git a/ash/launcher/launcher.cc b/ash/launcher/launcher.cc
index 49ac6e7d6d..1dfc55e3a8 100644
--- a/ash/launcher/launcher.cc
+++ b/ash/launcher/launcher.cc
@@ -177,10 +177,6 @@ void Launcher::LaunchAppIndexAt(int item_index) {
}
}
-internal::LauncherView* Launcher::GetLauncherViewForTest() {
- return launcher_view_;
-}
-
void Launcher::SetLauncherViewBounds(gfx::Rect bounds) {
launcher_view_->SetBoundsRect(bounds);
}
diff --git a/ash/launcher/launcher.h b/ash/launcher/launcher.h
index c3acf44cf4..4260be96e5 100644
--- a/ash/launcher/launcher.h
+++ b/ash/launcher/launcher.h
@@ -37,6 +37,10 @@ class LauncherView;
class ShelfLayoutManager;
}
+namespace test {
+class LauncherTestAPI;
+}
+
class LauncherIconObserver;
class LauncherDelegate;
class LauncherModel;
@@ -97,10 +101,6 @@ class ASH_EXPORT Launcher {
// A negative index launches the last launcher item in the launcher.
void LaunchAppIndexAt(int item_index);
- // Only to be called for testing. Retrieves the LauncherView.
- // TODO(sky): remove this!
- internal::LauncherView* GetLauncherViewForTest();
-
ShelfWidget* shelf_widget() { return shelf_widget_; }
// Set the bounds of the launcher view.
@@ -111,6 +111,8 @@ class ASH_EXPORT Launcher {
app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList();
private:
+ friend class ash::test::LauncherTestAPI;
+
// LauncherView used to display icons.
internal::LauncherView* launcher_view_;
diff --git a/ash/launcher/launcher_button.cc b/ash/launcher/launcher_button.cc
index 2ce96eb5ad..38b166f218 100644
--- a/ash/launcher/launcher_button.cc
+++ b/ash/launcher/launcher_button.cc
@@ -12,12 +12,12 @@
#include "grit/ash_resources.h"
#include "skia/ext/image_operations.h"
#include "ui/base/accessibility/accessible_view_state.h"
-#include "ui/base/animation/animation_delegate.h"
-#include "ui/base/animation/throb_animation.h"
-#include "ui/base/events/event_constants.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/events/event_constants.h"
+#include "ui/gfx/animation/animation_delegate.h"
+#include "ui/gfx/animation/throb_animation.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia_operations.h"
@@ -46,7 +46,7 @@ bool ShouldHop(int state) {
// Simple AnimationDelegate that owns a single ThrobAnimation instance to
// keep all Draw Attention animations in sync.
-class LauncherButtonAnimation : public ui::AnimationDelegate {
+class LauncherButtonAnimation : public gfx::AnimationDelegate {
public:
class Observer {
public:
@@ -83,13 +83,13 @@ class LauncherButtonAnimation : public ui::AnimationDelegate {
LauncherButtonAnimation()
: animation_(this) {
animation_.SetThrobDuration(kAttentionThrobDurationMS);
- animation_.SetTweenType(ui::Tween::SMOOTH_IN_OUT);
+ animation_.SetTweenType(gfx::Tween::SMOOTH_IN_OUT);
}
virtual ~LauncherButtonAnimation() {
}
- ui::ThrobAnimation& GetThrobAnimation() {
+ gfx::ThrobAnimation& GetThrobAnimation() {
if (!animation_.is_animating()) {
animation_.Reset();
animation_.StartThrobbing(-1 /*throb indefinitely*/);
@@ -97,8 +97,8 @@ class LauncherButtonAnimation : public ui::AnimationDelegate {
return animation_;
}
- // ui::AnimationDelegate
- virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE {
+ // gfx::AnimationDelegate
+ virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE {
if (animation != &animation_)
return;
if (!animation_.is_animating())
@@ -106,7 +106,7 @@ class LauncherButtonAnimation : public ui::AnimationDelegate {
FOR_EACH_OBSERVER(Observer, observers_, AnimationProgressed());
}
- ui::ThrobAnimation animation_;
+ gfx::ThrobAnimation animation_;
ObserverList<Observer> observers_;
DISALLOW_COPY_AND_ASSIGN(LauncherButtonAnimation);
@@ -319,7 +319,7 @@ void LauncherButton::ClearState(State state) {
(!ShouldHop(state) || ShouldHop(state_))) {
ui::ScopedLayerAnimationSettings scoped_setter(
icon_view_->layer()->GetAnimator());
- scoped_setter.SetTweenType(ui::Tween::LINEAR);
+ scoped_setter.SetTweenType(gfx::Tween::LINEAR);
scoped_setter.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kHopDownMS));
}
diff --git a/ash/launcher/launcher_tooltip_manager.cc b/ash/launcher/launcher_tooltip_manager.cc
index 901330a07f..5e991674a1 100644
--- a/ash/launcher/launcher_tooltip_manager.cc
+++ b/ash/launcher/launcher_tooltip_manager.cc
@@ -15,8 +15,8 @@
#include "base/timer/timer.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_constants.h"
+#include "ui/events/event.h"
+#include "ui/events/event_constants.h"
#include "ui/gfx/insets.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/bubble/bubble_frame_view.h"
diff --git a/ash/launcher/launcher_tooltip_manager.h b/ash/launcher/launcher_tooltip_manager.h
index 27d3554f20..4b5bfc62c0 100644
--- a/ash/launcher/launcher_tooltip_manager.h
+++ b/ash/launcher/launcher_tooltip_manager.h
@@ -11,7 +11,7 @@
#include "base/basictypes.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_handler.h"
#include "ui/gfx/rect.h"
#include "ui/views/bubble/bubble_border.h"
#include "ui/views/bubble/bubble_delegate.h"
@@ -74,6 +74,9 @@ class ASH_EXPORT LauncherTooltipManager : public ui::EventHandler,
// Returns true if the tooltip is currently visible.
bool IsVisible();
+ // Returns the view to which the tooltip bubble is anchored. May be NULL.
+ views::View* GetCurrentAnchorView() { return anchor_; }
+
// Create an instant timer for test purposes.
void CreateZeroDelayTimerForTest();
diff --git a/ash/launcher/launcher_tooltip_manager_unittest.cc b/ash/launcher/launcher_tooltip_manager_unittest.cc
index d222e7a6bc..b0f2289bea 100644
--- a/ash/launcher/launcher_tooltip_manager_unittest.cc
+++ b/ash/launcher/launcher_tooltip_manager_unittest.cc
@@ -10,14 +10,15 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/test/ash_test_base.h"
+#include "ash/test/launcher_test_api.h"
#include "ash/wm/window_util.h"
#include "base/strings/string16.h"
#include "base/time/time.h"
#include "ui/aura/root_window.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_constants.h"
-#include "ui/base/events/event_handler.h"
-#include "ui/base/keycodes/keyboard_codes.h"
+#include "ui/events/event.h"
+#include "ui/events/event_constants.h"
+#include "ui/events/event_handler.h"
+#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/views/widget/widget.h"
namespace {
@@ -44,7 +45,7 @@ class LauncherTooltipManagerTest : public AshTestBase {
Shell::GetPrimaryRootWindowController();
tooltip_manager_.reset(new internal::LauncherTooltipManager(
controller->GetShelfLayoutManager(),
- controller->shelf()->launcher()->GetLauncherViewForTest()));
+ LauncherTestAPI(controller->shelf()->launcher()).launcher_view()));
}
virtual void TearDown() OVERRIDE {
diff --git a/ash/launcher/launcher_unittest.cc b/ash/launcher/launcher_unittest.cc
index 688a29ac28..c1ea47ba48 100644
--- a/ash/launcher/launcher_unittest.cc
+++ b/ash/launcher/launcher_unittest.cc
@@ -10,6 +10,7 @@
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
+#include "ash/test/launcher_test_api.h"
#include "ash/test/launcher_view_test_api.h"
#include "ash/wm/window_util.h"
#include "ui/aura/root_window.h"
@@ -29,90 +30,123 @@ using ash::internal::LauncherButton;
namespace ash {
+class LauncherTest : public ash::test::AshTestBase {
+ public:
+ LauncherTest() : launcher_(NULL),
+ launcher_view_(NULL),
+ launcher_model_(NULL) {
+ }
+
+ virtual ~LauncherTest() {}
+
+ virtual void SetUp() {
+ test::AshTestBase::SetUp();
+
+ launcher_ = Launcher::ForPrimaryDisplay();
+ ASSERT_TRUE(launcher_);
+
+ ash::test::LauncherTestAPI test(launcher_);
+ launcher_view_ = test.launcher_view();
+ launcher_model_ = launcher_view_->model();
+
+ test_.reset(new ash::test::LauncherViewTestAPI(launcher_view_));
+ }
+
+ virtual void TearDown() OVERRIDE {
+ test::AshTestBase::TearDown();
+ }
+
+ Launcher* launcher() {
+ return launcher_;
+ }
+
+ LauncherView* launcher_view() {
+ return launcher_view_;
+ }
+
+ LauncherModel* launcher_model() {
+ return launcher_model_;
+ }
+
+ ash::test::LauncherViewTestAPI* test_api() {
+ return test_.get();
+ }
+
+ private:
+ Launcher* launcher_;
+ LauncherView* launcher_view_;
+ LauncherModel* launcher_model_;
+ scoped_ptr<ash::test::LauncherViewTestAPI> test_;
+
+ DISALLOW_COPY_AND_ASSIGN(LauncherTest);
+};
+
// Confirms that LauncherItem reflects the appropriated state.
TEST_F(LauncherTest, StatusReflection) {
- Launcher* launcher = Launcher::ForPrimaryDisplay();
- ASSERT_TRUE(launcher);
- LauncherView* launcher_view = launcher->GetLauncherViewForTest();
- test::LauncherViewTestAPI test(launcher_view);
- LauncherModel* model = launcher_view->model();
-
- // Initially we have the app list and chrome icon.
- int button_count = test.GetButtonCount();
+ // Initially we have the app list.
+ int button_count = test_api()->GetButtonCount();
// Add running platform app.
LauncherItem item;
item.type = TYPE_PLATFORM_APP;
item.status = STATUS_RUNNING;
- int index = model->Add(item);
- ASSERT_EQ(++button_count, test.GetButtonCount());
- LauncherButton* button = test.GetButton(index);
+ int index = launcher_model()->Add(item);
+ ASSERT_EQ(++button_count, test_api()->GetButtonCount());
+ LauncherButton* button = test_api()->GetButton(index);
EXPECT_EQ(LauncherButton::STATE_RUNNING, button->state());
// Remove it.
- model->RemoveItemAt(index);
- ASSERT_EQ(--button_count, test.GetButtonCount());
+ launcher_model()->RemoveItemAt(index);
+ ASSERT_EQ(--button_count, test_api()->GetButtonCount());
}
// Confirm that using the menu will clear the hover attribute. To avoid another
// browser test we check this here.
TEST_F(LauncherTest, checkHoverAfterMenu) {
- Launcher* launcher = Launcher::ForPrimaryDisplay();
- ASSERT_TRUE(launcher);
- LauncherView* launcher_view = launcher->GetLauncherViewForTest();
- test::LauncherViewTestAPI test(launcher_view);
- LauncherModel* model = launcher_view->model();
-
- // Initially we have the app list and chrome icon.
- int button_count = test.GetButtonCount();
+ // Initially we have the app list.
+ int button_count = test_api()->GetButtonCount();
// Add running platform app.
LauncherItem item;
item.type = TYPE_PLATFORM_APP;
item.status = STATUS_RUNNING;
- int index = model->Add(item);
- ASSERT_EQ(++button_count, test.GetButtonCount());
- LauncherButton* button = test.GetButton(index);
+ int index = launcher_model()->Add(item);
+ ASSERT_EQ(++button_count, test_api()->GetButtonCount());
+ LauncherButton* button = test_api()->GetButton(index);
button->AddState(LauncherButton::STATE_HOVERED);
button->ShowContextMenu(gfx::Point(), ui::MENU_SOURCE_MOUSE);
EXPECT_FALSE(button->state() & LauncherButton::STATE_HOVERED);
// Remove it.
- model->RemoveItemAt(index);
+ launcher_model()->RemoveItemAt(index);
}
TEST_F(LauncherTest, ShowOverflowBubble) {
- Launcher* launcher = Launcher::ForPrimaryDisplay();
- ASSERT_TRUE(launcher);
-
- LauncherView* launcher_view = launcher->GetLauncherViewForTest();
- test::LauncherViewTestAPI test(launcher_view);
-
- LauncherModel* model = launcher_view->model();
- LauncherID first_item_id = model->next_id();
+ LauncherID first_item_id = launcher_model()->next_id();
// Add platform app button until overflow.
int items_added = 0;
- while (!test.IsOverflowButtonVisible()) {
+ while (!test_api()->IsOverflowButtonVisible()) {
LauncherItem item;
item.type = TYPE_PLATFORM_APP;
item.status = STATUS_RUNNING;
- model->Add(item);
+ launcher_model()->Add(item);
++items_added;
ASSERT_LT(items_added, 10000);
}
// Shows overflow bubble.
- test.ShowOverflowBubble();
- EXPECT_TRUE(launcher->IsShowingOverflowBubble());
+ test_api()->ShowOverflowBubble();
+ EXPECT_TRUE(launcher()->IsShowingOverflowBubble());
// Removes the first item in main launcher view.
- model->RemoveItemAt(model->ItemIndexByID(first_item_id));
+ launcher_model()->RemoveItemAt(
+ launcher_model()->ItemIndexByID(first_item_id));
// Waits for all transitions to finish and there should be no crash.
- test.RunMessageLoopUntilAnimationsDone();
- EXPECT_FALSE(launcher->IsShowingOverflowBubble());
+ test_api()->RunMessageLoopUntilAnimationsDone();
+ EXPECT_FALSE(launcher()->IsShowingOverflowBubble());
}
} // namespace ash
diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc
index 57bcf26abb..0ea596789a 100644
--- a/ash/launcher/launcher_view.cc
+++ b/ash/launcher/launcher_view.cc
@@ -52,7 +52,7 @@
#include "ui/views/view_model_utils.h"
#include "ui/views/widget/widget.h"
-using ui::Animation;
+using gfx::Animation;
using views::View;
namespace ash {
@@ -477,7 +477,7 @@ void LauncherView::OnShelfAlignmentChanged() {
if (i >= first_visible_index_ && i <= last_visible_index_)
view_model_->view_at(i)->Layout();
}
- tooltip_->UpdateArrow();
+ tooltip_->Close();
if (overflow_bubble_)
overflow_bubble_->Hide();
}
@@ -537,11 +537,8 @@ void LauncherView::UpdatePanelIconPosition(LauncherID id,
}
bool LauncherView::IsShowingMenu() const {
-#if !defined(OS_MACOSX)
return (launcher_menu_runner_.get() &&
launcher_menu_runner_->IsRunning());
-#endif
- return false;
}
bool LauncherView::IsShowingOverflowBubble() const {
@@ -1424,10 +1421,8 @@ void LauncherView::LauncherItemAdded(int model_index) {
}
void LauncherView::LauncherItemRemoved(int model_index, LauncherID id) {
-#if !defined(OS_MACOSX)
if (id == context_menu_id_)
launcher_menu_runner_.reset();
-#endif
{
base::AutoReset<bool> cancelling_drag(
&cancelling_drag_model_changed_, true);
@@ -1452,6 +1447,11 @@ void LauncherView::LauncherItemRemoved(int model_index, LauncherID id) {
view_model_->view_size() - 1);
UpdateOverflowRange(overflow_bubble_->launcher_view());
}
+
+ // Close the tooltip because it isn't needed any longer and its anchor view
+ // will be deleted soon.
+ if (tooltip_->GetCurrentAnchorView() == view)
+ tooltip_->Close();
}
void LauncherView::LauncherItemChanged(int model_index,
diff --git a/ash/launcher/launcher_view.h b/ash/launcher/launcher_view.h
index dcaf265f31..1028cb0511 100644
--- a/ash/launcher/launcher_view.h
+++ b/ash/launcher/launcher_view.h
@@ -343,9 +343,7 @@ class ASH_EXPORT LauncherView : public views::View,
scoped_ptr<views::FocusSearch> focus_search_;
-#if !defined(OS_MACOSX)
scoped_ptr<views::MenuRunner> launcher_menu_runner_;
-#endif
ObserverList<LauncherIconObserver> observers_;
diff --git a/ash/launcher/launcher_view_unittest.cc b/ash/launcher/launcher_view_unittest.cc
index a92f969c10..4fc7d7ae7e 100644
--- a/ash/launcher/launcher_view_unittest.cc
+++ b/ash/launcher/launcher_view_unittest.cc
@@ -20,6 +20,7 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/test/ash_test_base.h"
+#include "ash/test/launcher_test_api.h"
#include "ash/test/launcher_view_test_api.h"
#include "ash/test/shell_test_api.h"
#include "ash/test/test_launcher_delegate.h"
@@ -32,10 +33,10 @@
#include "ui/aura/test/aura_test_base.h"
#include "ui/aura/test/event_generator.h"
#include "ui/aura/window.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_constants.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/compositor/layer.h"
+#include "ui/events/event.h"
+#include "ui/events/event_constants.h"
#include "ui/views/view_model.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
@@ -86,7 +87,7 @@ class LauncherViewIconObserverTest : public ash::test::AshTestBase {
observer_.reset(new TestLauncherIconObserver(launcher));
launcher_view_test_.reset(new LauncherViewTestAPI(
- launcher->GetLauncherViewForTest()));
+ LauncherTestAPI(launcher).launcher_view()));
launcher_view_test_->SetAnimationDuration(1);
}
@@ -203,7 +204,7 @@ class LauncherViewTest : public AshTestBase {
test::ShellTestApi test_api(Shell::GetInstance());
model_ = test_api.launcher_model();
Launcher* launcher = Launcher::ForPrimaryDisplay();
- launcher_view_ = launcher->GetLauncherViewForTest();
+ launcher_view_ = test::LauncherTestAPI(launcher).launcher_view();
// The bounds should be big enough for 4 buttons + overflow chevron.
launcher_view_->SetBounds(0, 0, 500, 50);
@@ -1083,6 +1084,55 @@ TEST_F(LauncherViewTest, LauncherTooltipTest) {
EXPECT_EQ(platform_button, GetTooltipAnchorView());
}
+// Verify a fix for crash caused by a tooltip update for a deleted launcher
+// button, see crbug.com/288838.
+TEST_F(LauncherViewTest, RemovingItemClosesTooltip) {
+ internal::LauncherButtonHost* button_host = launcher_view_;
+ internal::LauncherTooltipManager* tooltip_manager =
+ launcher_view_->tooltip_manager();
+
+ // Add an item to the launcher.
+ LauncherID app_button_id = AddAppShortcut();
+ internal::LauncherButton* app_button = GetButtonByID(app_button_id);
+
+ // Spawn a tooltip on that item.
+ button_host->MouseEnteredButton(app_button);
+ ShowTooltip();
+ EXPECT_TRUE(tooltip_manager->IsVisible());
+
+ // Remove the app shortcut while the tooltip is open. The tooltip should be
+ // closed.
+ RemoveByID(app_button_id);
+ EXPECT_FALSE(tooltip_manager->IsVisible());
+
+ // Change the shelf layout. This should not crash.
+ ash::Shell::GetInstance()->SetShelfAlignment(
+ ash::SHELF_ALIGNMENT_LEFT,
+ ash::Shell::GetPrimaryRootWindow());
+}
+
+// Changing the shelf alignment closes any open tooltip.
+TEST_F(LauncherViewTest, ShelfAlignmentClosesTooltip) {
+ internal::LauncherButtonHost* button_host = launcher_view_;
+ internal::LauncherTooltipManager* tooltip_manager =
+ launcher_view_->tooltip_manager();
+
+ // Add an item to the launcher.
+ LauncherID app_button_id = AddAppShortcut();
+ internal::LauncherButton* app_button = GetButtonByID(app_button_id);
+
+ // Spawn a tooltip on the item.
+ button_host->MouseEnteredButton(app_button);
+ ShowTooltip();
+ EXPECT_TRUE(tooltip_manager->IsVisible());
+
+ // Changing shelf alignment hides the tooltip.
+ ash::Shell::GetInstance()->SetShelfAlignment(
+ ash::SHELF_ALIGNMENT_LEFT,
+ ash::Shell::GetPrimaryRootWindow());
+ EXPECT_FALSE(tooltip_manager->IsVisible());
+}
+
TEST_F(LauncherViewTest, ShouldHideTooltipTest) {
LauncherID app_button_id = AddAppShortcut();
LauncherID platform_button_id = AddPlatformApp();
diff --git a/ash/magnifier/magnification_controller.cc b/ash/magnifier/magnification_controller.cc
index c8becce3f0..c2e269d6c1 100644
--- a/ash/magnifier/magnification_controller.cc
+++ b/ash/magnifier/magnification_controller.cc
@@ -14,12 +14,12 @@
#include "ui/aura/root_window_transformer.h"
#include "ui/aura/window.h"
#include "ui/aura/window_property.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_handler.h"
#include "ui/compositor/dip_util.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animation_observer.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/events/event.h"
+#include "ui/events/event_handler.h"
#include "ui/gfx/point3_f.h"
#include "ui/gfx/point_conversions.h"
#include "ui/gfx/point_f.h"
@@ -44,7 +44,7 @@ const int kPanningMergin = 100;
void MoveCursorTo(aura::RootWindow* root_window,
const gfx::Point& root_location) {
gfx::Point3F host_location_3f(root_location);
- root_window->GetRootTransform().TransformPoint(host_location_3f);
+ root_window->GetRootTransform().TransformPoint(&host_location_3f);
root_window->MoveCursorToHostLocation(
gfx::ToCeiledPoint(host_location_3f.AsPointF()));
}
@@ -265,7 +265,7 @@ bool MagnificationControllerImpl::RedrawDIP(const gfx::PointF& position_in_dip,
settings.AddObserver(this);
settings.SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
- settings.SetTweenType(ui::Tween::EASE_OUT);
+ settings.SetTweenType(gfx::Tween::EASE_OUT);
settings.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(animate ? 100 : 0));
@@ -456,14 +456,14 @@ void MagnificationControllerImpl::OnWindowDestroying(
// destroyed before the root windows get destroyed.
DCHECK(root_window);
- aura::RootWindow* active_root_window = Shell::GetActiveRootWindow();
- CHECK(active_root_window);
+ aura::RootWindow* target_root_window = Shell::GetTargetRootWindow();
+ CHECK(target_root_window);
- // The destroyed root window must not be active.
- CHECK_NE(active_root_window, root_window);
+ // The destroyed root window must not be target.
+ CHECK_NE(target_root_window, root_window);
// Don't redraw the old root window as it's being destroyed.
- SwitchTargetRootWindow(active_root_window, false);
- point_of_interest_ = active_root_window->bounds().CenterPoint();
+ SwitchTargetRootWindow(target_root_window, false);
+ point_of_interest_ = target_root_window->bounds().CenterPoint();
}
}
diff --git a/ash/magnifier/partial_magnification_controller.h b/ash/magnifier/partial_magnification_controller.h
index 1b8c8fb77b..54c15f3733 100644
--- a/ash/magnifier/partial_magnification_controller.h
+++ b/ash/magnifier/partial_magnification_controller.h
@@ -6,7 +6,7 @@
#define ASH_MAGNIFIER_PARTIAL_MAGNIFICATION_CONTROLLER_H_
#include "ui/aura/window_observer.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_handler.h"
#include "ui/gfx/point.h"
#include "ui/views/widget/widget_observer.h"
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index 7e198151f0..7c7909aaad 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -244,8 +244,8 @@ RootWindowController* RootWindowController::ForWindow(
}
// static
-RootWindowController* RootWindowController::ForActiveRootWindow() {
- return internal::GetRootWindowController(Shell::GetActiveRootWindow());
+RootWindowController* RootWindowController::ForTargetRootWindow() {
+ return internal::GetRootWindowController(Shell::GetTargetRootWindow());
}
void RootWindowController::SetWallpaperController(
@@ -268,12 +268,12 @@ void RootWindowController::Shutdown() {
wallpaper_controller_.reset();
animating_wallpaper_controller_.reset();
- // Change the active root window before closing child windows. If any child
+ // Change the target root window before closing child windows. If any child
// being removed triggers a relayout of the shelf it will try to build a
- // window list adding windows from the active root window's containers which
+ // window list adding windows from the target root window's containers which
// may have already gone away.
- if (Shell::GetActiveRootWindow() == root_window_) {
- Shell::GetInstance()->set_active_root_window(
+ if (Shell::GetTargetRootWindow() == root_window_) {
+ Shell::GetInstance()->set_target_root_window(
Shell::GetPrimaryRootWindow() == root_window_.get() ?
NULL : Shell::GetPrimaryRootWindow());
}
@@ -693,6 +693,7 @@ void RootWindowController::CreateContainersInRootWindow(
kShellWindowId_DockedContainer,
"DockedContainer",
non_lock_screen_containers);
+ views::corewm::SetChildWindowVisibilityChangesAnimated(docked_container);
SetUsesScreenCoordinates(docked_container);
aura::Window* panel_container = CreateContainer(
diff --git a/ash/root_window_controller.h b/ash/root_window_controller.h
index 8bdbdb29b8..49ce6b89f8 100644
--- a/ash/root_window_controller.h
+++ b/ash/root_window_controller.h
@@ -87,8 +87,8 @@ class ASH_EXPORT RootWindowController : public ShellObserver {
// Returns a RootWindowController of the window's root window.
static RootWindowController* ForWindow(const aura::Window* window);
- // Returns the RootWindowController of the active root window.
- static internal::RootWindowController* ForActiveRootWindow();
+ // Returns the RootWindowController of the target root window.
+ static internal::RootWindowController* ForTargetRootWindow();
aura::RootWindow* root_window() { return root_window_.get(); }
@@ -102,6 +102,10 @@ class ASH_EXPORT RootWindowController : public ShellObserver {
return always_on_top_controller_.get();
}
+ keyboard::KeyboardController* keyboard_controller() {
+ return keyboard_controller_.get();
+ }
+
ScreenDimmer* screen_dimmer() { return screen_dimmer_.get(); }
// Access the shelf associated with this root window controller,
diff --git a/ash/rotator/screen_rotation.cc b/ash/rotator/screen_rotation.cc
index 248394a293..9352d81ea3 100644
--- a/ash/rotator/screen_rotation.cc
+++ b/ash/rotator/screen_rotation.cc
@@ -73,9 +73,9 @@ void ScreenRotation::InitTransform(ui::Layer* layer) {
}
// Convert points to world space.
- current_transform.TransformPoint(old_pivot);
- current_transform.TransformPoint(new_pivot);
- current_transform.TransformPoint(new_origin_);
+ current_transform.TransformPoint(&old_pivot);
+ current_transform.TransformPoint(&new_pivot);
+ current_transform.TransformPoint(&new_origin_);
scoped_ptr<ui::InterpolatedTransform> rotation(
new ui::InterpolatedTransformAboutPivot(
diff --git a/ash/session_state_delegate.h b/ash/session_state_delegate.h
index 0f2c569c51..9ca213cbaa 100644
--- a/ash/session_state_delegate.h
+++ b/ash/session_state_delegate.h
@@ -77,8 +77,9 @@ class ASH_EXPORT SessionStateDelegate {
// Returns a list of all logged in users.
virtual void GetLoggedInUsers(UserIdList* users) = 0;
- // Switches to another active user (if that user has already signed in).
- virtual void SwitchActiveUser(const std::string& user_id) = 0;
+ // Switches to another active user using the |user_email|
+ // (if that user has already signed in).
+ virtual void SwitchActiveUser(const std::string& user_email) = 0;
// Adds or removes sessions state observer.
virtual void AddSessionStateObserver(SessionStateObserver* observer) = 0;
diff --git a/ash/shelf/alternate_app_list_button.cc b/ash/shelf/alternate_app_list_button.cc
index 7bcb84bc6b..7c7298d4c7 100644
--- a/ash/shelf/alternate_app_list_button.cc
+++ b/ash/shelf/alternate_app_list_button.cc
@@ -25,9 +25,6 @@
namespace ash {
namespace internal {
-namespace {
-const int kImagePaddingFromShelf = 5;
-} // namespace
// static
const int AlternateAppListButton::kImageBoundsSize = 7;
@@ -110,15 +107,15 @@ void AlternateAppListButton::OnPaint(gfx::Canvas* canvas) {
background_bounds.set_size(background_image->size());
if (alignment == SHELF_ALIGNMENT_LEFT) {
background_bounds.set_x(contents_bounds.width() -
- kImagePaddingFromShelf - background_image->width());
+ ShelfLayoutManager::kShelfItemInset - background_image->width());
background_bounds.set_y(contents_bounds.y() +
(contents_bounds.height() - background_image->height()) / 2);
} else if(alignment == SHELF_ALIGNMENT_RIGHT) {
- background_bounds.set_x(kImagePaddingFromShelf);
+ background_bounds.set_x(ShelfLayoutManager::kShelfItemInset);
background_bounds.set_y(contents_bounds.y() +
(contents_bounds.height() - background_image->height()) / 2);
} else {
- background_bounds.set_y(kImagePaddingFromShelf);
+ background_bounds.set_y(ShelfLayoutManager::kShelfItemInset);
background_bounds.set_x(contents_bounds.x() +
(contents_bounds.width() - background_image->width()) / 2);
}
diff --git a/ash/shelf/background_animator.cc b/ash/shelf/background_animator.cc
index dedae6fa1d..35e5fba3a7 100644
--- a/ash/shelf/background_animator.cc
+++ b/ash/shelf/background_animator.cc
@@ -49,7 +49,7 @@ void BackgroundAnimator::SetPaintsBackground(bool value, ChangeType type) {
animation_.Hide();
}
-void BackgroundAnimator::AnimationProgressed(const ui::Animation* animation) {
+void BackgroundAnimator::AnimationProgressed(const gfx::Animation* animation) {
int alpha = animation->CurrentValueBetween(min_alpha_, max_alpha_);
if (alpha_ == alpha)
return;
diff --git a/ash/shelf/background_animator.h b/ash/shelf/background_animator.h
index dbe495a2bc..7436b30f1f 100644
--- a/ash/shelf/background_animator.h
+++ b/ash/shelf/background_animator.h
@@ -7,8 +7,8 @@
#include "ash/ash_export.h"
#include "base/basictypes.h"
-#include "ui/base/animation/animation_delegate.h"
-#include "ui/base/animation/slide_animation.h"
+#include "ui/gfx/animation/animation_delegate.h"
+#include "ui/gfx/animation/slide_animation.h"
namespace ash {
namespace internal {
@@ -23,7 +23,7 @@ class ASH_EXPORT BackgroundAnimatorDelegate {
};
// BackgroundAnimator is used by the shelf to animate the background (alpha).
-class ASH_EXPORT BackgroundAnimator : public ui::AnimationDelegate {
+class ASH_EXPORT BackgroundAnimator : public gfx::AnimationDelegate {
public:
// How the background can be changed.
enum ChangeType {
@@ -48,8 +48,8 @@ class ASH_EXPORT BackgroundAnimator : public ui::AnimationDelegate {
// Current alpha.
int alpha() const { return alpha_; }
- // ui::AnimationDelegate overrides:
- virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
+ // gfx::AnimationDelegate overrides:
+ virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
private:
BackgroundAnimatorDelegate* delegate_;
@@ -57,7 +57,7 @@ class ASH_EXPORT BackgroundAnimator : public ui::AnimationDelegate {
const int min_alpha_;
const int max_alpha_;
- ui::SlideAnimation animation_;
+ gfx::SlideAnimation animation_;
// Whether the background is painted.
bool paints_background_;
diff --git a/ash/shelf/overflow_bubble.cc b/ash/shelf/overflow_bubble.cc
index 9fb5ba83ec..84a3b8bdd3 100644
--- a/ash/shelf/overflow_bubble.cc
+++ b/ash/shelf/overflow_bubble.cc
@@ -13,8 +13,9 @@
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/system/tray/system_tray.h"
+#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/root_window.h"
-#include "ui/base/events/event.h"
+#include "ui/events/event.h"
#include "ui/gfx/insets.h"
#include "ui/gfx/screen.h"
#include "ui/views/bubble/bubble_delegate.h"
@@ -284,8 +285,12 @@ void OverflowBubble::Hide() {
}
void OverflowBubble::ProcessPressedEvent(ui::LocatedEvent* event) {
- if (!bubble_->GetBoundsInScreen().Contains(event->root_location()) &&
- !anchor_->GetBoundsInScreen().Contains(event->root_location())) {
+ aura::Window* target = static_cast<aura::Window*>(event->target());
+ gfx::Point event_location_in_screen = event->location();
+ aura::client::GetScreenPositionClient(target->GetRootWindow())->
+ ConvertPointToScreen(target, &event_location_in_screen);
+ if (!bubble_->GetBoundsInScreen().Contains(event_location_in_screen) &&
+ !anchor_->GetBoundsInScreen().Contains(event_location_in_screen)) {
views::View* anchor = anchor_;
Hide();
// Update overflow button (|anchor|) status when overflow bubble is hidden
diff --git a/ash/shelf/overflow_bubble.h b/ash/shelf/overflow_bubble.h
index 1d4dcb9ac0..2b1cf6dc77 100644
--- a/ash/shelf/overflow_bubble.h
+++ b/ash/shelf/overflow_bubble.h
@@ -7,7 +7,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_handler.h"
#include "ui/views/widget/widget_observer.h"
namespace ui {
diff --git a/ash/shelf/overflow_button.cc b/ash/shelf/overflow_button.cc
index 586b088472..4f8becc52f 100644
--- a/ash/shelf/overflow_button.cc
+++ b/ash/shelf/overflow_button.cc
@@ -11,9 +11,9 @@
#include "grit/ash_strings.h"
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkPath.h"
-#include "ui/base/animation/throb_animation.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/gfx/animation/throb_animation.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/gfx/skbitmap_operations.h"
@@ -34,10 +34,6 @@ const int kButtonHoverSize = 28;
const int kBackgroundOffset = (48 - kButtonHoverSize) / 2;
-// Padding from the inner edge of the shelf (towards center of display) to
-// the edge of the background image of the overflow button.
-const int kImagePaddingFromShelf = 5;
-
} // namesapce
OverflowButton::OverflowButton(views::ButtonListener* listener)
@@ -108,18 +104,19 @@ void OverflowButton::OnPaint(gfx::Canvas* canvas) {
rb.GetImageNamed(background_image_id).ToImageSkia();
if (alignment == SHELF_ALIGNMENT_LEFT) {
bounds = gfx::Rect(
- bounds.right() - background->width() - kImagePaddingFromShelf,
+ bounds.right() - background->width() -
+ ShelfLayoutManager::kShelfItemInset,
bounds.y() + (bounds.height() - background->height()) / 2,
background->width(), background->height());
} else if (alignment == SHELF_ALIGNMENT_RIGHT) {
bounds = gfx::Rect(
- bounds.x() + kImagePaddingFromShelf,
+ bounds.x() + ShelfLayoutManager::kShelfItemInset,
bounds.y() + (bounds.height() - background->height()) / 2,
background->width(), background->height());
} else {
bounds = gfx::Rect(
bounds.x() + (bounds.width() - background->width()) / 2,
- bounds.y() + kImagePaddingFromShelf,
+ bounds.y() + ShelfLayoutManager::kShelfItemInset,
background->width(), background->height());
}
canvas->DrawImageInt(*background, bounds.x(), bounds.y());
diff --git a/ash/shelf/shelf_bezel_event_filter.h b/ash/shelf/shelf_bezel_event_filter.h
index 5390c4ea15..33d1f5e35b 100644
--- a/ash/shelf/shelf_bezel_event_filter.h
+++ b/ash/shelf/shelf_bezel_event_filter.h
@@ -6,7 +6,7 @@
#define ASH_SHELF_SHELF_BEZEL_EVENT_FILTER_H_
#include "ash/wm/gestures/shelf_gesture_handler.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_handler.h"
#include "ui/gfx/rect.h"
namespace ash {
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index 84fef37d56..5d1df483a6 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -38,13 +38,13 @@
#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/cursor_client.h"
#include "ui/aura/root_window.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_handler.h"
#include "ui/base/ui_base_switches.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animation_observer.h"
#include "ui/compositor/layer_animator.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/events/event.h"
+#include "ui/events/event_handler.h"
#include "ui/gfx/screen.h"
#include "ui/views/widget/widget.h"
@@ -73,9 +73,6 @@ const int kNotificationBubbleGapHeight = 6;
// the auto hidden shelf when the shelf is on the boundary between displays.
const int kMaxAutoHideShowShelfRegionSize = 10;
-// Const inset from the edget of the shelf to the edget of the status area.
-const int kStatusAreaInset = 3;
-
ui::Layer* GetLayer(views::Widget* widget) {
return widget->GetNativeView()->layer();
}
@@ -100,6 +97,9 @@ const int ShelfLayoutManager::kAutoHideSize = 3;
// static
const int ShelfLayoutManager::kShelfSize = 47;
+// static
+const int ShelfLayoutManager::kShelfItemInset = 3;
+
int ShelfLayoutManager::GetPreferredShelfSize() {
return ash::switches::UseAlternateShelfLayout() ?
ShelfLayoutManager::kShelfSize : kLauncherPreferredSize;
@@ -663,12 +663,12 @@ void ShelfLayoutManager::UpdateBoundsAndOpacity(
if (animate) {
launcher_animation_setter.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS));
- launcher_animation_setter.SetTweenType(ui::Tween::EASE_OUT);
+ launcher_animation_setter.SetTweenType(gfx::Tween::EASE_OUT);
launcher_animation_setter.SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
status_animation_setter.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS));
- status_animation_setter.SetTweenType(ui::Tween::EASE_OUT);
+ status_animation_setter.SetTweenType(gfx::Tween::EASE_OUT);
status_animation_setter.SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
} else {
@@ -769,8 +769,13 @@ void ShelfLayoutManager::CalculateTargetBounds(
int status_inset = std::max(0, GetPreferredShelfSize() -
PrimaryAxisValue(status_size.height(), status_size.width()));
- if (ash::switches::UseAlternateShelfLayout())
- status_inset = kStatusAreaInset;
+ if (ash::switches::UseAlternateShelfLayout()) {
+ status_inset = 0;
+ if (IsHorizontalAlignment())
+ status_size.set_height(kShelfSize);
+ else
+ status_size.set_width(kShelfSize);
+ }
target_bounds->status_bounds_in_shelf = SelectValueForShelfAlignment(
gfx::Rect(base::i18n::IsRTL() ? 0 : shelf_width - status_size.width(),
@@ -882,7 +887,7 @@ void ShelfLayoutManager::UpdateTargetBoundsForGesture(
}
if (ash::switches::UseAlternateShelfLayout()) {
- target_bounds->status_bounds_in_shelf.set_y(kStatusAreaInset);
+ target_bounds->status_bounds_in_shelf.set_y(0);
} else {
// The statusbar should be in the center of the shelf.
gfx::Rect status_y = target_bounds->shelf_bounds_in_root;
@@ -907,12 +912,12 @@ void ShelfLayoutManager::UpdateTargetBoundsForGesture(
}
if (ash::switches::UseAlternateShelfLayout()) {
- if (right_aligned) {
- target_bounds->status_bounds_in_shelf.set_x(kStatusAreaInset);
- } else {
+ if (right_aligned)
+ target_bounds->status_bounds_in_shelf.set_x(0);
+ else
target_bounds->status_bounds_in_shelf.set_x(
- available_bounds.right() - shelf_width + kStatusAreaInset);
- }
+ target_bounds->shelf_bounds_in_root.width() -
+ kShelfSize);
} else {
// The statusbar should be in the center of the shelf.
gfx::Rect status_x = target_bounds->shelf_bounds_in_root;
diff --git a/ash/shelf/shelf_layout_manager.h b/ash/shelf/shelf_layout_manager.h
index 4e580ec092..486596402d 100644
--- a/ash/shelf/shelf_layout_manager.h
+++ b/ash/shelf/shelf_layout_manager.h
@@ -81,6 +81,10 @@ class ASH_EXPORT ShelfLayoutManager :
// settings see ash::switches::UseAlternateShelfLayout).
static const int kShelfSize;
+ // Inset between the inner edge of the shelf (towards centre of screen), and
+ // the launcher items, notifications, status area etc.
+ static const int kShelfItemInset;
+
// Returns the preferred size for the shelf (either kLauncherPreferredSize or
// kShelfSize).
static int GetPreferredShelfSize();
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc
index 55d88139b1..5192902933 100644
--- a/ash/shelf/shelf_layout_manager_unittest.cc
+++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -23,6 +23,7 @@
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_item.h"
#include "ash/test/ash_test_base.h"
+#include "ash/test/launcher_test_api.h"
#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
#include "base/command_line.h"
@@ -31,10 +32,10 @@
#include "ui/aura/root_window.h"
#include "ui/aura/test/event_generator.h"
#include "ui/aura/window.h"
-#include "ui/base/animation/animation_container_element.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animator.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
+#include "ui/gfx/animation/animation_container_element.h"
#include "ui/gfx/display.h"
#include "ui/gfx/screen.h"
#include "ui/views/controls/label.h"
@@ -52,8 +53,8 @@ namespace internal {
namespace {
void StepWidgetLayerAnimatorToEnd(views::Widget* widget) {
- ui::AnimationContainerElement* element =
- static_cast<ui::AnimationContainerElement*>(
+ gfx::AnimationContainerElement* element =
+ static_cast<gfx::AnimationContainerElement*>(
widget->GetNativeView()->layer()->GetAnimator());
element->Step(base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1));
}
@@ -652,8 +653,8 @@ void ShelfLayoutManagerTest::RunGestureDragTests(gfx::Vector2d delta) {
EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
}
-// Fails on Mac only. Need to be implemented. http://crbug.com/111279.
-#if defined(OS_MACOSX) || defined(OS_WIN)
+// Need to be implemented. http://crbug.com/111279.
+#if defined(OS_WIN)
#define MAYBE_SetVisible DISABLED_SetVisible
#else
#define MAYBE_SetVisible SetVisible
@@ -784,7 +785,7 @@ TEST_F(ShelfLayoutManagerTest, LauncherUpdatedWhenStatusAreaChangesSize) {
shelf_widget->status_area_widget()->SetBounds(
gfx::Rect(0, 0, 200, 200));
EXPECT_EQ(200, shelf_widget->GetContentsView()->width() -
- launcher->GetLauncherViewForTest()->width());
+ test::LauncherTestAPI(launcher).launcher_view()->width());
}
@@ -1835,5 +1836,45 @@ TEST_F(ShelfLayoutManagerTest, ShelfBackgroundColorAutoHide) {
EXPECT_EQ(SHELF_BACKGROUND_OVERLAP, GetShelfWidget()->GetBackgroundType());
}
+#if defined(OS_CHROMEOS)
+#define MAYBE_StatusAreaHitBoxCoversEdge StatusAreaHitBoxCoversEdge
+#else
+#define MAYBE_StatusAreaHitBoxCoversEdge DISABLED_StatusAreaHitBoxCoversEdge
+#endif
+
+// Verify the hit bounds of the status area extend to the edge of the shelf.
+TEST_F(ShelfLayoutManagerTest, MAYBE_StatusAreaHitBoxCoversEdge) {
+ UpdateDisplay("400x400");
+ ShelfLayoutManager* shelf = GetShelfLayoutManager();
+ StatusAreaWidget* status_area_widget =
+ Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget();
+ aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
+ generator.MoveMouseTo(399,399);
+
+ // Test bottom right pixel for bottom alignment.
+ EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
+ generator.ClickLeftButton();
+ EXPECT_TRUE(status_area_widget->IsMessageBubbleShown());
+ generator.ClickLeftButton();
+ EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
+
+ // Test bottom right pixel for right alignment.
+ shelf->SetAlignment(SHELF_ALIGNMENT_RIGHT);
+ EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
+ generator.ClickLeftButton();
+ EXPECT_TRUE(status_area_widget->IsMessageBubbleShown());
+ generator.ClickLeftButton();
+ EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
+
+ // Test bottom left pixel for left alignment.
+ generator.MoveMouseTo(0, 399);
+ shelf->SetAlignment(SHELF_ALIGNMENT_LEFT);
+ EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
+ generator.ClickLeftButton();
+ EXPECT_TRUE(status_area_widget->IsMessageBubbleShown());
+ generator.ClickLeftButton();
+ EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
+}
+
} // namespace internal
} // namespace ash
diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc
index 4c187b86a9..b98d7a9ef6 100644
--- a/ash/shelf/shelf_widget.cc
+++ b/ash/shelf/shelf_widget.cc
@@ -16,7 +16,7 @@
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
-#include "ash/system/tray/test_system_tray_delegate.h"
+#include "ash/system/tray/system_tray_delegate.h"
#include "ash/wm/property_util.h"
#include "ash/wm/status_area_layout_manager.h"
#include "ash/wm/window_properties.h"
@@ -26,10 +26,10 @@
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
-#include "ui/base/events/event_constants.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/events/event_constants.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia_operations.h"
diff --git a/ash/shelf/shelf_widget_unittest.cc b/ash/shelf/shelf_widget_unittest.cc
index 2de02bc3c5..b12549fb64 100644
--- a/ash/shelf/shelf_widget_unittest.cc
+++ b/ash/shelf/shelf_widget_unittest.cc
@@ -12,6 +12,7 @@
#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
+#include "ash/test/launcher_test_api.h"
#include "ash/test/launcher_view_test_api.h"
#include "ash/wm/window_util.h"
#include "ui/aura/root_window.h"
@@ -140,7 +141,7 @@ TEST_F(ShelfWidgetTest, LauncherInitiallySized) {
// Test only makes sense if the status is > 0, which it better be.
EXPECT_GT(status_width, 0);
EXPECT_EQ(status_width, shelf_widget->GetContentsView()->width() -
- launcher->GetLauncherViewForTest()->width());
+ test::LauncherTestAPI(launcher).launcher_view()->width());
}
// Verifies when the shell is deleted with a full screen window we don't crash.
@@ -186,7 +187,7 @@ TEST_F(ShelfWidgetTest, LauncherInitiallySizedAfterLogin) {
EXPECT_GT(status_width, 0);
EXPECT_EQ(status_width,
shelf->GetContentsView()->width() -
- launcher->GetLauncherViewForTest()->width());
+ test::LauncherTestAPI(launcher).launcher_view()->width());
}
#endif
diff --git a/ash/shell.cc b/ash/shell.cc
index badb7e4a83..411fcc9090 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -7,7 +7,10 @@
#include <algorithm>
#include <string>
+#include "ash/accelerators/accelerator_controller.h"
+#include "ash/accelerators/accelerator_filter.h"
#include "ash/accelerators/focus_manager_factory.h"
+#include "ash/accelerators/nested_dispatcher_controller.h"
#include "ash/ash_switches.h"
#include "ash/caps_lock_delegate.h"
#include "ash/desktop_background/desktop_background_controller.h"
@@ -103,12 +106,6 @@
#include "ui/views/widget/native_widget_aura.h"
#include "ui/views/widget/widget.h"
-#if !defined(OS_MACOSX)
-#include "ash/accelerators/accelerator_controller.h"
-#include "ash/accelerators/accelerator_filter.h"
-#include "ash/accelerators/nested_dispatcher_controller.h"
-#endif
-
#if defined(OS_CHROMEOS)
#if defined(USE_X11)
#include "ash/ash_constants.h"
@@ -263,9 +260,7 @@ Shell::~Shell() {
RemovePreTargetHandler(mouse_cursor_filter_.get());
RemovePreTargetHandler(system_gesture_filter_.get());
RemovePreTargetHandler(event_transformation_handler_.get());
-#if !defined(OS_MACOSX)
RemovePreTargetHandler(accelerator_filter_.get());
-#endif
// TooltipController is deleted with the Shell so removing its references.
RemovePreTargetHandler(tooltip_controller_.get());
@@ -385,7 +380,7 @@ aura::RootWindow* Shell::GetPrimaryRootWindow() {
}
// static
-aura::RootWindow* Shell::GetActiveRootWindow() {
+aura::RootWindow* Shell::GetTargetRootWindow() {
Shell* shell = GetInstance();
if (shell->scoped_target_root_window_)
return shell->scoped_target_root_window_;
@@ -498,10 +493,8 @@ void Shell::Init() {
cursor_manager_.SetDisplay(DisplayController::GetPrimaryDisplay());
-#if !defined(OS_MACOSX)
nested_dispatcher_controller_.reset(new NestedDispatcherController);
accelerator_controller_.reset(new AcceleratorController);
-#endif
// The order in which event filters are added is significant.
event_rewriter_filter_.reset(new internal::EventRewriterEventFilter);
@@ -520,10 +513,8 @@ void Shell::Init() {
root_window->GetAcceleratedWidget()));
AddPreTargetHandler(input_method_filter_.get());
-#if !defined(OS_MACOSX)
accelerator_filter_.reset(new internal::AcceleratorFilter);
AddPreTargetHandler(accelerator_filter_.get());
-#endif
event_transformation_handler_.reset(new internal::EventTransformationHandler);
AddPreTargetHandler(event_transformation_handler_.get());
@@ -597,8 +588,7 @@ void Shell::Init() {
// Initialize system_tray_delegate_ before initializing StatusAreaWidget.
system_tray_delegate_.reset(delegate()->CreateSystemTrayDelegate());
- if (!system_tray_delegate_)
- system_tray_delegate_.reset(SystemTrayDelegate::CreateDummyDelegate());
+ DCHECK(system_tray_delegate_.get());
internal::RootWindowController* root_window_controller =
new internal::RootWindowController(root_window);
@@ -656,9 +646,9 @@ void Shell::ShowContextMenu(const gfx::Point& location_in_screen,
}
void Shell::ToggleAppList(aura::Window* window) {
- // If the context window is not given, show it on the active root window.
+ // If the context window is not given, show it on the target root window.
if (!window)
- window = GetActiveRootWindow();
+ window = GetTargetRootWindow();
if (!app_list_controller_)
app_list_controller_.reset(new internal::AppListController);
app_list_controller_->SetVisible(!app_list_controller_->IsVisible(), window);
diff --git a/ash/shell.h b/ash/shell.h
index c4762ab73d..944581b1e3 100644
--- a/ash/shell.h
+++ b/ash/shell.h
@@ -18,8 +18,8 @@
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "ui/aura/client/activation_change_observer.h"
-#include "ui/base/events/event_target.h"
#include "ui/base/ui_base_types.h"
+#include "ui/events/event_target.h"
#include "ui/gfx/insets.h"
#include "ui/gfx/screen.h"
#include "ui/gfx/size.h"
@@ -184,8 +184,7 @@ class ASH_EXPORT Shell
// be overridden by using ScopedTargetRootWindow().
// If you want to get a RootWindow of the active window, just use
// |wm::GetActiveWindow()->GetRootWindow()|.
- // TODO(oshima): Rename to GetTargetRootWindow() crbug.com/266378.
- static aura::RootWindow* GetActiveRootWindow();
+ static aura::RootWindow* GetTargetRootWindow();
// Returns the global Screen object that's always active in ash.
static gfx::Screen* GetScreen();
@@ -209,7 +208,7 @@ class ASH_EXPORT Shell
// application windows to be maximized only.
static bool IsForcedMaximizeMode();
- void set_active_root_window(aura::RootWindow* target_root_window) {
+ void set_target_root_window(aura::RootWindow* target_root_window) {
target_root_window_ = target_root_window;
}
@@ -276,11 +275,9 @@ class ASH_EXPORT Shell
void AddShellObserver(ShellObserver* observer);
void RemoveShellObserver(ShellObserver* observer);
-#if !defined(OS_MACOSX)
AcceleratorController* accelerator_controller() {
return accelerator_controller_.get();
}
-#endif // !defined(OS_MACOSX)
internal::DisplayManager* display_manager() {
return display_manager_.get();
@@ -533,12 +530,8 @@ class ASH_EXPORT Shell
std::vector<WindowAndBoundsPair> to_restore_;
-#if !defined(OS_MACOSX)
scoped_ptr<NestedDispatcherController> nested_dispatcher_controller_;
-
scoped_ptr<AcceleratorController> accelerator_controller_;
-#endif // !defined(OS_MACOSX)
-
scoped_ptr<ShellDelegate> delegate_;
scoped_ptr<SystemTrayDelegate> system_tray_delegate_;
scoped_ptr<SystemTrayNotifier> system_tray_notifier_;
@@ -595,10 +588,8 @@ class ASH_EXPORT Shell
// An event filter which handles system level gestures
scoped_ptr<internal::SystemGestureEventFilter> system_gesture_filter_;
-#if !defined(OS_MACOSX)
// An event filter that pre-handles global accelerators.
scoped_ptr<internal::AcceleratorFilter> accelerator_filter_;
-#endif
// An event filter that pre-handles all key events to send them to an IME.
scoped_ptr<views::corewm::InputMethodEventFilter> input_method_filter_;
diff --git a/ash/shell/app_list.cc b/ash/shell/app_list.cc
index 14974588cf..d1a244e8a0 100644
--- a/ash/shell/app_list.cc
+++ b/ash/shell/app_list.cc
@@ -120,11 +120,9 @@ class WindowTypeLauncherItem : public app_list::AppListItemModel {
break;
}
case EXAMPLES_WINDOW: {
-#if !defined(OS_MACOSX)
views::examples::ShowExamplesWindowWithContent(
views::examples::DO_NOTHING_ON_CLOSE,
ash::Shell::GetInstance()->browser_context());
-#endif
break;
}
default:
diff --git a/ash/shell/cocoa/app-Info.plist b/ash/shell/cocoa/app-Info.plist
deleted file mode 100644
index 9f04fc7146..0000000000
--- a/ash/shell/cocoa/app-Info.plist
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>en</string>
- <key>CFBundleExecutable</key>
- <string>${EXECUTABLE_NAME}</string>
- <key>CFBundleIconFile</key>
- <string>app.icns</string>
- <key>CFBundleIdentifier</key>
- <string>org.chromium.AuraShell</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleName</key>
- <string>${PRODUCT_NAME}</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleShortVersionString</key>
- <string>1.0</string>
- <key>CFBundleSignature</key>
- <string>Ash8</string>
- <key>CFBundleVersion</key>
- <string>1</string>
- <key>LSMinimumSystemVersion</key>
- <string>${MACOSX_DEPLOYMENT_TARGET}.0</string>
- <key>NSHumanReadableCopyright</key>
- <string>Copyright © 2012 Google Inc. All rights reserved.</string>
- <key>NSMainNibFile</key>
- <string>MainMenu</string>
- <key>NSPrincipalClass</key>
- <string>NSApplication</string>
-</dict>
-</plist>
diff --git a/ash/shell/cocoa/app.icns b/ash/shell/cocoa/app.icns
deleted file mode 100644
index 055e46b934..0000000000
--- a/ash/shell/cocoa/app.icns
+++ /dev/null
Binary files differ
diff --git a/ash/shell/cocoa/nibs/MainMenu.xib b/ash/shell/cocoa/nibs/MainMenu.xib
deleted file mode 100644
index 9190616eb0..0000000000
--- a/ash/shell/cocoa/nibs/MainMenu.xib
+++ /dev/null
@@ -1,2163 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
- <data>
- <int key="IBDocument.SystemTarget">1070</int>
- <string key="IBDocument.SystemVersion">11C74</string>
- <string key="IBDocument.InterfaceBuilderVersion">1900</string>
- <string key="IBDocument.AppKitVersion">1138.23</string>
- <string key="IBDocument.HIToolboxVersion">567.00</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">1900</string>
- </object>
- <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSMenu</string>
- <string>NSMenuItem</string>
- <string>NSCustomObject</string>
- </object>
- <object class="NSArray" key="IBDocument.PluginDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.Metadata">
- <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
- <integer value="1" key="NS.object.0"/>
- </object>
- <object class="NSMutableArray" key="IBDocument.RootObjects" id="1048">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomObject" id="1021">
- <string key="NSClassName">NSApplication</string>
- </object>
- <object class="NSCustomObject" id="1014">
- <string key="NSClassName">FirstResponder</string>
- </object>
- <object class="NSCustomObject" id="1050">
- <string key="NSClassName">NSApplication</string>
- </object>
- <object class="NSMenu" id="649796088">
- <string key="NSTitle">AMainMenu</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="694149608">
- <reference key="NSMenu" ref="649796088"/>
- <string key="NSTitle">Aura Shell</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <object class="NSCustomResource" key="NSOnImage" id="35465992">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSMenuCheckmark</string>
- </object>
- <object class="NSCustomResource" key="NSMixedImage" id="502551668">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSMenuMixedState</string>
- </object>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="110575045">
- <string key="NSTitle">Aura Shell</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="238522557">
- <reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">About Aura Shell</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="304266470">
- <reference key="NSMenu" ref="110575045"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="609285721">
- <reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">Preferences…</string>
- <string key="NSKeyEquiv">,</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="481834944">
- <reference key="NSMenu" ref="110575045"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="1046388886">
- <reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">Services</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="752062318">
- <string key="NSTitle">Services</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <string key="NSName">_NSServicesMenu</string>
- </object>
- </object>
- <object class="NSMenuItem" id="646227648">
- <reference key="NSMenu" ref="110575045"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="755159360">
- <reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">Hide Aura Shell</string>
- <string key="NSKeyEquiv">h</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="342932134">
- <reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">Hide Others</string>
- <string key="NSKeyEquiv">h</string>
- <int key="NSKeyEquivModMask">1572864</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="908899353">
- <reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">Show All</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="1056857174">
- <reference key="NSMenu" ref="110575045"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="632727374">
- <reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">Quit Aura Shell</string>
- <string key="NSKeyEquiv">q</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- </object>
- <string key="NSName">_NSAppleMenu</string>
- </object>
- </object>
- <object class="NSMenuItem" id="379814623">
- <reference key="NSMenu" ref="649796088"/>
- <string key="NSTitle">File</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="720053764">
- <string key="NSTitle">File</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="705341025">
- <reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">New</string>
- <string key="NSKeyEquiv">n</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="722745758">
- <reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">Open…</string>
- <string key="NSKeyEquiv">o</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="1025936716">
- <reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">Open Recent</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="1065607017">
- <string key="NSTitle">Open Recent</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="759406840">
- <reference key="NSMenu" ref="1065607017"/>
- <string key="NSTitle">Clear Menu</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- </object>
- <string key="NSName">_NSRecentDocumentsMenu</string>
- </object>
- </object>
- <object class="NSMenuItem" id="425164168">
- <reference key="NSMenu" ref="720053764"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="776162233">
- <reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">Close</string>
- <string key="NSKeyEquiv">w</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="1023925487">
- <reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">Save…</string>
- <string key="NSKeyEquiv">s</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="579971712">
- <reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">Revert to Saved</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="1010469920">
- <reference key="NSMenu" ref="720053764"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="294629803">
- <reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">Page Setup...</string>
- <string key="NSKeyEquiv">P</string>
- <int key="NSKeyEquivModMask">1179648</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <string key="NSToolTip"/>
- </object>
- <object class="NSMenuItem" id="49223823">
- <reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">Print…</string>
- <string key="NSKeyEquiv">p</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- </object>
- </object>
- </object>
- <object class="NSMenuItem" id="952259628">
- <reference key="NSMenu" ref="649796088"/>
- <string key="NSTitle">Edit</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="789758025">
- <string key="NSTitle">Edit</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="1058277027">
- <reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Undo</string>
- <string key="NSKeyEquiv">z</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="790794224">
- <reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Redo</string>
- <string key="NSKeyEquiv">Z</string>
- <int key="NSKeyEquivModMask">1179648</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="1040322652">
- <reference key="NSMenu" ref="789758025"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="296257095">
- <reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Cut</string>
- <string key="NSKeyEquiv">x</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="860595796">
- <reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Copy</string>
- <string key="NSKeyEquiv">c</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="29853731">
- <reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Paste</string>
- <string key="NSKeyEquiv">v</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="82994268">
- <reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Paste and Match Style</string>
- <string key="NSKeyEquiv">V</string>
- <int key="NSKeyEquivModMask">1572864</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="437104165">
- <reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Delete</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="583158037">
- <reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Select All</string>
- <string key="NSKeyEquiv">a</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="212016141">
- <reference key="NSMenu" ref="789758025"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="892235320">
- <reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Find</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="963351320">
- <string key="NSTitle">Find</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="447796847">
- <reference key="NSMenu" ref="963351320"/>
- <string key="NSTitle">Find…</string>
- <string key="NSKeyEquiv">f</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <int key="NSTag">1</int>
- </object>
- <object class="NSMenuItem" id="738670835">
- <reference key="NSMenu" ref="963351320"/>
- <string key="NSTitle">Find and Replace…</string>
- <string key="NSKeyEquiv">f</string>
- <int key="NSKeyEquivModMask">1572864</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <int key="NSTag">12</int>
- </object>
- <object class="NSMenuItem" id="326711663">
- <reference key="NSMenu" ref="963351320"/>
- <string key="NSTitle">Find Next</string>
- <string key="NSKeyEquiv">g</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <int key="NSTag">2</int>
- </object>
- <object class="NSMenuItem" id="270902937">
- <reference key="NSMenu" ref="963351320"/>
- <string key="NSTitle">Find Previous</string>
- <string key="NSKeyEquiv">G</string>
- <int key="NSKeyEquivModMask">1179648</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <int key="NSTag">3</int>
- </object>
- <object class="NSMenuItem" id="159080638">
- <reference key="NSMenu" ref="963351320"/>
- <string key="NSTitle">Use Selection for Find</string>
- <string key="NSKeyEquiv">e</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <int key="NSTag">7</int>
- </object>
- <object class="NSMenuItem" id="88285865">
- <reference key="NSMenu" ref="963351320"/>
- <string key="NSTitle">Jump to Selection</string>
- <string key="NSKeyEquiv">j</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- </object>
- </object>
- </object>
- <object class="NSMenuItem" id="972420730">
- <reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Spelling and Grammar</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="769623530">
- <string key="NSTitle">Spelling and Grammar</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="679648819">
- <reference key="NSMenu" ref="769623530"/>
- <string key="NSTitle">Show Spelling and Grammar</string>
- <string key="NSKeyEquiv">:</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="96193923">
- <reference key="NSMenu" ref="769623530"/>
- <string key="NSTitle">Check Document Now</string>
- <string key="NSKeyEquiv">;</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="859480356">
- <reference key="NSMenu" ref="769623530"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="948374510">
- <reference key="NSMenu" ref="769623530"/>
- <string key="NSTitle">Check Spelling While Typing</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="967646866">
- <reference key="NSMenu" ref="769623530"/>
- <string key="NSTitle">Check Grammar With Spelling</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="795346622">
- <reference key="NSMenu" ref="769623530"/>
- <string key="NSTitle">Correct Spelling Automatically</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- </object>
- </object>
- </object>
- <object class="NSMenuItem" id="507821607">
- <reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Substitutions</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="698887838">
- <string key="NSTitle">Substitutions</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="65139061">
- <reference key="NSMenu" ref="698887838"/>
- <string key="NSTitle">Show Substitutions</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="19036812">
- <reference key="NSMenu" ref="698887838"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="605118523">
- <reference key="NSMenu" ref="698887838"/>
- <string key="NSTitle">Smart Copy/Paste</string>
- <string key="NSKeyEquiv">f</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <int key="NSTag">1</int>
- </object>
- <object class="NSMenuItem" id="197661976">
- <reference key="NSMenu" ref="698887838"/>
- <string key="NSTitle">Smart Quotes</string>
- <string key="NSKeyEquiv">g</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <int key="NSTag">2</int>
- </object>
- <object class="NSMenuItem" id="672708820">
- <reference key="NSMenu" ref="698887838"/>
- <string key="NSTitle">Smart Dashes</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="708854459">
- <reference key="NSMenu" ref="698887838"/>
- <string key="NSTitle">Smart Links</string>
- <string key="NSKeyEquiv">G</string>
- <int key="NSKeyEquivModMask">1179648</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <int key="NSTag">3</int>
- </object>
- <object class="NSMenuItem" id="537092702">
- <reference key="NSMenu" ref="698887838"/>
- <string key="NSTitle">Text Replacement</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- </object>
- </object>
- </object>
- <object class="NSMenuItem" id="288088188">
- <reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Transformations</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="579392910">
- <string key="NSTitle">Transformations</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="1060694897">
- <reference key="NSMenu" ref="579392910"/>
- <string key="NSTitle">Make Upper Case</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="879586729">
- <reference key="NSMenu" ref="579392910"/>
- <string key="NSTitle">Make Lower Case</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="56570060">
- <reference key="NSMenu" ref="579392910"/>
- <string key="NSTitle">Capitalize</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- </object>
- </object>
- </object>
- <object class="NSMenuItem" id="676164635">
- <reference key="NSMenu" ref="789758025"/>
- <string key="NSTitle">Speech</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="785027613">
- <string key="NSTitle">Speech</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="731782645">
- <reference key="NSMenu" ref="785027613"/>
- <string key="NSTitle">Start Speaking</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="680220178">
- <reference key="NSMenu" ref="785027613"/>
- <string key="NSTitle">Stop Speaking</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- </object>
- </object>
- </object>
- </object>
- </object>
- </object>
- <object class="NSMenuItem" id="586577488">
- <reference key="NSMenu" ref="649796088"/>
- <string key="NSTitle">View</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="466310130">
- <string key="NSTitle">View</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="102151532">
- <reference key="NSMenu" ref="466310130"/>
- <string key="NSTitle">Show Toolbar</string>
- <string key="NSKeyEquiv">t</string>
- <int key="NSKeyEquivModMask">1572864</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="237841660">
- <reference key="NSMenu" ref="466310130"/>
- <string key="NSTitle">Customize Toolbar…</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- </object>
- </object>
- </object>
- <object class="NSMenuItem" id="713487014">
- <reference key="NSMenu" ref="649796088"/>
- <string key="NSTitle">Window</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="835318025">
- <string key="NSTitle">Window</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="1011231497">
- <reference key="NSMenu" ref="835318025"/>
- <string key="NSTitle">Minimize</string>
- <string key="NSKeyEquiv">m</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="575023229">
- <reference key="NSMenu" ref="835318025"/>
- <string key="NSTitle">Zoom</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="299356726">
- <reference key="NSMenu" ref="835318025"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- <object class="NSMenuItem" id="625202149">
- <reference key="NSMenu" ref="835318025"/>
- <string key="NSTitle">Bring All to Front</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- </object>
- <string key="NSName">_NSWindowsMenu</string>
- </object>
- </object>
- <object class="NSMenuItem" id="448692316">
- <reference key="NSMenu" ref="649796088"/>
- <string key="NSTitle">Help</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="992780483">
- <string key="NSTitle">Help</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="105068016">
- <reference key="NSMenu" ref="992780483"/>
- <string key="NSTitle">Aura Shell Help</string>
- <string key="NSKeyEquiv">?</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="35465992"/>
- <reference key="NSMixedImage" ref="502551668"/>
- </object>
- </object>
- <string key="NSName">_NSHelpMenu</string>
- </object>
- </object>
- </object>
- <string key="NSName">_NSMainMenu</string>
- </object>
- </object>
- <object class="IBObjectContainer" key="IBDocument.Objects">
- <object class="NSMutableArray" key="connectionRecords">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">performMiniaturize:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="1011231497"/>
- </object>
- <int key="connectionID">37</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">arrangeInFront:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="625202149"/>
- </object>
- <int key="connectionID">39</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">print:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="49223823"/>
- </object>
- <int key="connectionID">86</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">runPageLayout:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="294629803"/>
- </object>
- <int key="connectionID">87</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">clearRecentDocuments:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="759406840"/>
- </object>
- <int key="connectionID">127</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">orderFrontStandardAboutPanel:</string>
- <reference key="source" ref="1021"/>
- <reference key="destination" ref="238522557"/>
- </object>
- <int key="connectionID">142</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">performClose:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="776162233"/>
- </object>
- <int key="connectionID">193</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">toggleContinuousSpellChecking:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="948374510"/>
- </object>
- <int key="connectionID">222</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">undo:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="1058277027"/>
- </object>
- <int key="connectionID">223</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">copy:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="860595796"/>
- </object>
- <int key="connectionID">224</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">checkSpelling:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="96193923"/>
- </object>
- <int key="connectionID">225</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">paste:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="29853731"/>
- </object>
- <int key="connectionID">226</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">stopSpeaking:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="680220178"/>
- </object>
- <int key="connectionID">227</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">cut:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="296257095"/>
- </object>
- <int key="connectionID">228</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">showGuessPanel:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="679648819"/>
- </object>
- <int key="connectionID">230</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">redo:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="790794224"/>
- </object>
- <int key="connectionID">231</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">selectAll:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="583158037"/>
- </object>
- <int key="connectionID">232</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">startSpeaking:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="731782645"/>
- </object>
- <int key="connectionID">233</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">delete:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="437104165"/>
- </object>
- <int key="connectionID">235</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">performZoom:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="575023229"/>
- </object>
- <int key="connectionID">240</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">performFindPanelAction:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="447796847"/>
- </object>
- <int key="connectionID">241</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">centerSelectionInVisibleArea:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="88285865"/>
- </object>
- <int key="connectionID">245</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">toggleGrammarChecking:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="967646866"/>
- </object>
- <int key="connectionID">347</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">toggleSmartInsertDelete:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="605118523"/>
- </object>
- <int key="connectionID">355</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">toggleAutomaticQuoteSubstitution:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="197661976"/>
- </object>
- <int key="connectionID">356</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">toggleAutomaticLinkDetection:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="708854459"/>
- </object>
- <int key="connectionID">357</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">saveDocument:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="1023925487"/>
- </object>
- <int key="connectionID">362</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">revertDocumentToSaved:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="579971712"/>
- </object>
- <int key="connectionID">364</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">runToolbarCustomizationPalette:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="237841660"/>
- </object>
- <int key="connectionID">365</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">toggleToolbarShown:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="102151532"/>
- </object>
- <int key="connectionID">366</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">hide:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="755159360"/>
- </object>
- <int key="connectionID">367</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">hideOtherApplications:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="342932134"/>
- </object>
- <int key="connectionID">368</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">unhideAllApplications:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="908899353"/>
- </object>
- <int key="connectionID">370</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">newDocument:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="705341025"/>
- </object>
- <int key="connectionID">373</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">openDocument:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="722745758"/>
- </object>
- <int key="connectionID">374</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">terminate:</string>
- <reference key="source" ref="1050"/>
- <reference key="destination" ref="632727374"/>
- </object>
- <int key="connectionID">449</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">toggleAutomaticSpellingCorrection:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="795346622"/>
- </object>
- <int key="connectionID">456</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">orderFrontSubstitutionsPanel:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="65139061"/>
- </object>
- <int key="connectionID">458</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">toggleAutomaticDashSubstitution:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="672708820"/>
- </object>
- <int key="connectionID">461</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">toggleAutomaticTextReplacement:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="537092702"/>
- </object>
- <int key="connectionID">463</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">uppercaseWord:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="1060694897"/>
- </object>
- <int key="connectionID">464</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">capitalizeWord:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="56570060"/>
- </object>
- <int key="connectionID">467</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">lowercaseWord:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="879586729"/>
- </object>
- <int key="connectionID">468</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">pasteAsPlainText:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="82994268"/>
- </object>
- <int key="connectionID">486</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">performFindPanelAction:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="326711663"/>
- </object>
- <int key="connectionID">487</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">performFindPanelAction:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="270902937"/>
- </object>
- <int key="connectionID">488</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">performFindPanelAction:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="159080638"/>
- </object>
- <int key="connectionID">489</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">showHelp:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="105068016"/>
- </object>
- <int key="connectionID">493</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">performFindPanelAction:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="738670835"/>
- </object>
- <int key="connectionID">535</int>
- </object>
- </object>
- <object class="IBMutableOrderedSet" key="objectRecords">
- <object class="NSArray" key="orderedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBObjectRecord">
- <int key="objectID">0</int>
- <object class="NSArray" key="object" id="0">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="children" ref="1048"/>
- <nil key="parent"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-2</int>
- <reference key="object" ref="1021"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">File's Owner</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-1</int>
- <reference key="object" ref="1014"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">First Responder</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-3</int>
- <reference key="object" ref="1050"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">Application</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">29</int>
- <reference key="object" ref="649796088"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="713487014"/>
- <reference ref="694149608"/>
- <reference ref="952259628"/>
- <reference ref="379814623"/>
- <reference ref="586577488"/>
- <reference ref="448692316"/>
- </object>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">19</int>
- <reference key="object" ref="713487014"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="835318025"/>
- </object>
- <reference key="parent" ref="649796088"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">56</int>
- <reference key="object" ref="694149608"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="110575045"/>
- </object>
- <reference key="parent" ref="649796088"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">217</int>
- <reference key="object" ref="952259628"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="789758025"/>
- </object>
- <reference key="parent" ref="649796088"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">83</int>
- <reference key="object" ref="379814623"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="720053764"/>
- </object>
- <reference key="parent" ref="649796088"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">81</int>
- <reference key="object" ref="720053764"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="1023925487"/>
- <reference ref="49223823"/>
- <reference ref="722745758"/>
- <reference ref="705341025"/>
- <reference ref="1025936716"/>
- <reference ref="294629803"/>
- <reference ref="776162233"/>
- <reference ref="425164168"/>
- <reference ref="579971712"/>
- <reference ref="1010469920"/>
- </object>
- <reference key="parent" ref="379814623"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">75</int>
- <reference key="object" ref="1023925487"/>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">78</int>
- <reference key="object" ref="49223823"/>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">72</int>
- <reference key="object" ref="722745758"/>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">82</int>
- <reference key="object" ref="705341025"/>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">124</int>
- <reference key="object" ref="1025936716"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="1065607017"/>
- </object>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">77</int>
- <reference key="object" ref="294629803"/>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">73</int>
- <reference key="object" ref="776162233"/>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">79</int>
- <reference key="object" ref="425164168"/>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">112</int>
- <reference key="object" ref="579971712"/>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">74</int>
- <reference key="object" ref="1010469920"/>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">125</int>
- <reference key="object" ref="1065607017"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="759406840"/>
- </object>
- <reference key="parent" ref="1025936716"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">126</int>
- <reference key="object" ref="759406840"/>
- <reference key="parent" ref="1065607017"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">205</int>
- <reference key="object" ref="789758025"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="437104165"/>
- <reference ref="583158037"/>
- <reference ref="1058277027"/>
- <reference ref="212016141"/>
- <reference ref="296257095"/>
- <reference ref="29853731"/>
- <reference ref="860595796"/>
- <reference ref="1040322652"/>
- <reference ref="790794224"/>
- <reference ref="892235320"/>
- <reference ref="972420730"/>
- <reference ref="676164635"/>
- <reference ref="507821607"/>
- <reference ref="288088188"/>
- <reference ref="82994268"/>
- </object>
- <reference key="parent" ref="952259628"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">202</int>
- <reference key="object" ref="437104165"/>
- <reference key="parent" ref="789758025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">198</int>
- <reference key="object" ref="583158037"/>
- <reference key="parent" ref="789758025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">207</int>
- <reference key="object" ref="1058277027"/>
- <reference key="parent" ref="789758025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">214</int>
- <reference key="object" ref="212016141"/>
- <reference key="parent" ref="789758025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">199</int>
- <reference key="object" ref="296257095"/>
- <reference key="parent" ref="789758025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">203</int>
- <reference key="object" ref="29853731"/>
- <reference key="parent" ref="789758025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">197</int>
- <reference key="object" ref="860595796"/>
- <reference key="parent" ref="789758025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">206</int>
- <reference key="object" ref="1040322652"/>
- <reference key="parent" ref="789758025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">215</int>
- <reference key="object" ref="790794224"/>
- <reference key="parent" ref="789758025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">218</int>
- <reference key="object" ref="892235320"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="963351320"/>
- </object>
- <reference key="parent" ref="789758025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">216</int>
- <reference key="object" ref="972420730"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="769623530"/>
- </object>
- <reference key="parent" ref="789758025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">200</int>
- <reference key="object" ref="769623530"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="948374510"/>
- <reference ref="96193923"/>
- <reference ref="679648819"/>
- <reference ref="967646866"/>
- <reference ref="859480356"/>
- <reference ref="795346622"/>
- </object>
- <reference key="parent" ref="972420730"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">219</int>
- <reference key="object" ref="948374510"/>
- <reference key="parent" ref="769623530"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">201</int>
- <reference key="object" ref="96193923"/>
- <reference key="parent" ref="769623530"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">204</int>
- <reference key="object" ref="679648819"/>
- <reference key="parent" ref="769623530"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">220</int>
- <reference key="object" ref="963351320"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="270902937"/>
- <reference ref="88285865"/>
- <reference ref="159080638"/>
- <reference ref="326711663"/>
- <reference ref="447796847"/>
- <reference ref="738670835"/>
- </object>
- <reference key="parent" ref="892235320"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">213</int>
- <reference key="object" ref="270902937"/>
- <reference key="parent" ref="963351320"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">210</int>
- <reference key="object" ref="88285865"/>
- <reference key="parent" ref="963351320"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">221</int>
- <reference key="object" ref="159080638"/>
- <reference key="parent" ref="963351320"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">208</int>
- <reference key="object" ref="326711663"/>
- <reference key="parent" ref="963351320"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">209</int>
- <reference key="object" ref="447796847"/>
- <reference key="parent" ref="963351320"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">57</int>
- <reference key="object" ref="110575045"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="238522557"/>
- <reference ref="755159360"/>
- <reference ref="908899353"/>
- <reference ref="632727374"/>
- <reference ref="646227648"/>
- <reference ref="609285721"/>
- <reference ref="481834944"/>
- <reference ref="304266470"/>
- <reference ref="1046388886"/>
- <reference ref="1056857174"/>
- <reference ref="342932134"/>
- </object>
- <reference key="parent" ref="694149608"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">58</int>
- <reference key="object" ref="238522557"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">134</int>
- <reference key="object" ref="755159360"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">150</int>
- <reference key="object" ref="908899353"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">136</int>
- <reference key="object" ref="632727374"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">144</int>
- <reference key="object" ref="646227648"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">129</int>
- <reference key="object" ref="609285721"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">143</int>
- <reference key="object" ref="481834944"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">236</int>
- <reference key="object" ref="304266470"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">131</int>
- <reference key="object" ref="1046388886"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="752062318"/>
- </object>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">149</int>
- <reference key="object" ref="1056857174"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">145</int>
- <reference key="object" ref="342932134"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">130</int>
- <reference key="object" ref="752062318"/>
- <reference key="parent" ref="1046388886"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">24</int>
- <reference key="object" ref="835318025"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="299356726"/>
- <reference ref="625202149"/>
- <reference ref="575023229"/>
- <reference ref="1011231497"/>
- </object>
- <reference key="parent" ref="713487014"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">92</int>
- <reference key="object" ref="299356726"/>
- <reference key="parent" ref="835318025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">5</int>
- <reference key="object" ref="625202149"/>
- <reference key="parent" ref="835318025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">239</int>
- <reference key="object" ref="575023229"/>
- <reference key="parent" ref="835318025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">23</int>
- <reference key="object" ref="1011231497"/>
- <reference key="parent" ref="835318025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">295</int>
- <reference key="object" ref="586577488"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="466310130"/>
- </object>
- <reference key="parent" ref="649796088"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">296</int>
- <reference key="object" ref="466310130"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="102151532"/>
- <reference ref="237841660"/>
- </object>
- <reference key="parent" ref="586577488"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">297</int>
- <reference key="object" ref="102151532"/>
- <reference key="parent" ref="466310130"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">298</int>
- <reference key="object" ref="237841660"/>
- <reference key="parent" ref="466310130"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">211</int>
- <reference key="object" ref="676164635"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="785027613"/>
- </object>
- <reference key="parent" ref="789758025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">212</int>
- <reference key="object" ref="785027613"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="680220178"/>
- <reference ref="731782645"/>
- </object>
- <reference key="parent" ref="676164635"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">195</int>
- <reference key="object" ref="680220178"/>
- <reference key="parent" ref="785027613"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">196</int>
- <reference key="object" ref="731782645"/>
- <reference key="parent" ref="785027613"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">346</int>
- <reference key="object" ref="967646866"/>
- <reference key="parent" ref="769623530"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">348</int>
- <reference key="object" ref="507821607"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="698887838"/>
- </object>
- <reference key="parent" ref="789758025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">349</int>
- <reference key="object" ref="698887838"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="605118523"/>
- <reference ref="197661976"/>
- <reference ref="708854459"/>
- <reference ref="65139061"/>
- <reference ref="19036812"/>
- <reference ref="672708820"/>
- <reference ref="537092702"/>
- </object>
- <reference key="parent" ref="507821607"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">350</int>
- <reference key="object" ref="605118523"/>
- <reference key="parent" ref="698887838"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">351</int>
- <reference key="object" ref="197661976"/>
- <reference key="parent" ref="698887838"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">354</int>
- <reference key="object" ref="708854459"/>
- <reference key="parent" ref="698887838"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">450</int>
- <reference key="object" ref="288088188"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="579392910"/>
- </object>
- <reference key="parent" ref="789758025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">451</int>
- <reference key="object" ref="579392910"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="1060694897"/>
- <reference ref="879586729"/>
- <reference ref="56570060"/>
- </object>
- <reference key="parent" ref="288088188"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">452</int>
- <reference key="object" ref="1060694897"/>
- <reference key="parent" ref="579392910"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">453</int>
- <reference key="object" ref="859480356"/>
- <reference key="parent" ref="769623530"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">454</int>
- <reference key="object" ref="795346622"/>
- <reference key="parent" ref="769623530"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">457</int>
- <reference key="object" ref="65139061"/>
- <reference key="parent" ref="698887838"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">459</int>
- <reference key="object" ref="19036812"/>
- <reference key="parent" ref="698887838"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">460</int>
- <reference key="object" ref="672708820"/>
- <reference key="parent" ref="698887838"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">462</int>
- <reference key="object" ref="537092702"/>
- <reference key="parent" ref="698887838"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">465</int>
- <reference key="object" ref="879586729"/>
- <reference key="parent" ref="579392910"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">466</int>
- <reference key="object" ref="56570060"/>
- <reference key="parent" ref="579392910"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">485</int>
- <reference key="object" ref="82994268"/>
- <reference key="parent" ref="789758025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">490</int>
- <reference key="object" ref="448692316"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="992780483"/>
- </object>
- <reference key="parent" ref="649796088"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">491</int>
- <reference key="object" ref="992780483"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="105068016"/>
- </object>
- <reference key="parent" ref="448692316"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">492</int>
- <reference key="object" ref="105068016"/>
- <reference key="parent" ref="992780483"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">534</int>
- <reference key="object" ref="738670835"/>
- <reference key="parent" ref="963351320"/>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="flattenedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>-1.IBPluginDependency</string>
- <string>-2.IBPluginDependency</string>
- <string>-3.IBPluginDependency</string>
- <string>112.IBPluginDependency</string>
- <string>124.IBPluginDependency</string>
- <string>125.IBPluginDependency</string>
- <string>126.IBPluginDependency</string>
- <string>129.IBPluginDependency</string>
- <string>130.IBPluginDependency</string>
- <string>131.IBPluginDependency</string>
- <string>134.IBPluginDependency</string>
- <string>136.IBPluginDependency</string>
- <string>143.IBPluginDependency</string>
- <string>144.IBPluginDependency</string>
- <string>145.IBPluginDependency</string>
- <string>149.IBPluginDependency</string>
- <string>150.IBPluginDependency</string>
- <string>19.IBPluginDependency</string>
- <string>195.IBPluginDependency</string>
- <string>196.IBPluginDependency</string>
- <string>197.IBPluginDependency</string>
- <string>198.IBPluginDependency</string>
- <string>199.IBPluginDependency</string>
- <string>200.IBPluginDependency</string>
- <string>201.IBPluginDependency</string>
- <string>202.IBPluginDependency</string>
- <string>203.IBPluginDependency</string>
- <string>204.IBPluginDependency</string>
- <string>205.IBPluginDependency</string>
- <string>206.IBPluginDependency</string>
- <string>207.IBPluginDependency</string>
- <string>208.IBPluginDependency</string>
- <string>209.IBPluginDependency</string>
- <string>210.IBPluginDependency</string>
- <string>211.IBPluginDependency</string>
- <string>212.IBPluginDependency</string>
- <string>213.IBPluginDependency</string>
- <string>214.IBPluginDependency</string>
- <string>215.IBPluginDependency</string>
- <string>216.IBPluginDependency</string>
- <string>217.IBPluginDependency</string>
- <string>218.IBPluginDependency</string>
- <string>219.IBPluginDependency</string>
- <string>220.IBPluginDependency</string>
- <string>221.IBPluginDependency</string>
- <string>23.IBPluginDependency</string>
- <string>236.IBPluginDependency</string>
- <string>239.IBPluginDependency</string>
- <string>24.IBPluginDependency</string>
- <string>29.IBPluginDependency</string>
- <string>295.IBPluginDependency</string>
- <string>296.IBPluginDependency</string>
- <string>297.IBPluginDependency</string>
- <string>298.IBPluginDependency</string>
- <string>346.IBPluginDependency</string>
- <string>348.IBPluginDependency</string>
- <string>349.IBPluginDependency</string>
- <string>350.IBPluginDependency</string>
- <string>351.IBPluginDependency</string>
- <string>354.IBPluginDependency</string>
- <string>450.IBPluginDependency</string>
- <string>451.IBPluginDependency</string>
- <string>452.IBPluginDependency</string>
- <string>453.IBPluginDependency</string>
- <string>454.IBPluginDependency</string>
- <string>457.IBPluginDependency</string>
- <string>459.IBPluginDependency</string>
- <string>460.IBPluginDependency</string>
- <string>462.IBPluginDependency</string>
- <string>465.IBPluginDependency</string>
- <string>466.IBPluginDependency</string>
- <string>485.IBPluginDependency</string>
- <string>490.IBPluginDependency</string>
- <string>491.IBPluginDependency</string>
- <string>492.IBPluginDependency</string>
- <string>5.IBPluginDependency</string>
- <string>534.IBPluginDependency</string>
- <string>56.IBPluginDependency</string>
- <string>57.IBPluginDependency</string>
- <string>58.IBPluginDependency</string>
- <string>72.IBPluginDependency</string>
- <string>73.IBPluginDependency</string>
- <string>74.IBPluginDependency</string>
- <string>75.IBPluginDependency</string>
- <string>77.IBPluginDependency</string>
- <string>78.IBPluginDependency</string>
- <string>79.IBPluginDependency</string>
- <string>81.IBPluginDependency</string>
- <string>82.IBPluginDependency</string>
- <string>83.IBPluginDependency</string>
- <string>92.IBPluginDependency</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="unlocalizedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <reference key="dict.values" ref="0"/>
- </object>
- <nil key="activeLocalization"/>
- <object class="NSMutableDictionary" key="localizations">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <reference key="dict.values" ref="0"/>
- </object>
- <nil key="sourceID"/>
- <int key="maxID">535</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">NSDocument</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>printDocument:</string>
- <string>revertDocumentToSaved:</string>
- <string>runPageLayout:</string>
- <string>saveDocument:</string>
- <string>saveDocumentAs:</string>
- <string>saveDocumentTo:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>printDocument:</string>
- <string>revertDocumentToSaved:</string>
- <string>runPageLayout:</string>
- <string>saveDocument:</string>
- <string>saveDocumentAs:</string>
- <string>saveDocumentTo:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBActionInfo">
- <string key="name">printDocument:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">revertDocumentToSaved:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">runPageLayout:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">saveDocument:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">saveDocumentAs:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">saveDocumentTo:</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/NSDocument.h</string>
- </object>
- </object>
- </object>
- </object>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
- <integer value="3000" key="NS.object.0"/>
- </object>
- <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
- <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSMenuCheckmark</string>
- <string>NSMenuMixedState</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>{9, 8}</string>
- <string>{7, 2}</string>
- </object>
- </object>
- </data>
-</archive>
diff --git a/ash/shell/cocoa/nibs/RootWindow.xib b/ash/shell/cocoa/nibs/RootWindow.xib
deleted file mode 100644
index 8ed21006b4..0000000000
--- a/ash/shell/cocoa/nibs/RootWindow.xib
+++ /dev/null
@@ -1,169 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
- <data>
- <int key="IBDocument.SystemTarget">1070</int>
- <string key="IBDocument.SystemVersion">11C74</string>
- <string key="IBDocument.InterfaceBuilderVersion">1900</string>
- <string key="IBDocument.AppKitVersion">1138.23</string>
- <string key="IBDocument.HIToolboxVersion">567.00</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">1900</string>
- </object>
- <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSWindowTemplate</string>
- <string>NSView</string>
- <string>NSCustomObject</string>
- </object>
- <object class="NSArray" key="IBDocument.PluginDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.Metadata">
- <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
- <integer value="1" key="NS.object.0"/>
- </object>
- <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomObject" id="1001">
- <string key="NSClassName">NSWindowController</string>
- </object>
- <object class="NSCustomObject" id="1003">
- <string key="NSClassName">FirstResponder</string>
- </object>
- <object class="NSCustomObject" id="1004">
- <string key="NSClassName">NSApplication</string>
- </object>
- <object class="NSWindowTemplate" id="1005">
- <int key="NSWindowStyleMask">15</int>
- <int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{196, 240}, {672, 666}}</string>
- <int key="NSWTFlags">544735232</int>
- <string key="NSWindowTitle">Aura Shell</string>
- <string key="NSWindowClass">RootWindowMac</string>
- <nil key="NSViewClass"/>
- <nil key="NSUserInterfaceItemIdentifier"/>
- <object class="NSView" key="NSWindowView" id="1006">
- <reference key="NSNextResponder"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrameSize">{672, 666}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
- </object>
- <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
- <string key="NSMaxSize">{10000000000000, 10000000000000}</string>
- <bool key="NSWindowIsRestorable">YES</bool>
- </object>
- </object>
- <object class="IBObjectContainer" key="IBDocument.Objects">
- <object class="NSMutableArray" key="connectionRecords">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">window</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="1005"/>
- </object>
- <int key="connectionID">5</int>
- </object>
- </object>
- <object class="IBMutableOrderedSet" key="objectRecords">
- <object class="NSArray" key="orderedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBObjectRecord">
- <int key="objectID">0</int>
- <object class="NSArray" key="object" id="1002">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="children" ref="1000"/>
- <nil key="parent"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-2</int>
- <reference key="object" ref="1001"/>
- <reference key="parent" ref="1002"/>
- <string key="objectName">File's Owner</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-1</int>
- <reference key="object" ref="1003"/>
- <reference key="parent" ref="1002"/>
- <string key="objectName">First Responder</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-3</int>
- <reference key="object" ref="1004"/>
- <reference key="parent" ref="1002"/>
- <string key="objectName">Application</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">1</int>
- <reference key="object" ref="1005"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="1006"/>
- </object>
- <reference key="parent" ref="1002"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">2</int>
- <reference key="object" ref="1006"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="parent" ref="1005"/>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="flattenedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>-1.IBPluginDependency</string>
- <string>-2.IBPluginDependency</string>
- <string>-3.IBPluginDependency</string>
- <string>1.IBPluginDependency</string>
- <string>1.IBWindowTemplateEditedContentRect</string>
- <string>1.NSWindowTemplate.visibleAtLaunch</string>
- <string>2.CustomClassName</string>
- <string>2.IBPluginDependency</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{357, 418}, {480, 270}}</string>
- <integer value="1"/>
- <string>RootWindowView</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="unlocalizedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="1002"/>
- <reference key="dict.values" ref="1002"/>
- </object>
- <nil key="activeLocalization"/>
- <object class="NSMutableDictionary" key="localizations">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="1002"/>
- <reference key="dict.values" ref="1002"/>
- </object>
- <nil key="sourceID"/>
- <int key="maxID">5</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes"/>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
- <integer value="3000" key="NS.object.0"/>
- </object>
- <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
- </data>
-</archive>
diff --git a/ash/shell/content_client/shell_browser_main_parts.cc b/ash/shell/content_client/shell_browser_main_parts.cc
index 1dc0b3e832..06473f2016 100644
--- a/ash/shell/content_client/shell_browser_main_parts.cc
+++ b/ash/shell/content_client/shell_browser_main_parts.cc
@@ -87,13 +87,11 @@ ShellBrowserMainParts::ShellBrowserMainParts(
ShellBrowserMainParts::~ShellBrowserMainParts() {
}
-#if !defined(OS_MACOSX)
void ShellBrowserMainParts::PreMainMessageLoopStart() {
#if defined(USE_X11)
ui::TouchFactory::SetTouchDeviceListFromCommandLine();
#endif
}
-#endif
void ShellBrowserMainParts::PostMainMessageLoopStart() {
#if defined(OS_CHROMEOS)
diff --git a/ash/shell/panel_window.cc b/ash/shell/panel_window.cc
index 886d0c1149..9593a4066f 100644
--- a/ash/shell/panel_window.cc
+++ b/ash/shell/panel_window.cc
@@ -47,7 +47,7 @@ views::Widget* PanelWindow::CreateWidget() {
if (params().bounds.height() == 0)
params().bounds.set_height(kDefaultHeight);
params().bounds = ScreenAsh::ConvertRectToScreen(
- Shell::GetActiveRootWindow(),
+ Shell::GetTargetRootWindow(),
params().bounds);
widget->Init(params());
diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc
index 471f5acbb5..58076ab75b 100644
--- a/ash/shell/shell_delegate_impl.cc
+++ b/ash/shell/shell_delegate_impl.cc
@@ -16,6 +16,7 @@
#include "ash/shell/launcher_delegate_impl.h"
#include "ash/shell/toplevel_window.h"
#include "ash/shell_window_ids.h"
+#include "ash/system/tray/default_system_tray_delegate.h"
#include "ash/wm/window_util.h"
#include "base/message_loop/message_loop.h"
#include "ui/aura/window.h"
@@ -168,7 +169,7 @@ ash::LauncherDelegate* ShellDelegateImpl::CreateLauncherDelegate(
}
ash::SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() {
- return NULL;
+ return new DefaultSystemTrayDelegate;
}
ash::UserWallpaperDelegate* ShellDelegateImpl::CreateUserWallpaperDelegate() {
diff --git a/ash/shell/shell_main_parts_mac.mm b/ash/shell/shell_main_parts_mac.mm
deleted file mode 100644
index 4153a5854c..0000000000
--- a/ash/shell/shell_main_parts_mac.mm
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ash/shell/shell_main_parts.h"
-
-#import <Cocoa/Cocoa.h>
-
-#include "base/i18n/icu_util.h"
-#include "base/mac/bundle_locations.h"
-#include "base/mac/scoped_nsobject.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/base/ui_base_paths.h"
-
-namespace ash {
-namespace shell {
-
-void PreMainMessageLoopStart() {
- ui::RegisterPathProvider();
- base::i18n::InitializeICU();
- ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL);
-
- base::scoped_nsobject<NSNib> nib(
- [[NSNib alloc] initWithNibNamed:@"MainMenu"
- bundle:base::mac::FrameworkBundle()]);
- [nib instantiateNibWithOwner:NSApp topLevelObjects:nil];
-}
-
-} // namespace shell
-} // namespace ash
diff --git a/ash/shell/window_type_launcher.cc b/ash/shell/window_type_launcher.cc
index 949b3aef9b..918d72514b 100644
--- a/ash/shell/window_type_launcher.cc
+++ b/ash/shell/window_type_launcher.cc
@@ -266,9 +266,7 @@ WindowTypeLauncher::WindowTypeLauncher()
AddViewToLayout(layout, show_hide_window_button_);
AddViewToLayout(layout, show_screensaver_);
AddViewToLayout(layout, show_web_notification_);
-#if !defined(OS_MACOSX)
set_context_menu_controller(this);
-#endif
}
WindowTypeLauncher::~WindowTypeLauncher() {
@@ -352,17 +350,13 @@ void WindowTypeLauncher::ButtonPressed(views::Button* sender,
ash::Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget()
->web_notification_tray()->message_center()
->AddNotification(notification.Pass());
- }
-#if !defined(OS_MACOSX)
- else if (sender == examples_button_) {
+ } else if (sender == examples_button_) {
views::examples::ShowExamplesWindowWithContent(
views::examples::DO_NOTHING_ON_CLOSE,
ash::Shell::GetInstance()->browser_context());
}
-#endif // !defined(OS_MACOSX)
}
-#if !defined(OS_MACOSX)
void WindowTypeLauncher::ExecuteCommand(int id, int event_flags) {
switch (id) {
case COMMAND_NEW_WINDOW:
@@ -375,9 +369,7 @@ void WindowTypeLauncher::ExecuteCommand(int id, int event_flags) {
break;
}
}
-#endif // !defined(OS_MACOSX)
-#if !defined(OS_MACOSX)
void WindowTypeLauncher::ShowContextMenuForView(
views::View* source,
const gfx::Point& point,
@@ -399,7 +391,6 @@ void WindowTypeLauncher::ShowContextMenuForView(
MenuRunner::MENU_DELETED)
return;
}
-#endif // !defined(OS_MACOSX)
} // namespace shell
} // namespace ash
diff --git a/ash/shell/window_type_launcher.h b/ash/shell/window_type_launcher.h
index 29d703d115..7a088d90c5 100644
--- a/ash/shell/window_type_launcher.h
+++ b/ash/shell/window_type_launcher.h
@@ -20,15 +20,10 @@ namespace shell {
// The contents view/delegate of a window that shows some buttons that create
// various window types.
-#if defined(OS_MACOSX)
-class WindowTypeLauncher : public views::WidgetDelegateView,
- public views::ButtonListener {
-#else
class WindowTypeLauncher : public views::WidgetDelegateView,
public views::ButtonListener,
public views::MenuDelegate,
public views::ContextMenuController {
-#endif // defined(OS_MACOSX)
public:
WindowTypeLauncher();
virtual ~WindowTypeLauncher();
@@ -55,7 +50,6 @@ class WindowTypeLauncher : public views::WidgetDelegateView,
virtual void ButtonPressed(views::Button* sender,
const ui::Event& event) OVERRIDE;
-#if !defined(OS_MACOSX)
// Overridden from views::MenuDelegate:
virtual void ExecuteCommand(int id, int event_flags) OVERRIDE;
@@ -63,7 +57,6 @@ class WindowTypeLauncher : public views::WidgetDelegateView,
virtual void ShowContextMenuForView(views::View* source,
const gfx::Point& point,
ui::MenuSourceType source_type) OVERRIDE;
-#endif // !defined(OS_MACOSX)
views::LabelButton* create_button_;
views::LabelButton* create_persistant_button_;
@@ -80,9 +73,7 @@ class WindowTypeLauncher : public views::WidgetDelegateView,
views::LabelButton* show_hide_window_button_;
views::LabelButton* show_screensaver_;
views::LabelButton* show_web_notification_;
-#if !defined(OS_MACOSX)
scoped_ptr<views::MenuRunner> menu_runner_;
-#endif
DISALLOW_COPY_AND_ASSIGN(WindowTypeLauncher);
};
diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc
index 0cc1e4483a..79c64f9b78 100644
--- a/ash/shell_unittest.cc
+++ b/ash/shell_unittest.cc
@@ -386,13 +386,7 @@ TEST_F(ShellTest, LockScreenClosesActiveMenu) {
views::MenuRunner::CONTEXT_MENU));
}
-// Fails on Mac, see http://crbug.com/115662
-#if defined(OS_MACOSX)
-#define MAYBE_ManagedWindowModeBasics DISABLED_ManagedWindowModeBasics
-#else
-#define MAYBE_ManagedWindowModeBasics ManagedWindowModeBasics
-#endif
-TEST_F(ShellTest, MAYBE_ManagedWindowModeBasics) {
+TEST_F(ShellTest, ManagedWindowModeBasics) {
Shell* shell = Shell::GetInstance();
Shell::TestApi test_api(shell);
diff --git a/ash/system/brightness/tray_brightness.cc b/ash/system/brightness/tray_brightness.cc
index 93e415fd2e..87d1f1a991 100644
--- a/ash/system/brightness/tray_brightness.cc
+++ b/ash/system/brightness/tray_brightness.cc
@@ -89,13 +89,11 @@ class BrightnessView : public views::View,
DCHECK_EQ(sender, slider_);
if (reason != views::VALUE_CHANGED_BY_USER)
return;
-#if !defined(OS_MACOSX)
AcceleratorController* ac = Shell::GetInstance()->accelerator_controller();
if (ac->brightness_control_delegate()) {
double percent = std::max(value * 100.0, kMinBrightnessPercent);
ac->brightness_control_delegate()->SetBrightnessPercent(percent, true);
}
-#endif // OS_MACOSX
}
// Overridden from views:SliderListener.
diff --git a/ash/system/chromeos/managed/tray_locally_managed_user.cc b/ash/system/chromeos/managed/tray_locally_managed_user.cc
index d1cc459583..0f0ab4c298 100644
--- a/ash/system/chromeos/managed/tray_locally_managed_user.cc
+++ b/ash/system/chromeos/managed/tray_locally_managed_user.cc
@@ -79,8 +79,8 @@ void TrayLocallyManagedUser::CreateOrUpdateNotification(
scoped_ptr<Notification> notification(new Notification(
message_center::NOTIFICATION_TYPE_SIMPLE,
kNotificationId,
+ string16() /* no title */,
new_message,
- base::string16() /* body is empty */,
bundle.GetImageNamed(IDR_AURA_UBER_TRAY_MANAGED_USER),
base::string16() /* display_source */,
message_center::NotifierId(
diff --git a/ash/system/chromeos/managed/tray_locally_managed_user_unittest.cc b/ash/system/chromeos/managed/tray_locally_managed_user_unittest.cc
index af7e5d9630..46f60d13c9 100644
--- a/ash/system/chromeos/managed/tray_locally_managed_user_unittest.cc
+++ b/ash/system/chromeos/managed/tray_locally_managed_user_unittest.cc
@@ -5,9 +5,9 @@
#include "ash/system/chromeos/managed/tray_locally_managed_user.h"
#include "ash/shell.h"
-#include "ash/system/tray/test_system_tray_delegate.h"
#include "ash/system/user/login_status.h"
#include "ash/test/ash_test_base.h"
+#include "ash/test/test_system_tray_delegate.h"
#include "ui/message_center/message_center.h"
#include "ui/message_center/notification.h"
#include "ui/message_center/notification_list.h"
diff --git a/ash/system/chromeos/network/network_connect.cc b/ash/system/chromeos/network/network_connect.cc
index 23fd8d990a..d0765cc217 100644
--- a/ash/system/chromeos/network/network_connect.cc
+++ b/ash/system/chromeos/network/network_connect.cc
@@ -58,10 +58,11 @@ bool IsDirectActivatedCarrier(const std::string& carrier) {
return false;
}
-void ShowErrorNotification(const std::string& error,
+void ShowErrorNotification(const std::string& error_name,
+ const std::string& shill_error,
const std::string& service_path) {
Shell::GetInstance()->system_tray_notifier()->network_state_notifier()->
- ShowNetworkConnectError(error, service_path);
+ ShowNetworkConnectError(error_name, shill_error, service_path);
}
void OnConnectFailed(const std::string& service_path,
@@ -104,7 +105,10 @@ void OnConnectFailed(const std::string& service_path,
}
// ConnectFailed or unknown error; show a notification.
- ShowErrorNotification(error_name, service_path);
+ std::string shill_error;
+ error_data.get()->GetString(
+ chromeos::network_handler::kErrorDetail, &shill_error);
+ ShowErrorNotification(error_name, shill_error, service_path);
// Show a configure dialog for ConnectFailed errors.
if (error_name != flimflam::kErrorConnectFailed)
@@ -153,7 +157,8 @@ void OnActivateFailed(const std::string& service_path,
const std::string& error_name,
scoped_ptr<base::DictionaryValue> error_data) {
NET_LOG_ERROR("Unable to activate network", service_path);
- ShowErrorNotification(network_connect::kErrorActivateFailed, service_path);
+ ShowErrorNotification(
+ network_connect::kErrorActivateFailed, "", service_path);
}
void OnActivateSucceeded(const std::string& service_path) {
@@ -163,7 +168,8 @@ void OnActivateSucceeded(const std::string& service_path) {
void OnConfigureFailed(const std::string& error_name,
scoped_ptr<base::DictionaryValue> error_data) {
NET_LOG_ERROR("Unable to configure network", "");
- ShowErrorNotification(NetworkConnectionHandler::kErrorConfigureFailed, "");
+ ShowErrorNotification(
+ NetworkConnectionHandler::kErrorConfigureFailed, "", "");
}
void OnConfigureSucceeded(const std::string& service_path) {
@@ -180,7 +186,7 @@ void SetPropertiesFailed(const std::string& desc,
scoped_ptr<base::DictionaryValue> error_data) {
NET_LOG_ERROR(desc + ": Failed: " + config_error_name, service_path);
ShowErrorNotification(
- NetworkConnectionHandler::kErrorConfigureFailed, service_path);
+ NetworkConnectionHandler::kErrorConfigureFailed, "", service_path);
}
void SetPropertiesToClear(base::DictionaryValue* properties_to_set,
@@ -405,7 +411,7 @@ void ConfigureNetworkAndConnect(const std::string& service_path,
std::string profile_path;
if (!GetNetworkProfilePath(shared, &profile_path)) {
ShowErrorNotification(
- NetworkConnectionHandler::kErrorConfigureFailed, service_path);
+ NetworkConnectionHandler::kErrorConfigureFailed, "", service_path);
return;
}
NetworkHandler::Get()->network_configuration_handler()->SetNetworkProfile(
@@ -421,7 +427,8 @@ void CreateConfigurationAndConnect(base::DictionaryValue* properties,
NET_LOG_USER("CreateConfigurationAndConnect", "");
std::string profile_path;
if (!GetNetworkProfilePath(shared, &profile_path)) {
- ShowErrorNotification(NetworkConnectionHandler::kErrorConfigureFailed, "");
+ ShowErrorNotification(
+ NetworkConnectionHandler::kErrorConfigureFailed, "", "");
return;
}
properties->SetStringWithoutPathExpansion(
diff --git a/ash/system/chromeos/network/network_icon_animation.cc b/ash/system/chromeos/network/network_icon_animation.cc
index 2a6428cb0c..5065745c84 100644
--- a/ash/system/chromeos/network/network_icon_animation.cc
+++ b/ash/system/chromeos/network/network_icon_animation.cc
@@ -17,13 +17,14 @@ NetworkIconAnimation::NetworkIconAnimation()
: animation_(this) {
// Set up the animation throbber.
animation_.SetThrobDuration(kThrobDurationMs);
- animation_.SetTweenType(ui::Tween::LINEAR);
+ animation_.SetTweenType(gfx::Tween::LINEAR);
}
NetworkIconAnimation::~NetworkIconAnimation() {
}
-void NetworkIconAnimation::AnimationProgressed(const ui::Animation* animation) {
+void NetworkIconAnimation::AnimationProgressed(
+ const gfx::Animation* animation) {
if (animation != &animation_)
return;
FOR_EACH_OBSERVER(AnimationObserver, observers_, NetworkIconChanged());
diff --git a/ash/system/chromeos/network/network_icon_animation.h b/ash/system/chromeos/network/network_icon_animation.h
index e784f7d19f..a34b80ed96 100644
--- a/ash/system/chromeos/network/network_icon_animation.h
+++ b/ash/system/chromeos/network/network_icon_animation.h
@@ -10,8 +10,8 @@
#include "ash/ash_export.h"
#include "base/observer_list.h"
-#include "ui/base/animation/animation_delegate.h"
-#include "ui/base/animation/throb_animation.h"
+#include "ui/gfx/animation/animation_delegate.h"
+#include "ui/gfx/animation/throb_animation.h"
namespace ash {
namespace network_icon {
@@ -19,7 +19,7 @@ namespace network_icon {
class AnimationObserver;
// Single instance class to handle icon animations and keep them in sync.
-class ASH_EXPORT NetworkIconAnimation : public ui::AnimationDelegate {
+class ASH_EXPORT NetworkIconAnimation : public gfx::AnimationDelegate {
public:
NetworkIconAnimation();
virtual ~NetworkIconAnimation();
@@ -32,13 +32,13 @@ class ASH_EXPORT NetworkIconAnimation : public ui::AnimationDelegate {
void AddObserver(AnimationObserver* observer);
void RemoveObserver(AnimationObserver* observer);
- // ui::AnimationDelegate implementation.
- virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
+ // gfx::AnimationDelegate implementation.
+ virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
static NetworkIconAnimation* GetInstance();
private:
- ui::ThrobAnimation animation_;
+ gfx::ThrobAnimation animation_;
ObserverList<AnimationObserver> observers_;
};
diff --git a/ash/system/chromeos/network/network_state_notifier.cc b/ash/system/chromeos/network/network_state_notifier.cc
index 634aca4b76..778b9a9fb5 100644
--- a/ash/system/chromeos/network/network_state_notifier.cc
+++ b/ash/system/chromeos/network/network_state_notifier.cc
@@ -196,46 +196,58 @@ void NetworkStateNotifier::UpdateCellularActivating(
void NetworkStateNotifier::ShowNetworkConnectError(
const std::string& error_name,
+ const std::string& shill_error,
const std::string& service_path) {
if (service_path.empty()) {
base::DictionaryValue shill_properties;
- ShowConnectErrorNotification(error_name, service_path, shill_properties);
+ ShowConnectErrorNotification(error_name, shill_error, service_path,
+ shill_properties);
return;
}
// Get the up-to-date properties for the network and display the error.
NetworkHandler::Get()->network_configuration_handler()->GetProperties(
service_path,
base::Bind(&NetworkStateNotifier::ConnectErrorPropertiesSucceeded,
- weak_ptr_factory_.GetWeakPtr(), error_name),
+ weak_ptr_factory_.GetWeakPtr(), error_name, shill_error),
base::Bind(&NetworkStateNotifier::ConnectErrorPropertiesFailed,
- weak_ptr_factory_.GetWeakPtr(), error_name, service_path));
+ weak_ptr_factory_.GetWeakPtr(), error_name, shill_error,
+ service_path));
}
void NetworkStateNotifier::ConnectErrorPropertiesSucceeded(
const std::string& error_name,
+ const std::string& shill_error,
const std::string& service_path,
const base::DictionaryValue& shill_properties) {
- ShowConnectErrorNotification(error_name, service_path, shill_properties);
+ ShowConnectErrorNotification(error_name, shill_error, service_path,
+ shill_properties);
}
void NetworkStateNotifier::ConnectErrorPropertiesFailed(
const std::string& error_name,
+ const std::string& shill_error,
const std::string& service_path,
- const std::string& shill_error_name,
+ const std::string& shill_connect_error,
scoped_ptr<base::DictionaryValue> shill_error_data) {
base::DictionaryValue shill_properties;
- ShowConnectErrorNotification(error_name, service_path, shill_properties);
+ ShowConnectErrorNotification(error_name, shill_error, service_path,
+ shill_properties);
}
void NetworkStateNotifier::ShowConnectErrorNotification(
const std::string& error_name,
+ const std::string& shill_error,
const std::string& service_path,
const base::DictionaryValue& shill_properties) {
string16 error = GetConnectErrorString(error_name);
if (error.empty()) {
- std::string network_error;
- shill_properties.GetStringWithoutPathExpansion(
- flimflam::kErrorProperty, &network_error);
+ // Service.Error gets cleared shortly after State transitions to Failure,
+ // so rely on |shill_error| unless empty.
+ std::string network_error = shill_error;
+ if (network_error.empty()) {
+ shill_properties.GetStringWithoutPathExpansion(
+ flimflam::kErrorProperty, &network_error);
+ }
error = network_connect::ErrorString(network_error);
if (error.empty())
error = l10n_util::GetStringUTF16(IDS_CHROMEOS_NETWORK_ERROR_UNKNOWN);
diff --git a/ash/system/chromeos/network/network_state_notifier.h b/ash/system/chromeos/network/network_state_notifier.h
index 612dfbfb1a..1a835bbbe9 100644
--- a/ash/system/chromeos/network/network_state_notifier.h
+++ b/ash/system/chromeos/network/network_state_notifier.h
@@ -46,24 +46,28 @@ class ASH_EXPORT NetworkStateNotifier :
// Show a connection error notification. If |error_name| matches an error
// defined in NetworkConnectionHandler for connect, configure, or activation
- // failed, then the associated message is shown, otherwise the Shill
- // error for Service.Error is used (from network_connect::ErrorString), or
- // "Unknown network error".
+ // failed, then the associated message is shown, otherwise |shill_error|
+ // is expected to contain Service.Error (which might get cleared before
+ // GetProperties returns).
void ShowNetworkConnectError(const std::string& error_name,
+ const std::string& shill_error,
const std::string& service_path);
private:
void ConnectErrorPropertiesSucceeded(
const std::string& error_name,
+ const std::string& shill_error,
const std::string& service_path,
const base::DictionaryValue& shill_properties);
void ConnectErrorPropertiesFailed(
const std::string& error_name,
+ const std::string& shill_error,
const std::string& service_path,
- const std::string& shill_error_name,
+ const std::string& shill_connect_error,
scoped_ptr<base::DictionaryValue> shill_error_data);
void ShowConnectErrorNotification(
const std::string& error_name,
+ const std::string& shill_error,
const std::string& service_path,
const base::DictionaryValue& shill_properties);
diff --git a/ash/system/chromeos/network/tray_network_state_observer.cc b/ash/system/chromeos/network/tray_network_state_observer.cc
index 49ba7389c8..d090762a19 100644
--- a/ash/system/chromeos/network/tray_network_state_observer.cc
+++ b/ash/system/chromeos/network/tray_network_state_observer.cc
@@ -33,10 +33,6 @@ TrayNetworkStateObserver::~TrayNetworkStateObserver() {
}
}
-void TrayNetworkStateObserver::NetworkManagerChanged() {
- delegate_->NetworkStateChanged(false);
-}
-
void TrayNetworkStateObserver::NetworkListChanged() {
delegate_->NetworkStateChanged(true);
network_icon::PurgeNetworkIconCache();
diff --git a/ash/system/chromeos/network/tray_network_state_observer.h b/ash/system/chromeos/network/tray_network_state_observer.h
index fc9faf9d09..e2f47d1025 100644
--- a/ash/system/chromeos/network/tray_network_state_observer.h
+++ b/ash/system/chromeos/network/tray_network_state_observer.h
@@ -34,7 +34,6 @@ class TrayNetworkStateObserver : public chromeos::NetworkStateHandlerObserver {
virtual ~TrayNetworkStateObserver();
// NetworkStateHandlerObserver overrides.
- virtual void NetworkManagerChanged() OVERRIDE;
virtual void NetworkListChanged() OVERRIDE;
virtual void DeviceListChanged() OVERRIDE;
virtual void DefaultNetworkChanged(
diff --git a/ash/system/chromeos/screen_security/screen_tray_item_unittest.cc b/ash/system/chromeos/screen_security/screen_tray_item_unittest.cc
index e51a91fa83..80f54b4977 100644
--- a/ash/system/chromeos/screen_security/screen_tray_item_unittest.cc
+++ b/ash/system/chromeos/screen_security/screen_tray_item_unittest.cc
@@ -10,7 +10,7 @@
#include "ash/test/ash_test_base.h"
#include "base/callback.h"
#include "base/strings/utf_string_conversions.h"
-#include "ui/base/events/event.h"
+#include "ui/events/event.h"
#include "ui/gfx/point.h"
#include "ui/message_center/message_center.h"
#include "ui/views/view.h"
diff --git a/ash/system/chromeos/tray_display.cc b/ash/system/chromeos/tray_display.cc
index 15ac17cb9b..9f7d593f1a 100644
--- a/ash/system/chromeos/tray_display.cc
+++ b/ash/system/chromeos/tray_display.cc
@@ -219,6 +219,7 @@ class DisplayView : public ash::internal::ActionableView {
message = GetDisplayInfoLine(GetDisplayManager()->first_display_id());
SetVisible(!message.empty());
label_->SetText(message);
+ Layout();
}
const views::Label* label() const { return label_; }
@@ -384,6 +385,9 @@ void TrayDisplay::OnDisplayConfigurationChanged() {
DisplayInfoMap old_info;
UpdateDisplayInfo(&old_info);
+ if (default_)
+ default_->Update();
+
if (!Shell::GetInstance()->system_tray_delegate()->
ShouldShowDisplayNotification()) {
return;
diff --git a/ash/system/chromeos/tray_display.h b/ash/system/chromeos/tray_display.h
index 3ea73da46a..6689a9bbb8 100644
--- a/ash/system/chromeos/tray_display.h
+++ b/ash/system/chromeos/tray_display.h
@@ -20,6 +20,7 @@ class AshTestBase;
}
namespace internal {
+class DisplayView;
class ASH_EXPORT TrayDisplay : public SystemTrayItem,
public DisplayController::Observer {
@@ -62,9 +63,11 @@ class ASH_EXPORT TrayDisplay : public SystemTrayItem,
// Test accessors.
base::string16 GetDefaultViewMessage() const;
- const views::View* default_view() const { return default_; }
+ const views::View* default_view() const {
+ return reinterpret_cast<views::View*>(default_);
+ }
- views::View* default_;
+ DisplayView* default_;
DisplayInfoMap display_info_;
DISALLOW_COPY_AND_ASSIGN(TrayDisplay);
diff --git a/ash/system/chromeos/tray_display_unittest.cc b/ash/system/chromeos/tray_display_unittest.cc
index 2a9794c999..1abbbd2164 100644
--- a/ash/system/chromeos/tray_display_unittest.cc
+++ b/ash/system/chromeos/tray_display_unittest.cc
@@ -9,8 +9,8 @@
#include "ash/screen_ash.h"
#include "ash/shell.h"
#include "ash/system/tray/system_tray.h"
-#include "ash/system/tray/test_system_tray_delegate.h"
#include "ash/test/ash_test_base.h"
+#include "ash/test/test_system_tray_delegate.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "grit/ash_strings.h"
@@ -116,7 +116,8 @@ void TrayDisplayTest::CloseNotification() {
}
bool TrayDisplayTest::IsDisplayVisibleInTray() const {
- return tray_display_->default_view() &&
+ return tray_->HasSystemBubble() &&
+ tray_display_->default_view() &&
tray_display_->default_view()->visible();
}
@@ -351,6 +352,41 @@ TEST_F(TrayDisplayTest, OverscanDisplay) {
GetTrayDisplayTooltipText());
}
+TEST_F(TrayDisplayTest, UpdateDuringDisplayConfigurationChange) {
+ tray()->ShowDefaultView(BUBBLE_USE_EXISTING);
+ EXPECT_FALSE(IsDisplayVisibleInTray());
+
+ UpdateDisplay("400x400@1.5");
+ EXPECT_TRUE(tray()->HasSystemBubble());
+ EXPECT_TRUE(IsDisplayVisibleInTray());
+ base::string16 internal_info = l10n_util::GetStringFUTF16(
+ IDS_ASH_STATUS_TRAY_DISPLAY_SINGLE_DISPLAY,
+ GetFirstDisplayName(), UTF8ToUTF16("600x600"));
+ EXPECT_EQ(internal_info, GetTrayDisplayText());
+ EXPECT_EQ(GetTooltipText(base::string16(), GetFirstDisplayName(), "600x600",
+ base::string16(), std::string()),
+ GetTrayDisplayTooltipText());
+
+ UpdateDisplay("400x400,200x200");
+ EXPECT_TRUE(tray()->HasSystemBubble());
+ EXPECT_TRUE(IsDisplayVisibleInTray());
+ base::string16 expected = l10n_util::GetStringUTF16(
+ IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED_NO_INTERNAL);
+ base::string16 first_name = GetFirstDisplayName();
+ EXPECT_EQ(expected, GetTrayDisplayText());
+ EXPECT_EQ(GetTooltipText(expected, GetFirstDisplayName(), "400x400",
+ GetSecondDisplayName(), "200x200"),
+ GetTrayDisplayTooltipText());
+
+ UpdateDisplay("400x400@1.5");
+ tray()->ShowDefaultView(BUBBLE_USE_EXISTING);
+
+ // Back to the default state, the display tray item should disappear.
+ UpdateDisplay("400x400");
+ EXPECT_TRUE(tray()->HasSystemBubble());
+ EXPECT_FALSE(IsDisplayVisibleInTray());
+}
+
TEST_F(TrayDisplayTest, DisplayNotifications) {
test::TestSystemTrayDelegate* tray_delegate =
static_cast<test::TestSystemTrayDelegate*>(
diff --git a/ash/system/date/date_view.cc b/ash/system/date/date_view.cc
index cc1552d924..53eb162e78 100644
--- a/ash/system/date/date_view.cc
+++ b/ash/system/date/date_view.cc
@@ -31,8 +31,16 @@ namespace {
// when the timer goes off.
const int kTimerSlopSeconds = 1;
-// Top number text color of vertical clock.
-const SkColor kVerticalClockHourColor = SkColorSetRGB(0xBA, 0xBA, 0xBA);
+// Text color of the vertical clock minutes.
+const SkColor kVerticalClockMinuteColor = SkColorSetRGB(0xBA, 0xBA, 0xBA);
+
+// Padding between the left edge of the shelf and the left edge of the vertical
+// clock.
+const int kVerticalClockLeftPadding = 9;
+
+// Offset used to bring the minutes line closer to the hours line in the
+// vertical clock.
+const int kVerticalClockMinutesTopOffset = -4;
base::string16 FormatDate(const base::Time& time) {
icu::UnicodeString date_string;
@@ -169,6 +177,8 @@ void DateView::OnMouseExited(const ui::MouseEvent& event) {
SchedulePaint();
}
+///////////////////////////////////////////////////////////////////////////////
+
TimeView::TimeView(TrayDate::ClockLayout clock_layout)
: hour_type_(ash::Shell::GetInstance()->system_tray_delegate()->
GetHourClockType()) {
@@ -198,19 +208,15 @@ void TimeView::UpdateTextInternal(const base::Time& now) {
base::string16 current_time = base::TimeFormatTimeOfDayWithHourClockType(
now, hour_type_, base::kDropAmPm);
- label_->SetText(current_time);
- label_->SetTooltipText(base::TimeFormatFriendlyDate(now));
+ horizontal_label_->SetText(current_time);
+ horizontal_label_->SetTooltipText(base::TimeFormatFriendlyDate(now));
// Calculate vertical clock layout labels.
size_t colon_pos = current_time.find(ASCIIToUTF16(":"));
base::string16 hour = current_time.substr(0, colon_pos);
base::string16 minute = current_time.substr(colon_pos + 1);
- label_hour_left_->SetText(hour.substr(0, 1));
- label_hour_right_->SetText(hour.length() == 2 ?
- hour.substr(1,1) : ASCIIToUTF16(":"));
- label_minute_left_->SetText(minute.substr(0, 1));
- label_minute_right_->SetText(minute.substr(1, 1));
-
+ vertical_label_hours_->SetText(hour);
+ vertical_label_minutes_->SetText(minute);
Layout();
}
@@ -226,31 +232,26 @@ bool TimeView::OnMousePressed(const ui::MouseEvent& event) {
void TimeView::UpdateClockLayout(TrayDate::ClockLayout clock_layout){
SetBorder(clock_layout);
if (clock_layout == TrayDate::HORIZONTAL_CLOCK) {
- RemoveChildView(label_hour_left_.get());
- RemoveChildView(label_hour_right_.get());
- RemoveChildView(label_minute_left_.get());
- RemoveChildView(label_minute_right_.get());
+ RemoveChildView(vertical_label_hours_.get());
+ RemoveChildView(vertical_label_minutes_.get());
SetLayoutManager(
new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0));
- AddChildView(label_.get());
+ AddChildView(horizontal_label_.get());
} else {
- RemoveChildView(label_.get());
+ RemoveChildView(horizontal_label_.get());
views::GridLayout* layout = new views::GridLayout(this);
SetLayoutManager(layout);
- views::ColumnSet* columns = layout->AddColumnSet(0);
- columns->AddPaddingColumn(0, 6);
- columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER,
- 0, views::GridLayout::USE_PREF, 0, 0);
+ const int kColumnId = 0;
+ views::ColumnSet* columns = layout->AddColumnSet(kColumnId);
+ columns->AddPaddingColumn(0, kVerticalClockLeftPadding);
columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER,
0, views::GridLayout::USE_PREF, 0, 0);
- layout->AddPaddingRow(0, kTrayLabelItemVerticalPaddingVeriticalAlignment);
- layout->StartRow(0, 0);
- layout->AddView(label_hour_left_.get());
- layout->AddView(label_hour_right_.get());
- layout->StartRow(0, 0);
- layout->AddView(label_minute_left_.get());
- layout->AddView(label_minute_right_.get());
- layout->AddPaddingRow(0, kTrayLabelItemVerticalPaddingVeriticalAlignment);
+ layout->AddPaddingRow(0, kTrayLabelItemVerticalPaddingVerticalAlignment);
+ layout->StartRow(0, kColumnId);
+ layout->AddView(vertical_label_hours_.get());
+ layout->StartRow(0, kColumnId);
+ layout->AddView(vertical_label_minutes_.get());
+ layout->AddPaddingRow(0, kTrayLabelItemVerticalPaddingVerticalAlignment);
}
Layout();
}
@@ -265,18 +266,17 @@ void TimeView::SetBorder(TrayDate::ClockLayout clock_layout) {
}
void TimeView::SetupLabels() {
- label_.reset(CreateLabel());
- SetupLabel(label_.get());
- label_hour_left_.reset(CreateLabel());
- SetupLabel(label_hour_left_.get());
- label_hour_right_.reset(CreateLabel());
- SetupLabel(label_hour_right_.get());
- label_minute_left_.reset(CreateLabel());
- SetupLabel(label_minute_left_.get());
- label_minute_right_.reset(CreateLabel());
- SetupLabel(label_minute_right_.get());
- label_hour_left_->SetEnabledColor(kVerticalClockHourColor);
- label_hour_right_->SetEnabledColor(kVerticalClockHourColor);
+ horizontal_label_.reset(CreateLabel());
+ SetupLabel(horizontal_label_.get());
+ vertical_label_hours_.reset(CreateLabel());
+ SetupLabel(vertical_label_hours_.get());
+ vertical_label_minutes_.reset(CreateLabel());
+ SetupLabel(vertical_label_minutes_.get());
+ vertical_label_minutes_->SetEnabledColor(kVerticalClockMinuteColor);
+ // Pull the minutes up closer to the hours by using a negative top border.
+ vertical_label_minutes_->set_border(
+ views::Border::CreateEmptyBorder(
+ kVerticalClockMinutesTopOffset, 0, 0, 0));
}
void TimeView::SetupLabel(views::Label* label) {
diff --git a/ash/system/date/date_view.h b/ash/system/date/date_view.h
index 98bc45fb7b..2c83da83e3 100644
--- a/ash/system/date/date_view.h
+++ b/ash/system/date/date_view.h
@@ -5,6 +5,7 @@
#ifndef ASH_SYSTEM_DATE_DATE_VIEW_H_
#define ASH_SYSTEM_DATE_DATE_VIEW_H_
+#include "ash/ash_export.h"
#include "ash/system/date/tray_date.h"
#include "ash/system/tray/actionable_view.h"
#include "base/i18n/time_formatting.h"
@@ -20,8 +21,8 @@ namespace internal {
namespace tray {
// Abstract base class containing common updating and layout code for the
-// DateView popup and the TimeView tray icon.
-class BaseDateTimeView : public ActionableView {
+// DateView popup and the TimeView tray icon. Exported for tests.
+class ASH_EXPORT BaseDateTimeView : public ActionableView {
public:
virtual ~BaseDateTimeView();
@@ -78,17 +79,12 @@ class DateView : public BaseDateTimeView {
};
// Tray view used to display the current time.
-class TimeView : public BaseDateTimeView {
+// Exported for tests.
+class ASH_EXPORT TimeView : public BaseDateTimeView {
public:
- TimeView(TrayDate::ClockLayout clock_layout);
+ explicit TimeView(TrayDate::ClockLayout clock_layout);
virtual ~TimeView();
- views::Label* label() const { return label_.get(); }
- views::Label* label_hour_left() const { return label_hour_left_.get(); }
- views::Label* label_hour_right() const { return label_hour_right_.get(); }
- views::Label* label_minute_left() const { return label_minute_left_.get(); }
- views::Label* label_minute_right() const { return label_minute_right_.get(); }
-
// Updates the format of the displayed time.
void UpdateTimeFormat();
@@ -96,6 +92,8 @@ class TimeView : public BaseDateTimeView {
void UpdateClockLayout(TrayDate::ClockLayout clock_layout);
private:
+ friend class TimeViewTest;
+
// Overridden from BaseDateTimeView.
virtual void UpdateTextInternal(const base::Time& now) OVERRIDE;
@@ -109,11 +107,12 @@ class TimeView : public BaseDateTimeView {
void SetupLabels();
void SetupLabel(views::Label* label);
- scoped_ptr<views::Label> label_;
- scoped_ptr<views::Label> label_hour_left_;
- scoped_ptr<views::Label> label_hour_right_;
- scoped_ptr<views::Label> label_minute_left_;
- scoped_ptr<views::Label> label_minute_right_;
+ // Label text used for the normal horizontal shelf.
+ scoped_ptr<views::Label> horizontal_label_;
+
+ // The time label is split into two lines for the vertical shelf.
+ scoped_ptr<views::Label> vertical_label_hours_;
+ scoped_ptr<views::Label> vertical_label_minutes_;
base::HourClockType hour_type_;
diff --git a/ash/system/date/date_view_unittest.cc b/ash/system/date/date_view_unittest.cc
new file mode 100644
index 0000000000..931d220694
--- /dev/null
+++ b/ash/system/date/date_view_unittest.cc
@@ -0,0 +1,66 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/system/date/date_view.h"
+
+#include "ash/test/ash_test_base.h"
+#include "ui/views/controls/label.h"
+
+namespace ash {
+namespace internal {
+namespace tray {
+
+class TimeViewTest : public ash::test::AshTestBase {
+ public:
+ TimeViewTest() {}
+ virtual ~TimeViewTest() {}
+
+ TimeView* time_view() { return time_view_.get(); }
+
+ // Access to private fields of |time_view_|.
+ views::Label* horizontal_label() {
+ return time_view_->horizontal_label_.get();
+ }
+ views::Label* vertical_label_hours() {
+ return time_view_->vertical_label_hours_.get();
+ }
+ views::Label* vertical_label_minutes() {
+ return time_view_->vertical_label_minutes_.get();
+ }
+
+ // Creates a time view with horizontal or vertical |clock_layout|.
+ void CreateTimeView(TrayDate::ClockLayout clock_layout) {
+ time_view_.reset(new TimeView(clock_layout));
+ }
+
+ private:
+ scoped_ptr<TimeView> time_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(TimeViewTest);
+};
+
+// Test the basics of the time view, mostly to ensure we don't leak memory.
+TEST_F(TimeViewTest, Basics) {
+ // A newly created horizontal clock only has the horizontal label.
+ CreateTimeView(TrayDate::HORIZONTAL_CLOCK);
+ EXPECT_EQ(time_view(), horizontal_label()->parent());
+ EXPECT_FALSE(vertical_label_hours()->parent());
+ EXPECT_FALSE(vertical_label_minutes()->parent());
+
+ // Switching the clock to vertical updates the labels.
+ time_view()->UpdateClockLayout(TrayDate::VERTICAL_CLOCK);
+ EXPECT_FALSE(horizontal_label()->parent());
+ EXPECT_EQ(time_view(), vertical_label_hours()->parent());
+ EXPECT_EQ(time_view(), vertical_label_minutes()->parent());
+
+ // Switching back to horizontal updates the labels again.
+ time_view()->UpdateClockLayout(TrayDate::HORIZONTAL_CLOCK);
+ EXPECT_EQ(time_view(), horizontal_label()->parent());
+ EXPECT_FALSE(vertical_label_hours()->parent());
+ EXPECT_FALSE(vertical_label_minutes()->parent());
+}
+
+} // namespace tray
+} // namespace internal
+} // namespace ash
diff --git a/ash/system/logout_button/logout_button_tray.cc b/ash/system/logout_button/logout_button_tray.cc
index f62921f1a0..c06073040c 100644
--- a/ash/system/logout_button/logout_button_tray.cc
+++ b/ash/system/logout_button/logout_button_tray.cc
@@ -14,7 +14,7 @@
#include "base/logging.h"
#include "grit/ash_resources.h"
#include "third_party/skia/include/core/SkColor.h"
-#include "ui/base/events/event.h"
+#include "ui/events/event.h"
#include "ui/gfx/font.h"
#include "ui/gfx/insets.h"
#include "ui/gfx/size.h"
diff --git a/ash/system/session_length_limit/tray_session_length_limit.cc b/ash/system/session_length_limit/tray_session_length_limit.cc
index 6ca887a6c0..fe8ff7ebc1 100644
--- a/ash/system/session_length_limit/tray_session_length_limit.cc
+++ b/ash/system/session_length_limit/tray_session_length_limit.cc
@@ -201,7 +201,7 @@ void RemainingSessionTimeTrayView::UpdateClockLayout(
0, views::GridLayout::USE_PREF, 0, 0);
columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER,
0, views::GridLayout::USE_PREF, 0, 0);
- layout->AddPaddingRow(0, kTrayLabelItemVerticalPaddingVeriticalAlignment);
+ layout->AddPaddingRow(0, kTrayLabelItemVerticalPaddingVerticalAlignment);
layout->StartRow(0, 0);
layout->AddView(vertical_layout_label_hours_left_);
layout->AddView(vertical_layout_label_hours_right_);
@@ -211,7 +211,7 @@ void RemainingSessionTimeTrayView::UpdateClockLayout(
layout->StartRow(0, 0);
layout->AddView(vertical_layout_label_seconds_left_);
layout->AddView(vertical_layout_label_seconds_right_);
- layout->AddPaddingRow(0, kTrayLabelItemVerticalPaddingVeriticalAlignment);
+ layout->AddPaddingRow(0, kTrayLabelItemVerticalPaddingVerticalAlignment);
}
Update();
}
diff --git a/ash/system/status_area_widget_delegate.cc b/ash/system/status_area_widget_delegate.cc
index 7e15b7e61c..c1c62f3908 100644
--- a/ash/system/status_area_widget_delegate.cc
+++ b/ash/system/status_area_widget_delegate.cc
@@ -89,10 +89,13 @@ void StatusAreaWidgetDelegate::UpdateLayout() {
views::ColumnSet* columns = layout->AddColumnSet(0);
if (alignment_ == SHELF_ALIGNMENT_BOTTOM ||
alignment_ == SHELF_ALIGNMENT_TOP) {
- if (alignment_ == SHELF_ALIGNMENT_TOP)
- layout->SetInsets(kStatusTrayOffsetFromScreenEdge, 0, 0, 0);
- else
- layout->SetInsets(0, 0, kStatusTrayOffsetFromScreenEdge, 0);
+ // Alternate shelf layout insets are all handled by tray_background_view.
+ if (!ash::switches::UseAlternateShelfLayout()) {
+ if (alignment_ == SHELF_ALIGNMENT_TOP)
+ layout->SetInsets(kStatusTrayOffsetFromScreenEdge, 0, 0, 0);
+ else
+ layout->SetInsets(0, 0, kStatusTrayOffsetFromScreenEdge, 0);
+ }
bool is_first_visible_child = true;
for (int c = 0; c < child_count(); ++c) {
views::View* child = child_at(c);
@@ -112,10 +115,12 @@ void StatusAreaWidgetDelegate::UpdateLayout() {
layout->AddView(child);
}
} else {
- if (alignment_ == SHELF_ALIGNMENT_LEFT)
- layout->SetInsets(0, kStatusTrayOffsetFromScreenEdge, 0, 0);
- else
- layout->SetInsets(0, 0, 0, kStatusTrayOffsetFromScreenEdge);
+ if (!ash::switches::UseAlternateShelfLayout()) {
+ if (alignment_ == SHELF_ALIGNMENT_LEFT)
+ layout->SetInsets(0, kStatusTrayOffsetFromScreenEdge, 0, 0);
+ else
+ layout->SetInsets(0, 0, 0, kStatusTrayOffsetFromScreenEdge);
+ }
columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER,
0, /* resize percent */
views::GridLayout::USE_PREF, 0, 0);
diff --git a/ash/system/tray/default_system_tray_delegate.cc b/ash/system/tray/default_system_tray_delegate.cc
new file mode 100644
index 0000000000..f4f52fa6e8
--- /dev/null
+++ b/ash/system/tray/default_system_tray_delegate.cc
@@ -0,0 +1,279 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/system/tray/default_system_tray_delegate.h"
+
+#include <string>
+
+#include "ash/session_state_delegate.h"
+#include "ash/shell.h"
+#include "ash/volume_control_delegate.h"
+#include "base/message_loop/message_loop.h"
+#include "base/time/time.h"
+
+namespace ash {
+
+namespace {
+
+class DefaultVolumnControlDelegate : public VolumeControlDelegate {
+ public:
+ DefaultVolumnControlDelegate() {}
+ virtual ~DefaultVolumnControlDelegate() {}
+
+ virtual bool HandleVolumeMute(const ui::Accelerator& accelerator) OVERRIDE {
+ return true;
+ }
+ virtual bool HandleVolumeDown(const ui::Accelerator& accelerator) OVERRIDE {
+ return true;
+ }
+ virtual bool HandleVolumeUp(const ui::Accelerator& accelerator) OVERRIDE {
+ return true;
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DefaultVolumnControlDelegate);
+};
+
+} // namespace
+
+DefaultSystemTrayDelegate::DefaultSystemTrayDelegate()
+ : bluetooth_enabled_(true),
+ volume_control_delegate_(new DefaultVolumnControlDelegate) {
+}
+
+DefaultSystemTrayDelegate::~DefaultSystemTrayDelegate() {
+}
+
+void DefaultSystemTrayDelegate::Initialize() {
+}
+
+void DefaultSystemTrayDelegate::Shutdown() {
+}
+
+bool DefaultSystemTrayDelegate::GetTrayVisibilityOnStartup() {
+ return true;
+}
+
+user::LoginStatus DefaultSystemTrayDelegate::GetUserLoginStatus() const {
+ return user::LOGGED_IN_USER;
+}
+
+bool DefaultSystemTrayDelegate::IsOobeCompleted() const {
+ return true;
+}
+
+void DefaultSystemTrayDelegate::ChangeProfilePicture() {
+}
+
+const std::string DefaultSystemTrayDelegate::GetEnterpriseDomain() const {
+ return std::string();
+}
+
+const base::string16 DefaultSystemTrayDelegate::GetEnterpriseMessage() const {
+ return string16();
+}
+
+const std::string
+DefaultSystemTrayDelegate::GetLocallyManagedUserManager() const {
+ return std::string();
+}
+
+const base::string16
+DefaultSystemTrayDelegate::GetLocallyManagedUserManagerName()
+ const {
+ return string16();
+}
+
+const base::string16 DefaultSystemTrayDelegate::GetLocallyManagedUserMessage()
+ const {
+ return string16();
+}
+
+bool DefaultSystemTrayDelegate::SystemShouldUpgrade() const {
+ return true;
+}
+
+base::HourClockType DefaultSystemTrayDelegate::GetHourClockType() const {
+ return base::k24HourClock;
+}
+
+void DefaultSystemTrayDelegate::ShowSettings() {
+}
+
+bool DefaultSystemTrayDelegate::ShouldShowSettings() {
+ return true;
+}
+
+void DefaultSystemTrayDelegate::ShowDateSettings() {
+}
+
+void DefaultSystemTrayDelegate::ShowNetworkSettings(
+ const std::string& service_path) {
+}
+
+void DefaultSystemTrayDelegate::ShowBluetoothSettings() {
+}
+
+void DefaultSystemTrayDelegate::ShowDisplaySettings() {
+}
+
+void DefaultSystemTrayDelegate::ShowChromeSlow() {
+}
+
+bool DefaultSystemTrayDelegate::ShouldShowDisplayNotification() {
+ return false;
+}
+
+void DefaultSystemTrayDelegate::ShowDriveSettings() {
+}
+
+void DefaultSystemTrayDelegate::ShowIMESettings() {
+}
+
+void DefaultSystemTrayDelegate::ShowHelp() {
+}
+
+void DefaultSystemTrayDelegate::ShowAccessibilityHelp() {
+}
+
+void DefaultSystemTrayDelegate::ShowAccessibilitySettings() {
+}
+
+void DefaultSystemTrayDelegate::ShowPublicAccountInfo() {
+}
+
+void DefaultSystemTrayDelegate::ShowEnterpriseInfo() {
+}
+
+void DefaultSystemTrayDelegate::ShowLocallyManagedUserInfo() {
+}
+
+void DefaultSystemTrayDelegate::ShowUserLogin() {
+}
+
+void DefaultSystemTrayDelegate::ShutDown() {
+}
+
+void DefaultSystemTrayDelegate::SignOut() {
+}
+
+void DefaultSystemTrayDelegate::RequestLockScreen() {
+}
+
+void DefaultSystemTrayDelegate::RequestRestartForUpdate() {
+}
+
+void DefaultSystemTrayDelegate::GetAvailableBluetoothDevices(
+ BluetoothDeviceList* list) {
+}
+
+void DefaultSystemTrayDelegate::BluetoothStartDiscovering() {
+}
+
+void DefaultSystemTrayDelegate::BluetoothStopDiscovering() {
+}
+
+void DefaultSystemTrayDelegate::ConnectToBluetoothDevice(
+ const std::string& address) {
+}
+
+void DefaultSystemTrayDelegate::GetCurrentIME(IMEInfo* info) {
+}
+
+void DefaultSystemTrayDelegate::GetAvailableIMEList(IMEInfoList* list) {
+}
+
+void DefaultSystemTrayDelegate::GetCurrentIMEProperties(
+ IMEPropertyInfoList* list) {
+}
+
+void DefaultSystemTrayDelegate::SwitchIME(const std::string& ime_id) {
+}
+
+void DefaultSystemTrayDelegate::ActivateIMEProperty(const std::string& key) {
+}
+
+void DefaultSystemTrayDelegate::CancelDriveOperation(int32 operation_id) {
+}
+
+void DefaultSystemTrayDelegate::GetDriveOperationStatusList(
+ ash::DriveOperationStatusList*) {
+}
+
+void DefaultSystemTrayDelegate::ConfigureNetwork(
+ const std::string& network_id) {
+}
+
+void DefaultSystemTrayDelegate::EnrollOrConfigureNetwork(
+ const std::string& network_id,
+ gfx::NativeWindow parent_window) {
+}
+
+void DefaultSystemTrayDelegate::ManageBluetoothDevices() {
+}
+
+void DefaultSystemTrayDelegate::ToggleBluetooth() {
+ bluetooth_enabled_ = !bluetooth_enabled_;
+}
+
+bool DefaultSystemTrayDelegate::IsBluetoothDiscovering() {
+ return false;
+}
+
+void DefaultSystemTrayDelegate::ShowMobileSimDialog() {
+}
+
+void DefaultSystemTrayDelegate::ShowMobileSetupDialog(
+ const std::string& service_path) {
+}
+
+void DefaultSystemTrayDelegate::ShowOtherWifi() {
+}
+
+void DefaultSystemTrayDelegate::ShowOtherVPN() {
+}
+
+void DefaultSystemTrayDelegate::ShowOtherCellular() {
+}
+
+bool DefaultSystemTrayDelegate::GetBluetoothAvailable() {
+ return true;
+}
+
+bool DefaultSystemTrayDelegate::GetBluetoothEnabled() {
+ return bluetooth_enabled_;
+}
+
+void DefaultSystemTrayDelegate::ChangeProxySettings() {
+}
+
+VolumeControlDelegate* DefaultSystemTrayDelegate::GetVolumeControlDelegate()
+ const {
+ return volume_control_delegate_.get();
+}
+
+void DefaultSystemTrayDelegate::SetVolumeControlDelegate(
+ scoped_ptr<VolumeControlDelegate> delegate) {
+ volume_control_delegate_ = delegate.Pass();
+}
+
+bool DefaultSystemTrayDelegate::GetSessionStartTime(
+ base::TimeTicks* session_start_time) {
+ return false;
+}
+
+bool DefaultSystemTrayDelegate::GetSessionLengthLimit(
+ base::TimeDelta* session_length_limit) {
+ return false;
+}
+
+int DefaultSystemTrayDelegate::GetSystemTrayMenuWidth() {
+ // This is the default width for English languages.
+ return 300;
+}
+
+void DefaultSystemTrayDelegate::MaybeSpeak(const std::string& utterance) const {
+}
+
+} // namespace ash
diff --git a/ash/system/tray/test_system_tray_delegate.h b/ash/system/tray/default_system_tray_delegate.h
index cd9affe316..b3edb57ac2 100644
--- a/ash/system/tray/test_system_tray_delegate.h
+++ b/ash/system/tray/default_system_tray_delegate.h
@@ -1,45 +1,26 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_
-#define ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_
+#ifndef ASH_SYSTEM_TRAY_DEFAULT_SYSTEM_TRAY_DELEGATE_H_
+#define ASH_SYSTEM_TRAY_DEFAULT_SYSTEM_TRAY_DELEGATE_H_
#include "ash/ash_export.h"
#include "ash/system/tray/system_tray_delegate.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
-// TODO(oshima/stevenjb): Move this to ash/test. crbug.com/159693.
-
namespace ash {
-namespace test {
-class ASH_EXPORT TestSystemTrayDelegate : public SystemTrayDelegate {
+class ASH_EXPORT DefaultSystemTrayDelegate : public SystemTrayDelegate {
public:
- // Changes the login status when initially the delegate is created. This will
- // be called before AshTestBase::SetUp() to test the case when chrome is
- // restarted right after the login (such like a flag is set).
- // This value will be reset in AshTestHelper::TearDown, most test fixtures
- // don't need to care its lifecycle.
- static void SetInitialLoginStatus(user::LoginStatus login_status);
-
- TestSystemTrayDelegate();
-
- virtual ~TestSystemTrayDelegate();
-
- // Changes the current login status in the test. This also invokes
- // UpdateAfterLoginStatusChange(). Usually this is called in the test code to
- // set up a login status. This will fit to most of the test cases, but this
- // cannot be set during the initialization. To test the initialization,
- // consider using SetInitialLoginStatus() instead.
- void SetLoginStatus(user::LoginStatus login_status);
+ DefaultSystemTrayDelegate();
+ virtual ~DefaultSystemTrayDelegate();
+ // Overridden from SystemTrayDelegate:
virtual void Initialize() OVERRIDE;
virtual void Shutdown() OVERRIDE;
virtual bool GetTrayVisibilityOnStartup() OVERRIDE;
-
- // Overridden from SystemTrayDelegate:
virtual user::LoginStatus GetUserLoginStatus() const OVERRIDE;
virtual bool IsOobeCompleted() const OVERRIDE;
virtual void ChangeProfilePicture() OVERRIDE;
@@ -109,21 +90,13 @@ class ASH_EXPORT TestSystemTrayDelegate : public SystemTrayDelegate {
virtual int GetSystemTrayMenuWidth() OVERRIDE;
virtual void MaybeSpeak(const std::string& utterance) const OVERRIDE;
- void set_should_show_display_notification(bool should_show) {
- should_show_display_notification_ = should_show;
- }
-
private:
bool bluetooth_enabled_;
- bool caps_lock_enabled_;
- bool should_show_display_notification_;
- user::LoginStatus login_status_;
scoped_ptr<VolumeControlDelegate> volume_control_delegate_;
- DISALLOW_COPY_AND_ASSIGN(TestSystemTrayDelegate);
+ DISALLOW_COPY_AND_ASSIGN(DefaultSystemTrayDelegate);
};
-} // namespace test
} // namespace ash
-#endif // ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_
+#endif // ASH_SYSTEM_TRAY_DEFAULT_SYSTEM_TRAY_DELEGATE_H_
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc
index e07a2d63f0..6cb4d72671 100644
--- a/ash/system/tray/system_tray.cc
+++ b/ash/system/tray/system_tray.cc
@@ -34,9 +34,9 @@
#include "base/timer/timer.h"
#include "grit/ash_strings.h"
#include "ui/aura/root_window.h"
-#include "ui/base/events/event_constants.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/compositor/layer.h"
+#include "ui/events/event_constants.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/screen.h"
#include "ui/gfx/skia_util.h"
@@ -587,6 +587,10 @@ base::string16 SystemTray::GetAccessibleNameForTray() {
return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME);
}
+void SystemTray::BubbleResized(const TrayBubbleView* bubble_view) {
+ UpdateWebNotifications();
+}
+
void SystemTray::HideBubbleWithView(const TrayBubbleView* bubble_view) {
if (system_bubble_.get() && bubble_view == system_bubble_->bubble_view()) {
DestroySystemBubble();
diff --git a/ash/system/tray/system_tray.h b/ash/system/tray/system_tray.h
index f6b47fee65..8656f8b27d 100644
--- a/ash/system/tray/system_tray.h
+++ b/ash/system/tray/system_tray.h
@@ -138,6 +138,7 @@ class ASH_EXPORT SystemTray : public internal::TrayBackgroundView,
virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE;
virtual void AnchorUpdated() OVERRIDE;
virtual base::string16 GetAccessibleNameForTray() OVERRIDE;
+ virtual void BubbleResized(const views::TrayBubbleView* bubble_view) OVERRIDE;
virtual void HideBubbleWithView(
const views::TrayBubbleView* bubble_view) OVERRIDE;
virtual bool ClickedOutsideBubble() OVERRIDE;
diff --git a/ash/system/tray/system_tray_bubble.cc b/ash/system/tray/system_tray_bubble.cc
index eff1ffd84e..3477c3c836 100644
--- a/ash/system/tray/system_tray_bubble.cc
+++ b/ash/system/tray/system_tray_bubble.cc
@@ -171,7 +171,7 @@ void SystemTrayBubble::UpdateView(
settings.AddObserver(
new AnimationObserverDeleteLayer(scoped_layer.release()));
settings.SetTransitionDuration(swipe_duration);
- settings.SetTweenType(ui::Tween::EASE_OUT);
+ settings.SetTweenType(gfx::Tween::EASE_OUT);
gfx::Transform transform;
transform.Translate(layer->bounds().width(), 0.0);
layer->SetTransform(transform);
@@ -196,7 +196,7 @@ void SystemTrayBubble::UpdateView(
settings.AddObserver(new AnimationObserverDeleteLayer(shadow));
settings.SetTransitionDuration(swipe_duration +
base::TimeDelta::FromMilliseconds(150));
- settings.SetTweenType(ui::Tween::LINEAR);
+ settings.SetTweenType(gfx::Tween::LINEAR);
shadow->SetOpacity(0.15f);
}
}
@@ -242,7 +242,7 @@ void SystemTrayBubble::UpdateView(
new AnimationObserverDeleteLayer(scoped_layer.release()));
settings.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kSwipeDelayMS));
- settings.SetTweenType(ui::Tween::EASE_OUT);
+ settings.SetTweenType(gfx::Tween::EASE_OUT);
new_layer->SetTransform(gfx::Transform());
}
}
diff --git a/ash/system/tray/system_tray_delegate.cc b/ash/system/tray/system_tray_delegate.cc
index f31e3144af..084e158766 100644
--- a/ash/system/tray/system_tray_delegate.cc
+++ b/ash/system/tray/system_tray_delegate.cc
@@ -4,8 +4,6 @@
#include "ash/system/tray/system_tray_delegate.h"
-#include "ash/system/tray/test_system_tray_delegate.h"
-
namespace ash {
NetworkIconInfo::NetworkIconInfo()
@@ -52,11 +50,4 @@ IMEPropertyInfo::IMEPropertyInfo()
IMEPropertyInfo::~IMEPropertyInfo() {
}
-// TODO(stevenjb/oshima): Remove this once Shell::delegate_ is guaranteed
-// to not be NULL and move TestSystemTrayDelegate -> ash/test. crbug.com/159693
-// static
-SystemTrayDelegate* SystemTrayDelegate::CreateDummyDelegate() {
- return new test::TestSystemTrayDelegate;
-}
-
} // namespace ash
diff --git a/ash/system/tray/system_tray_delegate.h b/ash/system/tray/system_tray_delegate.h
index 8b4356297a..eac4e6b159 100644
--- a/ash/system/tray/system_tray_delegate.h
+++ b/ash/system/tray/system_tray_delegate.h
@@ -313,9 +313,6 @@ class ASH_EXPORT SystemTrayDelegate {
// Speaks the given text if spoken feedback is enabled.
virtual void MaybeSpeak(const std::string& utterance) const = 0;
-
- // Creates a dummy delegate for testing.
- static SystemTrayDelegate* CreateDummyDelegate();
};
} // namespace ash
diff --git a/ash/system/tray/system_tray_unittest.cc b/ash/system/tray/system_tray_unittest.cc
index 6d0b4d9e82..2a2bfee3c0 100644
--- a/ash/system/tray/system_tray_unittest.cc
+++ b/ash/system/tray/system_tray_unittest.cc
@@ -7,6 +7,7 @@
#include <vector>
#include "ash/root_window_controller.h"
+#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/system/status_area_widget.h"
@@ -27,8 +28,6 @@ namespace test {
namespace {
-const int kStatusTrayOffsetFromScreenEdgeForTest = 4;
-
SystemTray* GetSystemTray() {
return Shell::GetPrimaryRootWindowController()->shelf()->
status_area_widget()->system_tray();
@@ -295,44 +294,41 @@ TEST_F(SystemTrayTest, BubbleCreationTypesTest) {
EXPECT_EQ(widget, test_item->default_view()->GetWidget());
}
-// Tests that the tray is laid out properly in the widget to make sure that the
-// tray extends to the correct edge of the screen.
+// Tests that the tray is laid out properly and is fully contained within
+// the shelf.
TEST_F(SystemTrayTest, TrayBoundsInWidget) {
+ internal::ShelfLayoutManager* manager =
+ Shell::GetPrimaryRootWindowController()->shelf()->shelf_layout_manager();
internal::StatusAreaWidget* widget =
Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget();
SystemTray* tray = widget->system_tray();
- // Test in bottom alignment. Bottom and right edges of the view should be
- // aligned with the widget.
- widget->SetShelfAlignment(SHELF_ALIGNMENT_BOTTOM);
+ // Test in bottom alignment.
+ manager->SetAlignment(SHELF_ALIGNMENT_BOTTOM);
gfx::Rect window_bounds = widget->GetWindowBoundsInScreen();
gfx::Rect tray_bounds = tray->GetBoundsInScreen();
- EXPECT_EQ(window_bounds.bottom(),
- tray_bounds.bottom() + kStatusTrayOffsetFromScreenEdgeForTest);
- EXPECT_EQ(window_bounds.right(), tray_bounds.right());
-
- // Test in the top alignment. Top and right edges should match.
- widget->SetShelfAlignment(SHELF_ALIGNMENT_TOP);
- window_bounds = widget->GetWindowBoundsInScreen();
- tray_bounds = tray->GetBoundsInScreen();
- EXPECT_EQ(window_bounds.y(),
- tray_bounds.y() - kStatusTrayOffsetFromScreenEdgeForTest);
- EXPECT_EQ(window_bounds.right(), tray_bounds.right());
+ EXPECT_TRUE(window_bounds.bottom() >= tray_bounds.bottom());
+ EXPECT_TRUE(window_bounds.right() >= tray_bounds.right());
+ EXPECT_TRUE(window_bounds.x() >= tray_bounds.x());
+ EXPECT_TRUE(window_bounds.y() >= tray_bounds.y());
- // Test in the left alignment. Left and bottom edges should match.
- widget->SetShelfAlignment(SHELF_ALIGNMENT_LEFT);
+ // Test in the left alignment.
+ manager->SetAlignment(SHELF_ALIGNMENT_LEFT);
window_bounds = widget->GetWindowBoundsInScreen();
tray_bounds = tray->GetBoundsInScreen();
- EXPECT_EQ(window_bounds.bottom(), tray_bounds.bottom());
- EXPECT_EQ(window_bounds.x(),
- tray_bounds.x() - kStatusTrayOffsetFromScreenEdgeForTest);
+ EXPECT_TRUE(window_bounds.bottom() >= tray_bounds.bottom());
+ EXPECT_TRUE(window_bounds.right() >= tray_bounds.right());
+ EXPECT_TRUE(window_bounds.x() >= tray_bounds.x());
+ EXPECT_TRUE(window_bounds.y() >= tray_bounds.y());
- // Test in the right alignment. Right and bottom edges should match.
- widget->SetShelfAlignment(SHELF_ALIGNMENT_LEFT);
+ // Test in the right alignment.
+ manager->SetAlignment(SHELF_ALIGNMENT_LEFT);
window_bounds = widget->GetWindowBoundsInScreen();
tray_bounds = tray->GetBoundsInScreen();
- EXPECT_EQ(window_bounds.bottom(), tray_bounds.bottom());
- EXPECT_EQ(window_bounds.right(), tray_bounds.right());
+ EXPECT_TRUE(window_bounds.bottom() >= tray_bounds.bottom());
+ EXPECT_TRUE(window_bounds.right() >= tray_bounds.right());
+ EXPECT_TRUE(window_bounds.x() >= tray_bounds.x());
+ EXPECT_TRUE(window_bounds.y() >= tray_bounds.y());
}
} // namespace test
diff --git a/ash/system/tray/test_system_tray_delegate.cc b/ash/system/tray/test_system_tray_delegate.cc
deleted file mode 100644
index 87ac92c36a..0000000000
--- a/ash/system/tray/test_system_tray_delegate.cc
+++ /dev/null
@@ -1,312 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ash/system/tray/test_system_tray_delegate.h"
-
-#include <string>
-
-#include "ash/session_state_delegate.h"
-#include "ash/shell.h"
-#include "ash/volume_control_delegate.h"
-#include "base/message_loop/message_loop.h"
-#include "base/time/time.h"
-
-namespace ash {
-namespace test {
-
-namespace {
-
-user::LoginStatus g_initial_status = user::LOGGED_IN_USER;
-
-class TestVolumeControlDelegate : public VolumeControlDelegate {
- public:
- TestVolumeControlDelegate() {}
- virtual ~TestVolumeControlDelegate() {}
-
- virtual bool HandleVolumeMute(const ui::Accelerator& accelerator) OVERRIDE {
- return true;
- }
- virtual bool HandleVolumeDown(const ui::Accelerator& accelerator) OVERRIDE {
- return true;
- }
- virtual bool HandleVolumeUp(const ui::Accelerator& accelerator) OVERRIDE {
- return true;
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TestVolumeControlDelegate);
-};
-
-} // namespace
-
-// static
-void TestSystemTrayDelegate::SetInitialLoginStatus(
- user::LoginStatus login_status) {
- g_initial_status = login_status;
-}
-
-TestSystemTrayDelegate::TestSystemTrayDelegate()
- : bluetooth_enabled_(true),
- caps_lock_enabled_(false),
- should_show_display_notification_(false),
- login_status_(g_initial_status),
- volume_control_delegate_(new TestVolumeControlDelegate) {
-}
-
-TestSystemTrayDelegate::~TestSystemTrayDelegate() {
-}
-
-void TestSystemTrayDelegate::SetLoginStatus(user::LoginStatus login_status) {
- login_status_ = login_status;
- Shell::GetInstance()->UpdateAfterLoginStatusChange(login_status);
-}
-
-void TestSystemTrayDelegate::Initialize() {
-}
-
-void TestSystemTrayDelegate::Shutdown() {
-}
-
-bool TestSystemTrayDelegate::GetTrayVisibilityOnStartup() {
- return true;
-}
-
-// Overridden from SystemTrayDelegate:
-user::LoginStatus TestSystemTrayDelegate::GetUserLoginStatus() const {
- // Initial login status has been changed for testing.
- if (g_initial_status != user::LOGGED_IN_USER &&
- g_initial_status == login_status_) {
- return login_status_;
- }
-
- // At new user image screen manager->IsUserLoggedIn() would return true
- // but there's no browser session available yet so use SessionStarted().
- SessionStateDelegate* delegate =
- Shell::GetInstance()->session_state_delegate();
-
- if (!delegate->IsActiveUserSessionStarted())
- return ash::user::LOGGED_IN_NONE;
- if (delegate->IsScreenLocked())
- return user::LOGGED_IN_LOCKED;
- return login_status_;
-}
-
-bool TestSystemTrayDelegate::IsOobeCompleted() const {
- return true;
-}
-
-void TestSystemTrayDelegate::ChangeProfilePicture() {
-}
-
-const std::string TestSystemTrayDelegate::GetEnterpriseDomain() const {
- return std::string();
-}
-
-const base::string16 TestSystemTrayDelegate::GetEnterpriseMessage() const {
- return string16();
-}
-
-const std::string TestSystemTrayDelegate::GetLocallyManagedUserManager() const {
- return std::string();
-}
-
-const base::string16 TestSystemTrayDelegate::GetLocallyManagedUserManagerName()
- const {
- return string16();
-}
-
-const base::string16 TestSystemTrayDelegate::GetLocallyManagedUserMessage()
- const {
- return string16();
-}
-
-bool TestSystemTrayDelegate::SystemShouldUpgrade() const {
- return true;
-}
-
-base::HourClockType TestSystemTrayDelegate::GetHourClockType() const {
- return base::k24HourClock;
-}
-
-void TestSystemTrayDelegate::ShowSettings() {
-}
-
-bool TestSystemTrayDelegate::ShouldShowSettings() {
- return true;
-}
-
-void TestSystemTrayDelegate::ShowDateSettings() {
-}
-
-void TestSystemTrayDelegate::ShowNetworkSettings(
- const std::string& service_path) {
-}
-
-void TestSystemTrayDelegate::ShowBluetoothSettings() {
-}
-
-void TestSystemTrayDelegate::ShowDisplaySettings() {
-}
-
-void TestSystemTrayDelegate::ShowChromeSlow() {
-}
-
-bool TestSystemTrayDelegate::ShouldShowDisplayNotification() {
- return should_show_display_notification_;
-}
-
-void TestSystemTrayDelegate::ShowDriveSettings() {
-}
-
-void TestSystemTrayDelegate::ShowIMESettings() {
-}
-
-void TestSystemTrayDelegate::ShowHelp() {
-}
-
-void TestSystemTrayDelegate::ShowAccessibilityHelp() {
-}
-
-void TestSystemTrayDelegate::ShowAccessibilitySettings() {
-}
-
-void TestSystemTrayDelegate::ShowPublicAccountInfo() {
-}
-
-void TestSystemTrayDelegate::ShowEnterpriseInfo() {
-}
-
-void TestSystemTrayDelegate::ShowLocallyManagedUserInfo() {
-}
-
-void TestSystemTrayDelegate::ShowUserLogin() {
-}
-
-void TestSystemTrayDelegate::ShutDown() {
- base::MessageLoop::current()->Quit();
-}
-
-void TestSystemTrayDelegate::SignOut() {
- base::MessageLoop::current()->Quit();
-}
-
-void TestSystemTrayDelegate::RequestLockScreen() {
-}
-
-void TestSystemTrayDelegate::RequestRestartForUpdate() {
-}
-
-void TestSystemTrayDelegate::GetAvailableBluetoothDevices(
- BluetoothDeviceList* list) {
-}
-
-void TestSystemTrayDelegate::BluetoothStartDiscovering() {
-}
-
-void TestSystemTrayDelegate::BluetoothStopDiscovering() {
-}
-
-void TestSystemTrayDelegate::ConnectToBluetoothDevice(
- const std::string& address) {
-}
-
-void TestSystemTrayDelegate::GetCurrentIME(IMEInfo* info) {
-}
-
-void TestSystemTrayDelegate::GetAvailableIMEList(IMEInfoList* list) {
-}
-
-void TestSystemTrayDelegate::GetCurrentIMEProperties(
- IMEPropertyInfoList* list) {
-}
-
-void TestSystemTrayDelegate::SwitchIME(const std::string& ime_id) {
-}
-
-void TestSystemTrayDelegate::ActivateIMEProperty(const std::string& key) {
-}
-
-void TestSystemTrayDelegate::CancelDriveOperation(int32 operation_id) {
-}
-
-void TestSystemTrayDelegate::GetDriveOperationStatusList(
- ash::DriveOperationStatusList*) {
-}
-
-void TestSystemTrayDelegate::ConfigureNetwork(const std::string& network_id) {
-}
-
-void TestSystemTrayDelegate::EnrollOrConfigureNetwork(
- const std::string& network_id,
- gfx::NativeWindow parent_window) {
-}
-
-void TestSystemTrayDelegate::ManageBluetoothDevices() {
-}
-
-void TestSystemTrayDelegate::ToggleBluetooth() {
- bluetooth_enabled_ = !bluetooth_enabled_;
-}
-
-bool TestSystemTrayDelegate::IsBluetoothDiscovering() {
- return false;
-}
-
-void TestSystemTrayDelegate::ShowMobileSimDialog() {
-}
-
-void TestSystemTrayDelegate::ShowMobileSetupDialog(
- const std::string& service_path) {
-}
-
-void TestSystemTrayDelegate::ShowOtherWifi() {
-}
-
-void TestSystemTrayDelegate::ShowOtherVPN() {
-}
-
-void TestSystemTrayDelegate::ShowOtherCellular() {
-}
-
-bool TestSystemTrayDelegate::GetBluetoothAvailable() {
- return true;
-}
-
-bool TestSystemTrayDelegate::GetBluetoothEnabled() {
- return bluetooth_enabled_;
-}
-
-void TestSystemTrayDelegate::ChangeProxySettings() {
-}
-
-VolumeControlDelegate* TestSystemTrayDelegate::GetVolumeControlDelegate()
- const {
- return volume_control_delegate_.get();
-}
-
-void TestSystemTrayDelegate::SetVolumeControlDelegate(
- scoped_ptr<VolumeControlDelegate> delegate) {
- volume_control_delegate_ = delegate.Pass();
-}
-
-bool TestSystemTrayDelegate::GetSessionStartTime(
- base::TimeTicks* session_start_time) {
- return false;
-}
-
-bool TestSystemTrayDelegate::GetSessionLengthLimit(
- base::TimeDelta* session_length_limit) {
- return false;
-}
-
-int TestSystemTrayDelegate::GetSystemTrayMenuWidth() {
- // This is the default width for English languages.
- return 300;
-}
-
-void TestSystemTrayDelegate::MaybeSpeak(const std::string& utterance) const {
-}
-
-} // namespace test
-} // namespace ash
diff --git a/ash/system/tray/tray_background_view.cc b/ash/system/tray/tray_background_view.cc
index d979b1ad4f..130768eb41 100644
--- a/ash/system/tray/tray_background_view.cc
+++ b/ash/system/tray/tray_background_view.cc
@@ -443,41 +443,57 @@ void TrayBackgroundView::SetShelfAlignment(ShelfAlignment alignment) {
void TrayBackgroundView::SetBorder() {
views::View* parent = status_area_widget_->status_area_widget_delegate();
-
+ // Tray views are laid out right-to-left or bottom-to-top
+ bool on_edge = (this == parent->child_at(0));
+ int left_edge, top_edge, right_edge, bottom_edge;
if (ash::switches::UseAlternateShelfLayout()) {
- set_border(views::Border::CreateEmptyBorder(
- 0,
- 0,
- ShelfLayoutManager::kAutoHideSize,
- 0));
+ if (shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) {
+ top_edge = ShelfLayoutManager::kShelfItemInset;
+ left_edge = 0;
+ bottom_edge = ShelfLayoutManager::GetPreferredShelfSize() -
+ ShelfLayoutManager::kShelfItemInset - GetShelfItemHeight();
+ right_edge = on_edge ? kPaddingFromEdgeOfShelf : 0;
+ } else if (shelf_alignment() == SHELF_ALIGNMENT_LEFT) {
+ top_edge = 0;
+ left_edge = ShelfLayoutManager::GetPreferredShelfSize() -
+ ShelfLayoutManager::kShelfItemInset - GetShelfItemHeight();
+ bottom_edge = on_edge ? kPaddingFromEdgeOfShelf : 0;
+ right_edge = ShelfLayoutManager::kShelfItemInset;
+ } else { // SHELF_ALIGNMENT_RIGHT
+ top_edge = 0;
+ left_edge = ShelfLayoutManager::kShelfItemInset;
+ bottom_edge = on_edge ? kPaddingFromEdgeOfShelf : 0;
+ right_edge = ShelfLayoutManager::GetPreferredShelfSize() -
+ ShelfLayoutManager::kShelfItemInset - GetShelfItemHeight();
+ }
} else {
- // Tray views are laid out right-to-left or bottom-to-top
- int on_edge = (this == parent->child_at(0));
// Change the border padding for different shelf alignment.
if (shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) {
- set_border(views::Border::CreateEmptyBorder(
- 0, 0,
- on_edge ? kPaddingFromBottomOfScreenBottomAlignment :
- kPaddingFromBottomOfScreenBottomAlignment - 1,
- on_edge ? kPaddingFromRightEdgeOfScreenBottomAlignment : 0));
+ top_edge = 0;
+ left_edge = 0;
+ bottom_edge = on_edge ? kPaddingFromBottomOfScreenBottomAlignment :
+ kPaddingFromBottomOfScreenBottomAlignment - 1;
+ right_edge = on_edge ? kPaddingFromRightEdgeOfScreenBottomAlignment : 0;
} else if (shelf_alignment() == SHELF_ALIGNMENT_TOP) {
- set_border(views::Border::CreateEmptyBorder(
- on_edge ? kPaddingFromBottomOfScreenBottomAlignment :
- kPaddingFromBottomOfScreenBottomAlignment - 1,
- 0, 0,
- on_edge ? kPaddingFromRightEdgeOfScreenBottomAlignment : 0));
+ top_edge = on_edge ? kPaddingFromBottomOfScreenBottomAlignment :
+ kPaddingFromBottomOfScreenBottomAlignment - 1;
+ left_edge = 0;
+ bottom_edge = 0;
+ right_edge = on_edge ? kPaddingFromRightEdgeOfScreenBottomAlignment : 0;
} else if (shelf_alignment() == SHELF_ALIGNMENT_LEFT) {
- set_border(views::Border::CreateEmptyBorder(
- 0, kPaddingFromOuterEdgeOfLauncherVerticalAlignment,
- on_edge ? kPaddingFromBottomOfScreenVerticalAlignment : 0,
- kPaddingFromInnerEdgeOfLauncherVerticalAlignment));
+ top_edge = 0;
+ left_edge = kPaddingFromOuterEdgeOfLauncherVerticalAlignment;
+ bottom_edge = on_edge ? kPaddingFromBottomOfScreenVerticalAlignment : 0;
+ right_edge = kPaddingFromInnerEdgeOfLauncherVerticalAlignment;
} else {
- set_border(views::Border::CreateEmptyBorder(
- 0, kPaddingFromInnerEdgeOfLauncherVerticalAlignment,
- on_edge ? kPaddingFromBottomOfScreenVerticalAlignment : 0,
- kPaddingFromOuterEdgeOfLauncherVerticalAlignment));
+ top_edge = 0;
+ left_edge = kPaddingFromInnerEdgeOfLauncherVerticalAlignment;
+ bottom_edge = on_edge ? kPaddingFromBottomOfScreenVerticalAlignment : 0;
+ right_edge = kPaddingFromOuterEdgeOfLauncherVerticalAlignment;
}
}
+ set_border(views::Border::CreateEmptyBorder(
+ top_edge, left_edge, bottom_edge, right_edge));
}
void TrayBackgroundView::InitializeBubbleAnimations(
@@ -509,31 +525,50 @@ gfx::Rect TrayBackgroundView::GetBubbleAnchorRect(
if (anchor_type == TrayBubbleView::ANCHOR_TYPE_TRAY) {
if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_BOTTOM) {
bool rtl = base::i18n::IsRTL();
- rect.Inset(
- rtl ? kPaddingFromRightEdgeOfScreenBottomAlignment : 0,
- kTrayBubbleAnchorTopInsetBottomAnchor,
- rtl ? 0 : kPaddingFromRightEdgeOfScreenBottomAlignment,
- kPaddingFromBottomOfScreenBottomAlignment);
+ if (!ash::switches::UseAlternateShelfLayout()) {
+ rect.Inset(
+ rtl ? kPaddingFromRightEdgeOfScreenBottomAlignment : 0,
+ kTrayBubbleAnchorTopInsetBottomAnchor,
+ rtl ? 0 : kPaddingFromRightEdgeOfScreenBottomAlignment,
+ kPaddingFromBottomOfScreenBottomAlignment);
+ } else {
+ rect.Inset(
+ rtl ? kAlternateLayoutBubblePaddingHorizontalSide : 0,
+ kAlternateLayoutBubblePaddingHorizontalBottom,
+ rtl ? 0 : kAlternateLayoutBubblePaddingHorizontalSide,
+ 0);
+ }
} else if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_LEFT) {
- rect.Inset(0, 0, kPaddingFromInnerEdgeOfLauncherVerticalAlignment + 5,
- kPaddingFromBottomOfScreenVerticalAlignment);
+ if (!ash::switches::UseAlternateShelfLayout()) {
+ rect.Inset(0, 0, kPaddingFromInnerEdgeOfLauncherVerticalAlignment + 5,
+ kPaddingFromBottomOfScreenVerticalAlignment);
+ } else {
+ rect.Inset(0, 0, kAlternateLayoutBubblePaddingVerticalSide + 4,
+ kAlternateLayoutBubblePaddingVerticalBottom);
+ }
} else {
- rect.Inset(kPaddingFromInnerEdgeOfLauncherVerticalAlignment + 1,
- 0, 0, kPaddingFromBottomOfScreenVerticalAlignment);
+ if (!ash::switches::UseAlternateShelfLayout()) {
+ rect.Inset(kPaddingFromInnerEdgeOfLauncherVerticalAlignment + 1,
+ 0, 0, kPaddingFromBottomOfScreenVerticalAlignment);
+ } else {
+ rect.Inset(kAlternateLayoutBubblePaddingVerticalSide, 0, 0,
+ kAlternateLayoutBubblePaddingVerticalBottom);
+ }
}
} else if (anchor_type == TrayBubbleView::ANCHOR_TYPE_BUBBLE) {
// Invert the offsets to align with the bubble below.
// Note that with the alternate shelf layout the tips are not shown and
// the offsets for left and right alignment do not need to be applied.
int vertical_alignment = ash::switches::UseAlternateShelfLayout() ?
- 0 : kPaddingFromInnerEdgeOfLauncherVerticalAlignment;
- if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_LEFT) {
- rect.Inset(vertical_alignment,
- 0, 0, kPaddingFromBottomOfScreenVerticalAlignment);
- } else if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_RIGHT) {
- rect.Inset(0, 0, vertical_alignment,
- kPaddingFromBottomOfScreenVerticalAlignment);
- }
+ 0 :
+ kPaddingFromInnerEdgeOfLauncherVerticalAlignment;
+ int horizontal_alignment = ash::switches::UseAlternateShelfLayout() ?
+ kAlternateLayoutBubblePaddingVerticalBottom :
+ kPaddingFromBottomOfScreenVerticalAlignment;
+ if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_LEFT)
+ rect.Inset(vertical_alignment, 0, 0, horizontal_alignment);
+ else if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_RIGHT)
+ rect.Inset(0, 0, vertical_alignment, horizontal_alignment);
}
}
diff --git a/ash/system/tray/tray_background_view.h b/ash/system/tray/tray_background_view.h
index 7b294954b1..b459684429 100644
--- a/ash/system/tray/tray_background_view.h
+++ b/ash/system/tray/tray_background_view.h
@@ -89,6 +89,9 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView,
// Called from GetAccessibleState, must return a valid accessible name.
virtual base::string16 GetAccessibleNameForTray() = 0;
+ // Called when the bubble is resized.
+ virtual void BubbleResized(const views::TrayBubbleView* bubble_view) {}
+
// Hides the bubble associated with |bubble_view|. Called when the widget
// is closed.
virtual void HideBubbleWithView(const views::TrayBubbleView* bubble_view) = 0;
diff --git a/ash/system/tray/tray_bubble_wrapper.cc b/ash/system/tray/tray_bubble_wrapper.cc
index 5d641ee919..c5738e5dde 100644
--- a/ash/system/tray/tray_bubble_wrapper.cc
+++ b/ash/system/tray/tray_bubble_wrapper.cc
@@ -53,5 +53,11 @@ void TrayBubbleWrapper::OnWidgetDestroying(views::Widget* widget) {
tray_->HideBubbleWithView(bubble_view_); // May destroy |bubble_view_|
}
+void TrayBubbleWrapper::OnWidgetBoundsChanged(views::Widget* widget,
+ const gfx::Rect& new_bounds) {
+ DCHECK_EQ(bubble_widget_, widget);
+ tray_->BubbleResized(bubble_view_);
+}
+
} // namespace internal
} // namespace ash
diff --git a/ash/system/tray/tray_bubble_wrapper.h b/ash/system/tray/tray_bubble_wrapper.h
index baa5416473..9ce443a8b3 100644
--- a/ash/system/tray/tray_bubble_wrapper.h
+++ b/ash/system/tray/tray_bubble_wrapper.h
@@ -29,6 +29,8 @@ class TrayBubbleWrapper : public views::WidgetObserver {
// views::WidgetObserver overrides:
virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
+ virtual void OnWidgetBoundsChanged(views::Widget* widget,
+ const gfx::Rect& new_bounds) OVERRIDE;
const TrayBackgroundView* tray() const { return tray_; }
TrayBackgroundView* tray() { return tray_; }
diff --git a/ash/system/tray/tray_constants.cc b/ash/system/tray/tray_constants.cc
index 5ce1f0ef41..db769ef667 100644
--- a/ash/system/tray/tray_constants.cc
+++ b/ash/system/tray/tray_constants.cc
@@ -15,7 +15,12 @@ const int kPaddingFromOuterEdgeOfLauncherVerticalAlignment = 8;
const int kPaddingFromInnerEdgeOfLauncherVerticalAlignment = 9;
const int kPaddingFromBottomOfScreenVerticalAlignment = 10;
-// Inset between the edge of the shelf region and the status tray.
+// Padding used to position the system menu relative to the status area.
+const int kAlternateLayoutBubblePaddingHorizontalBottom = 6;
+const int kAlternateLayoutBubblePaddingHorizontalSide = 10;
+const int kAlternateLayoutBubblePaddingVerticalBottom = 3;
+const int kAlternateLayoutBubblePaddingVerticalSide = 15;
+
const int kPaddingFromEdgeOfShelf = 3;
// Top inset of system tray bubble for bottom anchor alignment.
@@ -26,7 +31,9 @@ const int kTrayImageItemHorizontalPaddingVerticalAlignment = 1;
const int kTrayImageItemVerticalPaddingVerticalAlignment = 1;
const int kTrayLabelItemHorizontalPaddingBottomAlignment = 7;
-const int kTrayLabelItemVerticalPaddingVeriticalAlignment = 4;
+
+// Vertical padding between status tray items when the shelf is vertical.
+const int kTrayLabelItemVerticalPaddingVerticalAlignment = 4;
const int kTrayMenuBottomRowPadding = 5;
const int kTrayMenuBottomRowPaddingBetweenItems = -1;
diff --git a/ash/system/tray/tray_constants.h b/ash/system/tray/tray_constants.h
index 1645f73362..d5187f38fa 100644
--- a/ash/system/tray/tray_constants.h
+++ b/ash/system/tray/tray_constants.h
@@ -15,8 +15,12 @@ extern const int kPaddingFromOuterEdgeOfLauncherVerticalAlignment;
extern const int kPaddingFromInnerEdgeOfLauncherVerticalAlignment;
extern const int kPaddingFromBottomOfScreenVerticalAlignment;
-extern const int kPaddingFromEdgeOfShelf;
+extern const int kAlternateLayoutBubblePaddingHorizontalBottom;
+extern const int kAlternateLayoutBubblePaddingHorizontalSide;
+extern const int kAlternateLayoutBubblePaddingVerticalBottom;
+extern const int kAlternateLayoutBubblePaddingVerticalSide;
+extern const int kPaddingFromEdgeOfShelf;
extern const int kTrayBubbleAnchorTopInsetBottomAnchor;
extern const int kTrayImageItemHorizontalPaddingBottomAlignment;
@@ -24,7 +28,7 @@ extern const int kTrayImageItemHorizontalPaddingVerticalAlignment;
extern const int kTrayImageItemVerticalPaddingVerticalAlignment;
extern const int kTrayLabelItemHorizontalPaddingBottomAlignment;
-extern const int kTrayLabelItemVerticalPaddingVeriticalAlignment;
+extern const int kTrayLabelItemVerticalPaddingVerticalAlignment;
extern const int kTrayMenuBottomRowPadding;
extern const int kTrayMenuBottomRowPaddingBetweenItems;
diff --git a/ash/system/tray/tray_event_filter.h b/ash/system/tray/tray_event_filter.h
index 5ee8e27540..40593155c2 100644
--- a/ash/system/tray/tray_event_filter.h
+++ b/ash/system/tray/tray_event_filter.h
@@ -8,8 +8,8 @@
#include <set>
#include "base/basictypes.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event.h"
+#include "ui/events/event_handler.h"
namespace aura {
class Window;
diff --git a/ash/system/tray/tray_item_view.cc b/ash/system/tray/tray_item_view.cc
index f95ceb9357..da8051b77b 100644
--- a/ash/system/tray/tray_item_view.cc
+++ b/ash/system/tray/tray_item_view.cc
@@ -7,8 +7,8 @@
#include "ash/shelf/shelf_types.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_item.h"
-#include "ui/base/animation/slide_animation.h"
#include "ui/compositor/layer.h"
+#include "ui/gfx/animation/slide_animation.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h"
@@ -60,9 +60,9 @@ void TrayItemView::SetVisible(bool set_visible) {
}
if (!animation_) {
- animation_.reset(new ui::SlideAnimation(this));
+ animation_.reset(new gfx::SlideAnimation(this));
animation_->SetSlideDuration(GetAnimationDurationMS());
- animation_->SetTweenType(ui::Tween::LINEAR);
+ animation_->SetTweenType(gfx::Tween::LINEAR);
animation_->Reset(visible() ? 1.0 : 0.0);
}
@@ -106,7 +106,7 @@ void TrayItemView::ChildPreferredSizeChanged(views::View* child) {
PreferredSizeChanged();
}
-void TrayItemView::AnimationProgressed(const ui::Animation* animation) {
+void TrayItemView::AnimationProgressed(const gfx::Animation* animation) {
gfx::Transform transform;
transform.Translate(0, animation->CurrentValueBetween(
static_cast<double>(height()) / 2, 0.));
@@ -116,12 +116,12 @@ void TrayItemView::AnimationProgressed(const ui::Animation* animation) {
PreferredSizeChanged();
}
-void TrayItemView::AnimationEnded(const ui::Animation* animation) {
+void TrayItemView::AnimationEnded(const gfx::Animation* animation) {
if (animation->GetCurrentValue() < 0.1)
views::View::SetVisible(false);
}
-void TrayItemView::AnimationCanceled(const ui::Animation* animation) {
+void TrayItemView::AnimationCanceled(const gfx::Animation* animation) {
AnimationEnded(animation);
}
diff --git a/ash/system/tray/tray_item_view.h b/ash/system/tray/tray_item_view.h
index e0d8ec4d5a..761e918791 100644
--- a/ash/system/tray/tray_item_view.h
+++ b/ash/system/tray/tray_item_view.h
@@ -6,10 +6,10 @@
#define ASH_SYSTEM_TRAY_TRAY_ITEM_VIEW_H_
#include "ash/ash_export.h"
-#include "ui/base/animation/animation_delegate.h"
+#include "ui/gfx/animation/animation_delegate.h"
#include "ui/views/view.h"
-namespace ui {
+namespace gfx {
class SlideAnimation;
}
@@ -28,7 +28,7 @@ namespace internal {
// correctly when the visibility/size of the tray item changes. It also adds
// animation when showing/hiding the item in the tray.
class ASH_EXPORT TrayItemView : public views::View,
- public ui::AnimationDelegate {
+ public gfx::AnimationDelegate {
public:
explicit TrayItemView(SystemTrayItem* owner);
virtual ~TrayItemView();
@@ -66,13 +66,13 @@ class ASH_EXPORT TrayItemView : public views::View,
// Overridden from views::View.
virtual void ChildPreferredSizeChanged(View* child) OVERRIDE;
- // Overridden from ui::AnimationDelegate.
- virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
- virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
- virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE;
+ // Overridden from gfx::AnimationDelegate.
+ virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
+ virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE;
+ virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE;
SystemTrayItem* owner_;
- scoped_ptr<ui::SlideAnimation> animation_;
+ scoped_ptr<gfx::SlideAnimation> animation_;
views::Label* label_;
views::ImageView* image_view_;
diff --git a/ash/system/tray/tray_utils.cc b/ash/system/tray/tray_utils.cc
index 5f29a2e8f7..40cabea1df 100644
--- a/ash/system/tray/tray_utils.cc
+++ b/ash/system/tray/tray_utils.cc
@@ -54,9 +54,9 @@ void SetTrayLabelItemBorder(TrayItemView* tray_view,
int horizontal_padding = (tray_view->GetPreferredSize().width() -
tray_view->label()->GetPreferredSize().width()) / 2;
tray_view->set_border(views::Border::CreateEmptyBorder(
- kTrayLabelItemVerticalPaddingVeriticalAlignment,
+ kTrayLabelItemVerticalPaddingVerticalAlignment,
horizontal_padding,
- kTrayLabelItemVerticalPaddingVeriticalAlignment,
+ kTrayLabelItemVerticalPaddingVerticalAlignment,
horizontal_padding));
}
}
diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc
index efae178119..2e030f5bdb 100644
--- a/ash/system/user/tray_user.cc
+++ b/ash/system/user/tray_user.cc
@@ -648,7 +648,8 @@ UserView::UserView(SystemTrayItem* owner,
// The logout button must be added before the user card so that the user card
// can correctly calculate the remaining available width.
// Note that only the current multiprofile user gets a button.
- AddLogoutButton(!multiprofile_index_ ? login : ash::user::LOGGED_IN_LOCKED);
+ if (!multiprofile_index_)
+ AddLogoutButton(login);
AddUserCard(owner, login);
}
@@ -1259,9 +1260,9 @@ void TrayUser::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {
}
if (label_) {
label_->set_border(views::Border::CreateEmptyBorder(
- kTrayLabelItemVerticalPaddingVeriticalAlignment,
+ kTrayLabelItemVerticalPaddingVerticalAlignment,
kTrayLabelItemHorizontalPaddingBottomAlignment,
- kTrayLabelItemVerticalPaddingVeriticalAlignment,
+ kTrayLabelItemVerticalPaddingVerticalAlignment,
kTrayLabelItemHorizontalPaddingBottomAlignment));
}
layout_view_->SetLayoutManager(
diff --git a/ash/system/user/tray_user_unittest.cc b/ash/system/user/tray_user_unittest.cc
index 7d7b066f43..3c49a1e39e 100644
--- a/ash/system/user/tray_user_unittest.cc
+++ b/ash/system/user/tray_user_unittest.cc
@@ -14,7 +14,7 @@
#include "ash/test/test_session_state_delegate.h"
#include "ash/test/test_shell_delegate.h"
#include "ui/aura/test/event_generator.h"
-#include "ui/base/animation/animation_container_element.h"
+#include "ui/gfx/animation/animation_container_element.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
diff --git a/ash/system/web_notification/web_notification_tray_unittest.cc b/ash/system/web_notification/web_notification_tray_unittest.cc
index ff1728e1a9..d763a5635f 100644
--- a/ash/system/web_notification/web_notification_tray_unittest.cc
+++ b/ash/system/web_notification/web_notification_tray_unittest.cc
@@ -14,8 +14,8 @@
#include "ash/system/status_area_widget.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_item.h"
-#include "ash/system/tray/test_system_tray_delegate.h"
#include "ash/test/ash_test_base.h"
+#include "ash/test/test_system_tray_delegate.h"
#include "ash/wm/window_properties.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc
index b7391e31a2..28c652fff1 100644
--- a/ash/test/ash_test_helper.cc
+++ b/ash/test/ash_test_helper.cc
@@ -6,11 +6,11 @@
#include "ash/ash_switches.h"
#include "ash/shell.h"
-#include "ash/system/tray/test_system_tray_delegate.h"
#include "ash/test/display_manager_test_api.h"
#include "ash/test/shell_test_api.h"
#include "ash/test/test_session_state_delegate.h"
#include "ash/test/test_shell_delegate.h"
+#include "ash/test/test_system_tray_delegate.h"
#include "base/run_loop.h"
#include "ui/aura/env.h"
#include "ui/base/ime/input_method_initializer.h"
@@ -109,15 +109,13 @@ void AshTestHelper::TearDown() {
}
void AshTestHelper::RunAllPendingInMessageLoop() {
-#if !defined(OS_MACOSX)
DCHECK(base::MessageLoopForUI::current() == message_loop_);
base::RunLoop run_loop(aura::Env::GetInstance()->GetDispatcher());
run_loop.RunUntilIdle();
-#endif
}
aura::RootWindow* AshTestHelper::CurrentContext() {
- aura::RootWindow* root_window = Shell::GetActiveRootWindow();
+ aura::RootWindow* root_window = Shell::GetTargetRootWindow();
if (!root_window)
root_window = Shell::GetPrimaryRootWindow();
DCHECK(root_window);
diff --git a/ash/test/launcher_test_api.cc b/ash/test/launcher_test_api.cc
new file mode 100644
index 0000000000..e92625f11f
--- /dev/null
+++ b/ash/test/launcher_test_api.cc
@@ -0,0 +1,24 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/test/launcher_test_api.h"
+
+#include "ash/launcher/launcher.h"
+
+namespace ash {
+namespace test {
+
+LauncherTestAPI::LauncherTestAPI(Launcher* launcher)
+ : launcher_(launcher) {
+}
+
+LauncherTestAPI::~LauncherTestAPI() {
+}
+
+internal::LauncherView* LauncherTestAPI::launcher_view() {
+ return launcher_->launcher_view_;
+}
+
+} // namespace test
+} // namespace ash
diff --git a/ash/test/launcher_test_api.h b/ash/test/launcher_test_api.h
new file mode 100644
index 0000000000..57424af0eb
--- /dev/null
+++ b/ash/test/launcher_test_api.h
@@ -0,0 +1,39 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_TEST_LAUNCHER_TEST_API_H_
+#define ASH_TEST_LAUNCHER_TEST_API_H_
+
+#include "base/basictypes.h"
+
+namespace ash {
+
+class Launcher;
+
+namespace internal {
+class LauncherView;
+}
+
+namespace test {
+
+// Use the api in this class to access private members of Launcher.
+class LauncherTestAPI {
+ public:
+ explicit LauncherTestAPI(Launcher* launcher);
+
+ ~LauncherTestAPI();
+
+ // An accessor for |launcher_view|.
+ internal::LauncherView* launcher_view();
+
+ private:
+ Launcher* launcher_;
+
+ DISALLOW_COPY_AND_ASSIGN(LauncherTestAPI);
+};
+
+} // namespace test
+} // namespace ash
+
+#endif // ASH_TEST_LAUNCHER_VIEW_TEST_API_H_
diff --git a/ash/test/test_activation_delegate.cc b/ash/test/test_activation_delegate.cc
index 5ad14d05a0..f583a05c3a 100644
--- a/ash/test/test_activation_delegate.cc
+++ b/ash/test/test_activation_delegate.cc
@@ -7,7 +7,7 @@
#include "ash/wm/window_util.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
-#include "ui/base/events/event.h"
+#include "ui/events/event.h"
namespace ash {
namespace test {
diff --git a/ash/test/test_activation_delegate.h b/ash/test/test_activation_delegate.h
index e898e74b69..02aeb4584b 100644
--- a/ash/test/test_activation_delegate.h
+++ b/ash/test/test_activation_delegate.h
@@ -9,7 +9,7 @@
#include "base/logging.h"
#include "ui/aura/client/activation_change_observer.h"
#include "ui/aura/client/activation_delegate.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_handler.h"
namespace aura {
class Window;
diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc
index bdbdfc846c..4bd60838d7 100644
--- a/ash/test/test_shell_delegate.cc
+++ b/ash/test/test_shell_delegate.cc
@@ -14,6 +14,7 @@
#include "ash/shell_window_ids.h"
#include "ash/test/test_launcher_delegate.h"
#include "ash/test/test_session_state_delegate.h"
+#include "ash/test/test_system_tray_delegate.h"
#include "ash/wm/window_util.h"
#include "base/logging.h"
#include "content/public/test/test_browser_context.h"
@@ -157,7 +158,7 @@ LauncherDelegate* TestShellDelegate::CreateLauncherDelegate(
}
SystemTrayDelegate* TestShellDelegate::CreateSystemTrayDelegate() {
- return NULL;
+ return new TestSystemTrayDelegate;
}
UserWallpaperDelegate* TestShellDelegate::CreateUserWallpaperDelegate() {
diff --git a/ash/test/test_suite.cc b/ash/test/test_suite.cc
index 54c24ee2c1..9f5ad5dad2 100644
--- a/ash/test/test_suite.cc
+++ b/ash/test/test_suite.cc
@@ -14,10 +14,6 @@
#include "ui/base/ui_base_paths.h"
#include "ui/gfx/gfx_paths.h"
-#if defined(OS_MACOSX)
-#include "ash/test/test_suite_init.h"
-#endif
-
#if defined(OS_WIN)
#include "base/win/windows_version.h"
#include "ui/base/win/atl_module.h"
@@ -47,10 +43,6 @@ void AuraShellTestSuite::Initialize() {
gfx::RegisterPathProvider();
ui::RegisterPathProvider();
-#if defined(OS_MACOSX)
- ash::test::OverrideFrameworkBundle();
-#endif
-
// Force unittests to run using en-US so if we test against string
// output, it'll pass regardless of the system language.
ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL);
diff --git a/ash/test/test_system_tray_delegate.cc b/ash/test/test_system_tray_delegate.cc
new file mode 100644
index 0000000000..0f47aeaa7c
--- /dev/null
+++ b/ash/test/test_system_tray_delegate.cc
@@ -0,0 +1,74 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/test/test_system_tray_delegate.h"
+
+#include <string>
+
+#include "ash/session_state_delegate.h"
+#include "ash/shell.h"
+#include "base/message_loop/message_loop.h"
+#include "base/time/time.h"
+
+namespace ash {
+namespace test {
+
+namespace {
+
+user::LoginStatus g_initial_status = user::LOGGED_IN_USER;
+
+} // namespace
+
+TestSystemTrayDelegate::TestSystemTrayDelegate()
+ : should_show_display_notification_(false),
+ login_status_(g_initial_status) {
+}
+
+TestSystemTrayDelegate::~TestSystemTrayDelegate() {
+}
+
+// static
+void TestSystemTrayDelegate::SetInitialLoginStatus(
+ user::LoginStatus login_status) {
+ g_initial_status = login_status;
+}
+
+void TestSystemTrayDelegate::SetLoginStatus(user::LoginStatus login_status) {
+ login_status_ = login_status;
+ Shell::GetInstance()->UpdateAfterLoginStatusChange(login_status);
+}
+
+user::LoginStatus TestSystemTrayDelegate::GetUserLoginStatus() const {
+ // Initial login status has been changed for testing.
+ if (g_initial_status != user::LOGGED_IN_USER &&
+ g_initial_status == login_status_) {
+ return login_status_;
+ }
+
+ // At new user image screen manager->IsUserLoggedIn() would return true
+ // but there's no browser session available yet so use SessionStarted().
+ SessionStateDelegate* delegate =
+ Shell::GetInstance()->session_state_delegate();
+
+ if (!delegate->IsActiveUserSessionStarted())
+ return ash::user::LOGGED_IN_NONE;
+ if (delegate->IsScreenLocked())
+ return user::LOGGED_IN_LOCKED;
+ return login_status_;
+}
+
+bool TestSystemTrayDelegate::ShouldShowDisplayNotification() {
+ return should_show_display_notification_;
+}
+
+void TestSystemTrayDelegate::ShutDown() {
+ base::MessageLoop::current()->Quit();
+}
+
+void TestSystemTrayDelegate::SignOut() {
+ base::MessageLoop::current()->Quit();
+}
+
+} // namespace test
+} // namespace ash
diff --git a/ash/test/test_system_tray_delegate.h b/ash/test/test_system_tray_delegate.h
new file mode 100644
index 0000000000..335f68d84b
--- /dev/null
+++ b/ash/test/test_system_tray_delegate.h
@@ -0,0 +1,52 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_
+#define ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_
+
+#include "ash/system/tray/default_system_tray_delegate.h"
+
+namespace ash {
+namespace test {
+
+class TestSystemTrayDelegate : public DefaultSystemTrayDelegate {
+ public:
+ TestSystemTrayDelegate();
+ virtual ~TestSystemTrayDelegate();
+
+ // Changes the login status when initially the delegate is created. This will
+ // be called before AshTestBase::SetUp() to test the case when chrome is
+ // restarted right after the login (such like a flag is set).
+ // This value will be reset in AshTestHelper::TearDown, most test fixtures
+ // don't need to care its lifecycle.
+ static void SetInitialLoginStatus(user::LoginStatus login_status);
+
+ // Changes the current login status in the test. This also invokes
+ // UpdateAfterLoginStatusChange(). Usually this is called in the test code to
+ // set up a login status. This will fit to most of the test cases, but this
+ // cannot be set during the initialization. To test the initialization,
+ // consider using SetInitialLoginStatus() instead.
+ void SetLoginStatus(user::LoginStatus login_status);
+
+ void set_should_show_display_notification(bool should_show) {
+ should_show_display_notification_ = should_show;
+ }
+
+ // Overridden from SystemTrayDelegate:
+ virtual user::LoginStatus GetUserLoginStatus() const OVERRIDE;
+ virtual bool ShouldShowDisplayNotification() OVERRIDE;
+ virtual void ShutDown() OVERRIDE;
+ virtual void SignOut() OVERRIDE;
+
+ private:
+ bool should_show_display_notification_;
+ user::LoginStatus login_status_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestSystemTrayDelegate);
+};
+
+} // namespace test
+} // namespace ash
+
+#endif // ASH_TEST_TEST_SYSTEM_TRAY_DELEGATE_H_
diff --git a/ash/test/ui_controls_factory_ash.cc b/ash/test/ui_controls_factory_ash.cc
index ab0c0cdd86..458a4cb119 100644
--- a/ash/test/ui_controls_factory_ash.cc
+++ b/ash/test/ui_controls_factory_ash.cc
@@ -86,7 +86,7 @@ class UIControlsAsh : public UIControlsAura {
bool command,
const base::Closure& closure) OVERRIDE {
aura::RootWindow* root =
- window ? window->GetRootWindow() : ash::Shell::GetActiveRootWindow();
+ window ? window->GetRootWindow() : ash::Shell::GetTargetRootWindow();
UIControlsAura* ui_controls = GetUIControlsForRootWindow(root);
return ui_controls && ui_controls->SendKeyPressNotifyWhenDone(
window, key, control, shift, alt, command, closure);
@@ -131,7 +131,7 @@ class UIControlsAsh : public UIControlsAura {
virtual void RunClosureAfterAllPendingUIEvents(
const base::Closure& closure) OVERRIDE {
UIControlsAura* ui_controls = GetUIControlsForRootWindow(
- ash::Shell::GetActiveRootWindow());
+ ash::Shell::GetTargetRootWindow());
if (ui_controls)
ui_controls->RunClosureAfterAllPendingUIEvents(closure);
}
diff --git a/ash/touch/touch_hud_debug.cc b/ash/touch/touch_hud_debug.cc
index 769bffaee6..e46b303005 100644
--- a/ash/touch/touch_hud_debug.cc
+++ b/ash/touch/touch_hud_debug.cc
@@ -13,8 +13,8 @@
#include "base/strings/utf_string_conversions.h"
#include "third_party/skia/include/core/SkPath.h"
#include "ui/aura/root_window.h"
-#include "ui/base/animation/animation_delegate.h"
-#include "ui/base/events/event.h"
+#include "ui/events/event.h"
+#include "ui/gfx/animation/animation_delegate.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/display.h"
#include "ui/gfx/size.h"
diff --git a/ash/touch/touch_hud_projection.cc b/ash/touch/touch_hud_projection.cc
index 00d619336e..737391659b 100644
--- a/ash/touch/touch_hud_projection.cc
+++ b/ash/touch/touch_hud_projection.cc
@@ -8,9 +8,9 @@
#include "ash/shell.h"
#include "ash/wm/property_util.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
-#include "ui/base/animation/animation_delegate.h"
-#include "ui/base/animation/linear_animation.h"
-#include "ui/base/events/event.h"
+#include "ui/events/event.h"
+#include "ui/gfx/animation/animation_delegate.h"
+#include "ui/gfx/animation/linear_animation.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/size.h"
#include "ui/views/widget/widget.h"
@@ -29,7 +29,7 @@ const int kFadeoutFrameRate = 60;
// lifetime and deletes itself upon fade-out completion or whenever |Remove()|
// is explicitly called.
class TouchPointView : public views::View,
- public ui::AnimationDelegate,
+ public gfx::AnimationDelegate,
public views::WidgetObserver {
public:
explicit TouchPointView(views::Widget* parent_widget)
@@ -58,7 +58,7 @@ class TouchPointView : public views::View,
void UpdateTouch(const ui::TouchEvent& touch) {
if (touch.type() == ui::ET_TOUCH_RELEASED ||
touch.type() == ui::ET_TOUCH_CANCELLED) {
- fadeout_.reset(new ui::LinearAnimation(kFadeoutDurationInMs,
+ fadeout_.reset(new gfx::LinearAnimation(kFadeoutDurationInMs,
kFadeoutFrameRate,
this));
fadeout_->Start();
@@ -102,18 +102,18 @@ class TouchPointView : public views::View,
stroke_paint_);
}
- // Overridden from ui::AnimationDelegate.
- virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE {
+ // Overridden from gfx::AnimationDelegate.
+ virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE {
DCHECK_EQ(fadeout_.get(), animation);
delete this;
}
- virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE {
+ virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE {
DCHECK_EQ(fadeout_.get(), animation);
SchedulePaint();
}
- virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE {
+ virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE {
AnimationEnded(animation);
}
@@ -130,7 +130,7 @@ class TouchPointView : public views::View,
SkColor gradient_colors_[2];
SkScalar gradient_pos_[2];
- scoped_ptr<ui::Animation> fadeout_;
+ scoped_ptr<gfx::Animation> fadeout_;
DISALLOW_COPY_AND_ASSIGN(TouchPointView);
};
diff --git a/ash/touch/touch_observer_hud.h b/ash/touch/touch_observer_hud.h
index 70e23a720a..b94cc17969 100644
--- a/ash/touch/touch_observer_hud.h
+++ b/ash/touch/touch_observer_hud.h
@@ -7,7 +7,7 @@
#include "ash/ash_export.h"
#include "ash/display/display_controller.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_handler.h"
#include "ui/gfx/display_observer.h"
#include "ui/views/widget/widget_observer.h"
diff --git a/ash/touch/touch_uma.cc b/ash/touch/touch_uma.cc
index f8ab0f17d6..29f61850ed 100644
--- a/ash/touch/touch_uma.cc
+++ b/ash/touch/touch_uma.cc
@@ -11,8 +11,8 @@
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_property.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_utils.h"
+#include "ui/events/event.h"
+#include "ui/events/event_utils.h"
#include "ui/gfx/point_conversions.h"
#if defined(USE_XI2_MT)
diff --git a/ash/wm/app_list_controller.cc b/ash/wm/app_list_controller.cc
index ec169fef09..89f6a78fee 100644
--- a/ash/wm/app_list_controller.cc
+++ b/ash/wm/app_list_controller.cc
@@ -7,6 +7,7 @@
#include "ash/ash_switches.h"
#include "ash/launcher/launcher.h"
#include "ash/root_window_controller.h"
+#include "ash/screen_ash.h"
#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
@@ -18,9 +19,9 @@
#include "ui/aura/client/focus_client.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
-#include "ui/base/events/event.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/events/event.h"
#include "ui/gfx/transform_util.h"
#include "ui/views/widget/widget.h"
@@ -149,17 +150,29 @@ void AppListController::SetVisible(bool visible, aura::Window* window) {
UpdateAutoHideState();
if (view_) {
+ // Our widget is currently active. When the animation completes we'll hide
+ // the widget, changing activation. If a menu is shown before the animation
+ // completes then the activation change triggers the menu to close. By
+ // deactivating now we ensure there is no activation change when the
+ // animation completes and any menus stay open.
+ if (!visible)
+ view_->GetWidget()->Deactivate();
ScheduleAnimation();
} else if (is_visible_) {
// AppListModel and AppListViewDelegate are owned by AppListView. They
// will be released with AppListView on close.
app_list::AppListView* view = new app_list::AppListView(
Shell::GetInstance()->delegate()->CreateAppListViewDelegate());
- aura::Window* container = GetRootWindowController(window->GetRootWindow())->
+ aura::RootWindow* root_window = window->GetRootWindow();
+ aura::Window* container = GetRootWindowController(root_window)->
GetContainer(kShellWindowId_AppListContainer);
if (ash::switches::UseAlternateShelfLayout()) {
gfx::Rect applist_button_bounds = Launcher::ForWindow(container)->
GetAppListButtonView()->GetBoundsInScreen();
+ // We need the location of the button within the local screen.
+ applist_button_bounds = ash::ScreenAsh::ConvertRectFromScreen(
+ root_window,
+ applist_button_bounds);
view->InitAsBubbleAttachedToAnchor(
container,
pagination_model_.get(),
diff --git a/ash/wm/app_list_controller.h b/ash/wm/app_list_controller.h
index e3592231e8..347569725f 100644
--- a/ash/wm/app_list_controller.h
+++ b/ash/wm/app_list_controller.h
@@ -13,8 +13,8 @@
#include "ui/app_list/pagination_model_observer.h"
#include "ui/aura/client/focus_change_observer.h"
#include "ui/aura/window_observer.h"
-#include "ui/base/events/event_handler.h"
#include "ui/compositor/layer_animation_observer.h"
+#include "ui/events/event_handler.h"
#include "ui/gfx/rect.h"
#include "ui/views/widget/widget_observer.h"
diff --git a/ash/wm/ash_focus_rules.cc b/ash/wm/ash_focus_rules.cc
index 0b5aa3309e..851dbbaeaa 100644
--- a/ash/wm/ash_focus_rules.cc
+++ b/ash/wm/ash_focus_rules.cc
@@ -107,7 +107,7 @@ aura::Window* AshFocusRules::GetNextActivatableWindow(
// container.
aura::RootWindow* root = ignore->GetRootWindow();
if (!root)
- root = Shell::GetActiveRootWindow();
+ root = Shell::GetTargetRootWindow();
int container_count = static_cast<int>(arraysize(kWindowContainerIds));
for (int i = 0; ignore && i < container_count; i++) {
aura::Window* container = Shell::GetContainer(root, kWindowContainerIds[i]);
diff --git a/ash/wm/base_layout_manager.h b/ash/wm/base_layout_manager.h
index c9e49e333b..3156f14bd0 100644
--- a/ash/wm/base_layout_manager.h
+++ b/ash/wm/base_layout_manager.h
@@ -15,8 +15,8 @@
#include "ui/aura/client/activation_change_observer.h"
#include "ui/aura/layout_manager.h"
#include "ui/aura/window_observer.h"
-#include "ui/base/events/event_handler.h"
#include "ui/base/ui_base_types.h"
+#include "ui/events/event_handler.h"
namespace aura {
class RootWindow;
diff --git a/ash/wm/base_layout_manager_unittest.cc b/ash/wm/base_layout_manager_unittest.cc
index c6f7156e77..ea0f6305f4 100644
--- a/ash/wm/base_layout_manager_unittest.cc
+++ b/ash/wm/base_layout_manager_unittest.cc
@@ -173,16 +173,9 @@ TEST_F(BaseLayoutManagerTest, FullscreenRootWindowResize) {
window->bounds().ToString());
}
-// Fails on Mac only. Need to be implemented. http://crbug.com/111279.
-#if defined(OS_MACOSX)
-#define MAYBE_RootWindowResizeShrinksWindows \
- DISABLED_RootWindowResizeShrinksWindows
-#else
-#define MAYBE_RootWindowResizeShrinksWindows RootWindowResizeShrinksWindows
-#endif
// Tests that when the screen gets smaller the windows aren't bigger than
// the screen.
-TEST_F(BaseLayoutManagerTest, MAYBE_RootWindowResizeShrinksWindows) {
+TEST_F(BaseLayoutManagerTest, RootWindowResizeShrinksWindows) {
scoped_ptr<aura::Window> window(
CreateTestWindow(gfx::Rect(10, 20, 500, 400)));
gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow(
diff --git a/ash/wm/workspace/alternate_frame_caption_button.cc b/ash/wm/caption_buttons/alternate_frame_caption_button.cc
index ffdb5395b9..6f6b41fbfa 100644
--- a/ash/wm/workspace/alternate_frame_caption_button.cc
+++ b/ash/wm/caption_buttons/alternate_frame_caption_button.cc
@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ash/wm/workspace/alternate_frame_caption_button.h"
+#include "ash/wm/caption_buttons/alternate_frame_caption_button.h"
-#include "ui/base/animation/slide_animation.h"
+#include "ui/gfx/animation/slide_animation.h"
#include "ui/gfx/canvas.h"
namespace ash {
@@ -96,7 +96,7 @@ AlternateFrameCaptionButton::AlternateFrameCaptionButton(
action_(action),
hidden_bubble_radius_(0),
shown_bubble_radius_(0),
- bubble_animation_(new ui::SlideAnimation(this)) {
+ bubble_animation_(new gfx::SlideAnimation(this)) {
}
AlternateFrameCaptionButton::~AlternateFrameCaptionButton() {
@@ -216,12 +216,12 @@ void AlternateFrameCaptionButton::StateChanged() {
}
void AlternateFrameCaptionButton::AnimationProgressed(
- const ui::Animation* animation) {
+ const gfx::Animation* animation) {
SchedulePaint();
}
void AlternateFrameCaptionButton::AnimationEnded(
- const ui::Animation* animation) {
+ const gfx::Animation* animation) {
// The bubble animation was postponed if the button became pressed when the
// bubble was fading out. Do the animation now.
MaybeStartNewBubbleAnimation();
diff --git a/ash/wm/workspace/alternate_frame_caption_button.h b/ash/wm/caption_buttons/alternate_frame_caption_button.h
index b0f9581dbb..5c0ebda0bb 100644
--- a/ash/wm/workspace/alternate_frame_caption_button.h
+++ b/ash/wm/caption_buttons/alternate_frame_caption_button.h
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef ASH_WM_WORKSPACE_ALTERNATE_FRAME_CAPTION_BUTTON_H_
-#define ASH_WM_WORKSPACE_ALTERNATE_FRAME_CAPTION_BUTTON_H_
+#ifndef ASH_WM_CAPTION_BUTTONS_ALTERNATE_FRAME_CAPTION_BUTTON_H_
+#define ASH_WM_CAPTION_BUTTONS_ALTERNATE_FRAME_CAPTION_BUTTON_H_
#include "ash/ash_export.h"
#include "base/memory/scoped_ptr.h"
#include "ui/views/controls/button/custom_button.h"
-namespace ui {
+namespace gfx {
class SlideAnimation;
}
@@ -47,9 +47,9 @@ class ASH_EXPORT AlternateFrameCaptionButton : public views::CustomButton {
virtual void StateChanged() OVERRIDE;
// ui::AnimateDelegate overrides. (views::CustomButton inherits from
- // ui::AnimationDelegate).
- virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
- virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
+ // gfx::AnimationDelegate).
+ virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
+ virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE;
Action action_;
@@ -59,11 +59,11 @@ class ASH_EXPORT AlternateFrameCaptionButton : public views::CustomButton {
// The radius of the background bubble when it is visible.
double shown_bubble_radius_;
- scoped_ptr<ui::SlideAnimation> bubble_animation_;
+ scoped_ptr<gfx::SlideAnimation> bubble_animation_;
DISALLOW_COPY_AND_ASSIGN(AlternateFrameCaptionButton);
};
} // namespace ash
-#endif // ASH_WM_WORKSPACE_ALTERNATE_FRAME_CAPTION_BUTTON_H_
+#endif // ASH_WM_CAPTION_BUTTONS_ALTERNATE_FRAME_CAPTION_BUTTON_H_
diff --git a/ash/wm/workspace/frame_caption_button_container_view.cc b/ash/wm/caption_buttons/frame_caption_button_container_view.cc
index 264c57a8e6..3425afa45c 100644
--- a/ash/wm/workspace/frame_caption_button_container_view.cc
+++ b/ash/wm/caption_buttons/frame_caption_button_container_view.cc
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ash/wm/workspace/frame_caption_button_container_view.h"
+#include "ash/wm/caption_buttons/frame_caption_button_container_view.h"
#include "ash/ash_switches.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
+#include "ash/wm/caption_buttons/alternate_frame_caption_button.h"
+#include "ash/wm/caption_buttons/frame_maximize_button.h"
#include "ash/wm/window_settings.h"
-#include "ash/wm/workspace/alternate_frame_caption_button.h"
-#include "ash/wm/workspace/frame_maximize_button.h"
#include "grit/ash_resources.h"
#include "grit/ui_strings.h" // Accessibility names
#include "ui/base/hit_test.h"
@@ -21,7 +21,6 @@
#include "ui/views/controls/button/image_button.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
-#include "ui/views/window/non_client_view.h"
namespace ash {
@@ -65,7 +64,6 @@ const char FrameCaptionButtonContainerView::kViewClassName[] =
"FrameCaptionButtonContainerView";
FrameCaptionButtonContainerView::FrameCaptionButtonContainerView(
- views::NonClientFrameView* frame_view,
views::Widget* frame,
MinimizeAllowed minimize_allowed)
: frame_(frame),
@@ -85,7 +83,7 @@ FrameCaptionButtonContainerView::FrameCaptionButtonContainerView(
AlternateFrameCaptionButton::ACTION_CLOSE);
} else {
minimize_button_ = new views::ImageButton(this);
- size_button_ = new FrameMaximizeButton(this, frame_view);
+ size_button_ = new FrameMaximizeButton(this, frame);
close_button_ = new views::ImageButton(this);
}
diff --git a/ash/wm/workspace/frame_caption_button_container_view.h b/ash/wm/caption_buttons/frame_caption_button_container_view.h
index be76e77255..bcd5b376fe 100644
--- a/ash/wm/workspace/frame_caption_button_container_view.h
+++ b/ash/wm/caption_buttons/frame_caption_button_container_view.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef ASH_WM_WORKSPACE_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_
-#define ASH_WM_WORKSPACE_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_
+#ifndef ASH_WM_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_
+#define ASH_WM_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_
#include "ash/ash_export.h"
#include "ui/gfx/image/image_skia.h"
@@ -12,7 +12,6 @@
namespace views {
class CustomButton;
-class NonClientFrameView;
class Widget;
}
@@ -45,14 +44,10 @@ class ASH_EXPORT FrameCaptionButtonContainerView
HEADER_STYLE_MAXIMIZED_HOSTED_APP
};
- // |frame_view| and |frame| are the NonClientFrameView and the views::Widget
- // that the caption buttons act on.
+ // |frame| is the views::Widget that the caption buttons act on.
// |minimize_allowed| indicates whether the frame can be minimized (either via
// the maximize/restore button or via a dedicated button).
- // TODO(pkotwicz): Remove the |frame_view| parameter once FrameMaximizeButton
- // is refactored to take in a views::Widget instead.
- FrameCaptionButtonContainerView(views::NonClientFrameView* frame_view,
- views::Widget* frame,
+ FrameCaptionButtonContainerView(views::Widget* frame,
MinimizeAllowed minimize_allowed);
virtual ~FrameCaptionButtonContainerView();
@@ -146,4 +141,4 @@ class ASH_EXPORT FrameCaptionButtonContainerView
} // namesapace ash
-#endif // ASH_WM_WORKSPACE_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_
+#endif // ASH_WM_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_
diff --git a/ash/wm/workspace/frame_caption_button_container_view_unittest.cc b/ash/wm/caption_buttons/frame_caption_button_container_view_unittest.cc
index cb732bfeb5..ef8685138d 100644
--- a/ash/wm/workspace/frame_caption_button_container_view_unittest.cc
+++ b/ash/wm/caption_buttons/frame_caption_button_container_view_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ash/wm/workspace/frame_caption_button_container_view.h"
+#include "ash/wm/caption_buttons/frame_caption_button_container_view.h"
#include "ash/ash_switches.h"
#include "ash/test/ash_test_base.h"
@@ -138,7 +138,7 @@ TEST_F(FrameCaptionButtonContainerViewTestOldStyle, ButtonVisibility) {
// are allowed because the size button can do both.
scoped_ptr<views::Widget> widget_can_maximize(
CreateTestWidget(MAXIMIZE_ALLOWED));
- FrameCaptionButtonContainerView container1(NULL, widget_can_maximize.get(),
+ FrameCaptionButtonContainerView container1(widget_can_maximize.get(),
FrameCaptionButtonContainerView::MINIMIZE_ALLOWED);
container1.Layout();
FrameCaptionButtonContainerView::TestApi t1(&container1);
@@ -152,7 +152,7 @@ TEST_F(FrameCaptionButtonContainerViewTestOldStyle, ButtonVisibility) {
// maximizing is disallowed.
scoped_ptr<views::Widget> widget_cannot_maximize(
CreateTestWidget(MAXIMIZE_DISALLOWED));
- FrameCaptionButtonContainerView container2(NULL, widget_cannot_maximize.get(),
+ FrameCaptionButtonContainerView container2(widget_cannot_maximize.get(),
FrameCaptionButtonContainerView::MINIMIZE_ALLOWED);
container2.Layout();
FrameCaptionButtonContainerView::TestApi t2(&container2);
@@ -164,7 +164,7 @@ TEST_F(FrameCaptionButtonContainerViewTestOldStyle, ButtonVisibility) {
// Neither the minimize button nor the size button should be visible when
// neither minimizing nor maximizing are allowed.
- FrameCaptionButtonContainerView container3(NULL, widget_cannot_maximize.get(),
+ FrameCaptionButtonContainerView container3(widget_cannot_maximize.get(),
FrameCaptionButtonContainerView::MINIMIZE_DISALLOWED);
container3.Layout();
FrameCaptionButtonContainerView::TestApi t3(&container3);
@@ -177,7 +177,7 @@ TEST_F(FrameCaptionButtonContainerViewTestOldStyle, ButtonVisibility) {
// Neither the minimize button nor the size button should be visible when the
// "force-maximize-mode" experiment is turned on.
CommandLine::ForCurrentProcess()->AppendSwitch(switches::kForcedMaximizeMode);
- FrameCaptionButtonContainerView container4(NULL, widget_can_maximize.get(),
+ FrameCaptionButtonContainerView container4(widget_can_maximize.get(),
FrameCaptionButtonContainerView::MINIMIZE_ALLOWED);
container4.Layout();
FrameCaptionButtonContainerView::TestApi t4(&container4);
@@ -196,7 +196,7 @@ TEST_F(FrameCaptionButtonContainerViewTestOldStyle, LayoutBorder) {
const int kRightInset = 4;
scoped_ptr<views::Widget> widget(CreateTestWidget(MAXIMIZE_ALLOWED));
- FrameCaptionButtonContainerView container(NULL, widget.get(),
+ FrameCaptionButtonContainerView container(widget.get(),
FrameCaptionButtonContainerView::MINIMIZE_ALLOWED);
container.set_border(views::Border::CreateEmptyBorder(
kTopInset, kLeftInset, kBottomInset, kRightInset));
@@ -214,7 +214,7 @@ TEST_F(FrameCaptionButtonContainerViewTestOldStyle, LayoutBorder) {
// Test how the header style affects which images are used for the buttons.
TEST_F(FrameCaptionButtonContainerViewTestOldStyle, HeaderStyle) {
scoped_ptr<views::Widget> widget(CreateTestWidget(MAXIMIZE_ALLOWED));
- FrameCaptionButtonContainerView container(NULL, widget.get(),
+ FrameCaptionButtonContainerView container(widget.get(),
FrameCaptionButtonContainerView::MINIMIZE_ALLOWED);
FrameCaptionButtonContainerView::TestApi t(&container);
@@ -311,7 +311,7 @@ TEST_F(FrameCaptionButtonContainerViewTestAlternateStyle, ButtonVisibility) {
// button style.
scoped_ptr<views::Widget> widget_can_maximize(
CreateTestWidget(MAXIMIZE_ALLOWED));
- FrameCaptionButtonContainerView container(NULL, widget_can_maximize.get(),
+ FrameCaptionButtonContainerView container(widget_can_maximize.get(),
FrameCaptionButtonContainerView::MINIMIZE_ALLOWED);
container.Layout();
FrameCaptionButtonContainerView::TestApi t(&container);
diff --git a/ash/wm/workspace/frame_maximize_button.cc b/ash/wm/caption_buttons/frame_maximize_button.cc
index 08980c287f..db5712f72d 100644
--- a/ash/wm/workspace/frame_maximize_button.cc
+++ b/ash/wm/caption_buttons/frame_maximize_button.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ash/wm/workspace/frame_maximize_button.h"
+#include "ash/wm/caption_buttons/frame_maximize_button.h"
#include "ash/launcher/launcher.h"
#include "ash/screen_ash.h"
@@ -10,7 +10,7 @@
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/touch/touch_uma.h"
-#include "ash/wm/maximize_bubble_controller.h"
+#include "ash/wm/caption_buttons/maximize_bubble_controller.h"
#include "ash/wm/property_util.h"
#include "ash/wm/window_animations.h"
#include "ash/wm/window_settings.h"
@@ -19,10 +19,10 @@
#include "grit/ash_strings.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_handler.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/events/event.h"
+#include "ui/events/event_handler.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/screen.h"
#include "ui/views/widget/widget.h"
@@ -82,12 +82,12 @@ void FrameMaximizeButton::EscapeEventFilter::OnKeyEvent(
// FrameMaximizeButton ---------------------------------------------------------
FrameMaximizeButton::FrameMaximizeButton(views::ButtonListener* listener,
- views::NonClientFrameView* frame)
+ views::Widget* frame)
: ImageButton(listener),
frame_(frame),
+ observing_frame_(false),
is_snap_enabled_(false),
exceeded_drag_threshold_(false),
- widget_(NULL),
press_is_gesture_(false),
snap_type_(SNAP_NONE),
bubble_appearance_delay_ms_(kBubbleAppearanceDelayMS) {
@@ -102,8 +102,8 @@ FrameMaximizeButton::~FrameMaximizeButton() {
// Before the window gets destroyed, the maximizer dialog needs to be shut
// down since it would otherwise call into a deleted object.
maximizer_.reset();
- if (widget_)
- OnWindowDestroying(widget_->GetNativeWindow());
+ if (observing_frame_)
+ OnWindowDestroying(frame_->GetNativeWindow());
}
void FrameMaximizeButton::SnapButtonHovered(SnapType type) {
@@ -159,7 +159,7 @@ void FrameMaximizeButton::ExecuteSnapAndCloseMenu(SnapType snap_type) {
// Since Snap might destroy |this|, but the snap_sizer needs to be destroyed,
// The ownership of the snap_sizer is taken now.
scoped_ptr<SnapSizer> snap_sizer(snap_sizer_.release());
- Snap(*snap_sizer.get());
+ Snap(snap_sizer.get());
}
void FrameMaximizeButton::DestroyMaximizeMenu() {
@@ -181,11 +181,11 @@ void FrameMaximizeButton::OnWindowPropertyChanged(aura::Window* window,
void FrameMaximizeButton::OnWindowDestroying(aura::Window* window) {
maximizer_.reset();
- if (widget_) {
- CHECK_EQ(widget_->GetNativeWindow(), window);
- widget_->GetNativeWindow()->RemoveObserver(this);
- widget_->RemoveObserver(this);
- widget_ = NULL;
+ if (observing_frame_) {
+ CHECK_EQ(frame_->GetNativeWindow(), window);
+ frame_->GetNativeWindow()->RemoveObserver(this);
+ frame_->RemoveObserver(this);
+ observing_frame_ = false;
}
}
@@ -214,10 +214,10 @@ void FrameMaximizeButton::OnMouseEntered(const ui::MouseEvent& event) {
ImageButton::OnMouseEntered(event);
if (!maximizer_) {
DCHECK(GetWidget());
- if (!widget_) {
- widget_ = frame_->GetWidget();
- widget_->GetNativeWindow()->AddObserver(this);
- widget_->AddObserver(this);
+ if (!observing_frame_) {
+ observing_frame_ = true;
+ frame_->GetNativeWindow()->AddObserver(this);
+ frame_->AddObserver(this);
}
maximizer_.reset(new MaximizeBubbleController(
this,
@@ -377,7 +377,7 @@ bool FrameMaximizeButton::ProcessEndEvent(const ui::LocatedEvent& event) {
// Since Snap might destroy |this|, but the snap_sizer needs to be destroyed,
// The ownership of the snap_sizer is taken now.
scoped_ptr<SnapSizer> snap_sizer(snap_sizer_.release());
- Snap(*snap_sizer.get());
+ Snap(snap_sizer.get());
return true;
}
@@ -421,7 +421,7 @@ void FrameMaximizeButton::UpdateSnap(const gfx::Point& location,
if (snap_sizer_) {
snap_sizer_->Update(LocationForSnapSizer(location));
phantom_window_->Show(ScreenAsh::ConvertRectToScreen(
- frame_->GetWidget()->GetNativeView()->parent(),
+ frame_->GetNativeView()->parent(),
snap_sizer_->target_bounds()));
}
return;
@@ -442,7 +442,7 @@ void FrameMaximizeButton::UpdateSnap(const gfx::Point& location,
SnapSizer::InputType input_type =
is_touch ? SnapSizer::TOUCH_MAXIMIZE_BUTTON_INPUT :
SnapSizer::OTHER_INPUT;
- snap_sizer_.reset(new SnapSizer(frame_->GetWidget()->GetNativeWindow(),
+ snap_sizer_.reset(new SnapSizer(frame_->GetNativeWindow(),
LocationForSnapSizer(location),
snap_edge,
input_type));
@@ -451,7 +451,7 @@ void FrameMaximizeButton::UpdateSnap(const gfx::Point& location,
}
if (!phantom_window_) {
phantom_window_.reset(new internal::PhantomWindowController(
- frame_->GetWidget()->GetNativeWindow()));
+ frame_->GetNativeWindow()));
}
if (maximizer_) {
phantom_window_->set_phantom_below_window(maximizer_->GetBubbleWindow());
@@ -479,13 +479,12 @@ SnapType FrameMaximizeButton::SnapTypeForLocation(
gfx::Rect FrameMaximizeButton::ScreenBoundsForType(
SnapType type,
const SnapSizer& snap_sizer) const {
- aura::Window* window = frame_->GetWidget()->GetNativeWindow();
+ aura::Window* window = frame_->GetNativeWindow();
switch (type) {
case SNAP_LEFT:
case SNAP_RIGHT:
- return ScreenAsh::ConvertRectToScreen(
- frame_->GetWidget()->GetNativeView()->parent(),
- snap_sizer.target_bounds());
+ return ScreenAsh::ConvertRectToScreen(window->parent(),
+ snap_sizer.target_bounds());
case SNAP_MAXIMIZE:
return ScreenAsh::ConvertRectToScreen(
window->parent(),
@@ -501,8 +500,7 @@ gfx::Rect FrameMaximizeButton::ScreenBoundsForType(
}
case SNAP_RESTORE: {
const gfx::Rect* restore = GetRestoreBoundsInScreen(window);
- return restore ?
- *restore : frame_->GetWidget()->GetWindowBoundsInScreen();
+ return restore ? *restore : frame_->GetWindowBoundsInScreen();
}
case SNAP_NONE:
NOTREACHED();
@@ -517,66 +515,37 @@ gfx::Point FrameMaximizeButton::LocationForSnapSizer(
return result;
}
-void FrameMaximizeButton::Snap(const SnapSizer& snap_sizer) {
+void FrameMaximizeButton::Snap(SnapSizer* snap_sizer) {
ash::Shell* shell = ash::Shell::GetInstance();
- views::Widget* widget = frame_->GetWidget();
switch (snap_type_) {
case SNAP_LEFT:
case SNAP_RIGHT: {
+ // Others might also have set up a restore rectangle already. If so, we
+ // should not overwrite the restore rectangle.
+ gfx::Rect current_bounds_in_screen = frame_->GetWindowBoundsInScreen();
+ snap_sizer->SnapWindowToTargetBounds();
+ if (GetRestoreBoundsInScreen(frame_->GetNativeWindow()) == NULL) {
+ ash::SetRestoreBoundsInScreen(frame_->GetNativeWindow(),
+ current_bounds_in_screen);
+ }
shell->delegate()->RecordUserMetricsAction(
snap_type_ == SNAP_LEFT ?
ash::UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_LEFT :
ash::UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_RIGHT);
- // Get the bounds in screen coordinates for restore purposes.
- gfx::Rect restore = widget->GetWindowBoundsInScreen();
- if (widget->IsMaximized() || widget->IsFullscreen()) {
- aura::Window* window = widget->GetNativeWindow();
- // In case of maximized we have a restore boundary.
- DCHECK(ash::GetRestoreBoundsInScreen(window));
- // If it was maximized we need to recover the old restore set.
- restore = *ash::GetRestoreBoundsInScreen(window);
-
- // The auto position manager will kick in when this is the only window.
- // To avoid interference with it we tell it temporarily to not change
- // the coordinates of this window.
- wm::WindowSettings* settings = wm::GetWindowSettings(window);
- bool was_managed = settings->window_position_managed();
- settings->set_window_position_managed(false);
-
- // Set the restore size we want to restore to.
- ash::SetRestoreBoundsInScreen(window,
- ScreenBoundsForType(snap_type_,
- snap_sizer));
- widget->Restore();
-
- // After the window is where we want it to be we allow the window to be
- // auto managed again.
- settings->set_window_position_managed(was_managed);
- } else {
- // Others might also have set up a restore rectangle already. If so,
- // we should not overwrite the restore rectangle.
- bool restore_set =
- GetRestoreBoundsInScreen(widget->GetNativeWindow()) != NULL;
- widget->SetBounds(ScreenBoundsForType(snap_type_, snap_sizer));
- if (restore_set)
- break;
- }
- // Remember the widow's bounds for restoration.
- ash::SetRestoreBoundsInScreen(widget->GetNativeWindow(), restore);
break;
}
case SNAP_MAXIMIZE:
- widget->Maximize();
+ frame_->Maximize();
shell->delegate()->RecordUserMetricsAction(
ash::UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE);
break;
case SNAP_MINIMIZE:
- widget->Minimize();
+ frame_->Minimize();
shell->delegate()->RecordUserMetricsAction(
ash::UMA_WINDOW_MAXIMIZE_BUTTON_MINIMIZE);
break;
case SNAP_RESTORE:
- widget->Restore();
+ frame_->Restore();
shell->delegate()->RecordUserMetricsAction(
ash::UMA_WINDOW_MAXIMIZE_BUTTON_RESTORE);
break;
@@ -588,16 +557,15 @@ void FrameMaximizeButton::Snap(const SnapSizer& snap_sizer) {
MaximizeBubbleFrameState
FrameMaximizeButton::GetMaximizeBubbleFrameState() const {
// When there are no restore bounds, we are in normal mode.
- if (!ash::GetRestoreBoundsInScreen(
- frame_->GetWidget()->GetNativeWindow()))
+ if (!ash::GetRestoreBoundsInScreen(frame_->GetNativeWindow()))
return FRAME_STATE_NONE;
// The normal maximized test can be used.
- if (frame_->GetWidget()->IsMaximized())
+ if (frame_->IsMaximized())
return FRAME_STATE_FULL;
// For Left/right maximize we need to check the dimensions.
- gfx::Rect bounds = frame_->GetWidget()->GetWindowBoundsInScreen();
+ gfx::Rect bounds = frame_->GetWindowBoundsInScreen();
gfx::Rect screen = Shell::GetScreen()->GetDisplayNearestWindow(
- frame_->GetWidget()->GetNativeView()).work_area();
+ frame_->GetNativeView()).work_area();
if (bounds.width() < (screen.width() * kMinSnapSizePercent) / 100)
return FRAME_STATE_NONE;
// We might still have a horizontally filled window at this point which we
diff --git a/ash/wm/workspace/frame_maximize_button.h b/ash/wm/caption_buttons/frame_maximize_button.h
index f01df6c267..1539833a75 100644
--- a/ash/wm/workspace/frame_maximize_button.h
+++ b/ash/wm/caption_buttons/frame_maximize_button.h
@@ -1,12 +1,12 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_
-#define ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_
+#ifndef ASH_WM_CAPTION_BUTTONS_FRAME_MAXIMIZE_BUTTON_H_
+#define ASH_WM_CAPTION_BUTTONS_FRAME_MAXIMIZE_BUTTON_H_
#include "ash/ash_export.h"
-#include "ash/wm/workspace/maximize_bubble_frame_state.h"
+#include "ash/wm/caption_buttons/maximize_bubble_frame_state.h"
#include "ash/wm/workspace/snap_types.h"
#include "base/memory/scoped_ptr.h"
#include "base/timer/timer.h"
@@ -15,7 +15,7 @@
#include "ui/views/widget/widget_observer.h"
namespace views {
-class NonClientFrameView;
+class Widget;
}
namespace ash {
@@ -33,7 +33,7 @@ class ASH_EXPORT FrameMaximizeButton : public views::ImageButton,
public aura::WindowObserver {
public:
FrameMaximizeButton(views::ButtonListener* listener,
- views::NonClientFrameView* frame);
+ views::Widget* frame);
virtual ~FrameMaximizeButton();
// Updates |snap_type_| based on a a given snap type. This is used by
@@ -133,13 +133,17 @@ class ASH_EXPORT FrameMaximizeButton : public views::ImageButton,
gfx::Point LocationForSnapSizer(const gfx::Point& location) const;
// Snaps the window to the current snap position.
- void Snap(const internal::SnapSizer& snap_sizer);
+ void Snap(internal::SnapSizer* snap_sizer);
// Determine the maximize type of this window.
MaximizeBubbleFrameState GetMaximizeBubbleFrameState() const;
- // Frame that the maximize button acts on.
- views::NonClientFrameView* frame_;
+ // Widget that the maximize button acts on. This is different than the widget
+ // which contains the button in the case of AppNonClientFrameViewAsh.
+ views::Widget* frame_;
+
+ // True if we have put observers on |frame_|.
+ bool observing_frame_;
// Renders the snap position.
scoped_ptr<internal::PhantomWindowController> phantom_window_;
@@ -151,10 +155,6 @@ class ASH_EXPORT FrameMaximizeButton : public views::ImageButton,
// Did the user drag far enough to trigger snapping?
bool exceeded_drag_threshold_;
- // Remember the widget on which we have put some an observers,
- // so that we can remove it upon destruction.
- views::Widget* widget_;
-
// Location of the press.
gfx::Point press_location_;
@@ -180,4 +180,4 @@ class ASH_EXPORT FrameMaximizeButton : public views::ImageButton,
} // namespace ash
-#endif // ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_
+#endif // ASH_WM_CAPTION_BUTTONS_FRAME_MAXIMIZE_BUTTON_H_
diff --git a/ash/wm/custom_frame_view_ash_unittest.cc b/ash/wm/caption_buttons/frame_maximize_button_unittest.cc
index 0499f299b1..d0b43b26ed 100644
--- a/ash/wm/custom_frame_view_ash_unittest.cc
+++ b/ash/wm/caption_buttons/frame_maximize_button_unittest.cc
@@ -1,27 +1,25 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ash/wm/custom_frame_view_ash.h"
+#include "ash/wm/caption_buttons/frame_maximize_button.h"
#include "ash/ash_switches.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
-#include "ash/wm/maximize_bubble_controller.h"
+#include "ash/wm/caption_buttons/frame_caption_button_container_view.h"
+#include "ash/wm/caption_buttons/maximize_bubble_controller.h"
#include "ash/wm/property_util.h"
#include "ash/wm/window_util.h"
-#include "ash/wm/workspace/frame_caption_button_container_view.h"
-#include "ash/wm/workspace/frame_maximize_button.h"
#include "ash/wm/workspace/snap_sizer.h"
#include "base/command_line.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/focus_client.h"
-#include "ui/aura/test/event_generator.h"
#include "ui/aura/root_window.h"
+#include "ui/aura/test/event_generator.h"
#include "ui/aura/window.h"
-#include "ui/base/events/event_utils.h"
#include "ui/base/gestures/gesture_configuration.h"
-#include "ui/views/controls/button/image_button.h"
+#include "ui/events/event_utils.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
@@ -65,7 +63,7 @@ class TestWidgetDelegate : public views::WidgetDelegateView {
TestWidgetDelegate() {}
virtual ~TestWidgetDelegate() {}
- // Overridden from views::WidgetDelegate:
+ // views::WidgetDelegate overrides:
virtual views::View* GetContentsView() OVERRIDE {
return this;
}
@@ -75,30 +73,51 @@ class TestWidgetDelegate : public views::WidgetDelegateView {
virtual bool CanMaximize() const OVERRIDE {
return true;
}
- virtual views::NonClientFrameView* CreateNonClientFrameView(
- views::Widget* widget) OVERRIDE {
- // Always test CustomFrameViewAsh, which may not be the ash::Shell default.
- CustomFrameViewAsh* frame_view = new CustomFrameViewAsh;
- frame_view->Init(widget);
- return frame_view;
+
+ ash::FrameCaptionButtonContainerView* caption_button_container() {
+ return caption_button_container_;
}
private:
+ // Overridden from views::View:
+ virtual void Layout() OVERRIDE {
+ caption_button_container_->Layout();
+
+ // Right align the caption button container.
+ gfx::Size preferred_size = caption_button_container_->GetPreferredSize();
+ caption_button_container_->SetBounds(width() - preferred_size.width(), 0,
+ preferred_size.width(), preferred_size.height());
+ }
+
+ virtual void ViewHierarchyChanged(
+ const ViewHierarchyChangedDetails& details) OVERRIDE {
+ if (details.is_add && details.child == this) {
+ caption_button_container_ = new FrameCaptionButtonContainerView(
+ GetWidget(), FrameCaptionButtonContainerView::MINIMIZE_ALLOWED);
+ AddChildView(caption_button_container_);
+ }
+ }
+
+ // Not owned.
+ ash::FrameCaptionButtonContainerView* caption_button_container_;
+
DISALLOW_COPY_AND_ASSIGN(TestWidgetDelegate);
};
} // namespace
-class CustomFrameViewAshTest : public ash::test::AshTestBase {
+class FrameMaximizeButtonTest : public ash::test::AshTestBase {
public:
- CustomFrameViewAshTest() {}
- virtual ~CustomFrameViewAshTest() {}
+ FrameMaximizeButtonTest() {}
+ virtual ~FrameMaximizeButtonTest() {}
- views::Widget* CreateWidget() {
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
+ // The returned widget takes ownership of |delegate|.
+ views::Widget* CreateWidget(views::WidgetDelegate* delegate) {
+ views::Widget::InitParams params(
+ views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
views::Widget* widget = new views::Widget;
params.context = CurrentContext();
- params.delegate = new TestWidgetDelegate;
+ params.delegate = delegate;
params.bounds = gfx::Rect(10, 10, 100, 100);
params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
widget->Init(params);
@@ -118,11 +137,12 @@ class CustomFrameViewAshTest : public ash::test::AshTestBase {
CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kAshDisableAlternateFrameCaptionButtonStyle);
- widget_ = CreateWidget();
- CustomFrameViewAsh* frame = static_cast<CustomFrameViewAsh*>(
- widget()->non_client_view()->frame_view());
- FrameCaptionButtonContainerView::TestApi test(
- frame->caption_button_container_);
+ TestWidgetDelegate* delegate = new TestWidgetDelegate();
+ widget_ = CreateWidget(delegate);
+ FrameCaptionButtonContainerView* caption_button_container =
+ delegate->caption_button_container();
+
+ FrameCaptionButtonContainerView::TestApi test(caption_button_container);
maximize_button_ = static_cast<FrameMaximizeButton*>(
test.size_button());
}
@@ -140,12 +160,12 @@ class CustomFrameViewAshTest : public ash::test::AshTestBase {
views::Widget* widget_;
FrameMaximizeButton* maximize_button_;
- DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAshTest);
+ DISALLOW_COPY_AND_ASSIGN(FrameMaximizeButtonTest);
};
// Tests that clicking on the resize-button toggles between maximize and normal
// state.
-TEST_F(CustomFrameViewAshTest, ResizeButtonToggleMaximize) {
+TEST_F(FrameMaximizeButtonTest, ResizeButtonToggleMaximize) {
aura::Window* window = widget()->GetNativeWindow();
views::View* view = maximize_button();
gfx::Point center = view->GetBoundsInScreen().CenterPoint();
@@ -185,7 +205,7 @@ TEST_F(CustomFrameViewAshTest, ResizeButtonToggleMaximize) {
#endif
// Tests that click+dragging on the resize-button tiles or minimizes the window.
-TEST_F(CustomFrameViewAshTest, MAYBE_ResizeButtonDrag) {
+TEST_F(FrameMaximizeButtonTest, MAYBE_ResizeButtonDrag) {
aura::Window* window = widget()->GetNativeWindow();
views::View* view = maximize_button();
gfx::Point center = view->GetBoundsInScreen().CenterPoint();
@@ -304,7 +324,7 @@ TEST_F(CustomFrameViewAshTest, MAYBE_ResizeButtonDrag) {
// Tests Left/Right snapping with resize button touch dragging - which should
// trigger dependent on the available drag distance.
-TEST_F(CustomFrameViewAshTest,
+TEST_F(FrameMaximizeButtonTest,
MAYBE_TouchDragResizeCloseToCornerDiffersFromMouse) {
aura::Window* window = widget()->GetNativeWindow();
views::View* view = maximize_button();
@@ -357,10 +377,10 @@ TEST_F(CustomFrameViewAshTest,
// Test that closing the (browser) window with an opened balloon does not
// crash the system. In other words: Make sure that shutting down the frame
// destroys the opened balloon in an orderly fashion.
-TEST_F(CustomFrameViewAshTest, MaximizeButtonExternalShutDown) {
+TEST_F(FrameMaximizeButtonTest, MaximizeButtonExternalShutDown) {
aura::Window* window = widget()->GetNativeWindow();
ash::FrameMaximizeButton* maximize_button =
- CustomFrameViewAshTest::maximize_button();
+ FrameMaximizeButtonTest::maximize_button();
maximize_button->set_bubble_appearance_delay_ms(0);
gfx::Point button_pos = maximize_button->GetBoundsInScreen().CenterPoint();
gfx::Point off_pos(button_pos.x() + 100, button_pos.y() + 100);
@@ -380,10 +400,10 @@ TEST_F(CustomFrameViewAshTest, MaximizeButtonExternalShutDown) {
// Test that maximizing the browser after hovering in does not crash the system
// when the observer gets removed in the bubble destruction process.
-TEST_F(CustomFrameViewAshTest, MaximizeOnHoverThenClick) {
+TEST_F(FrameMaximizeButtonTest, MaximizeOnHoverThenClick) {
aura::Window* window = widget()->GetNativeWindow();
ash::FrameMaximizeButton* maximize_button =
- CustomFrameViewAshTest::maximize_button();
+ FrameMaximizeButtonTest::maximize_button();
maximize_button->set_bubble_appearance_delay_ms(0);
gfx::Point button_pos = maximize_button->GetBoundsInScreen().CenterPoint();
gfx::Point off_pos(button_pos.x() + 100, button_pos.y() + 100);
@@ -403,10 +423,10 @@ TEST_F(CustomFrameViewAshTest, MaximizeOnHoverThenClick) {
// window. Moving then away from the button will hide it again. Then check that
// pressing and dragging the button itself off the button will also release the
// phantom window.
-TEST_F(CustomFrameViewAshTest, MaximizeLeftButtonDragOut) {
+TEST_F(FrameMaximizeButtonTest, MaximizeLeftButtonDragOut) {
aura::Window* window = widget()->GetNativeWindow();
ash::FrameMaximizeButton* maximize_button =
- CustomFrameViewAshTest::maximize_button();
+ FrameMaximizeButtonTest::maximize_button();
maximize_button->set_bubble_appearance_delay_ms(0);
gfx::Point button_pos = maximize_button->GetBoundsInScreen().CenterPoint();
gfx::Point off_pos(button_pos.x() + 100, button_pos.y() + 100);
@@ -448,10 +468,10 @@ TEST_F(CustomFrameViewAshTest, MaximizeLeftButtonDragOut) {
// Test that clicking a button in the maximizer bubble (in this case the
// maximize left button) will do the requested action.
-TEST_F(CustomFrameViewAshTest, MaximizeLeftByButton) {
+TEST_F(FrameMaximizeButtonTest, MaximizeLeftByButton) {
aura::Window* window = widget()->GetNativeWindow();
ash::FrameMaximizeButton* maximize_button =
- CustomFrameViewAshTest::maximize_button();
+ FrameMaximizeButtonTest::maximize_button();
maximize_button->set_bubble_appearance_delay_ms(0);
gfx::Point button_pos = maximize_button->GetBoundsInScreen().CenterPoint();
gfx::Point off_pos(button_pos.x() + 100, button_pos.y() + 100);
@@ -485,10 +505,10 @@ TEST_F(CustomFrameViewAshTest, MaximizeLeftByButton) {
}
// Test that the activation focus does not change when the bubble gets shown.
-TEST_F(CustomFrameViewAshTest, MaximizeKeepFocus) {
+TEST_F(FrameMaximizeButtonTest, MaximizeKeepFocus) {
aura::Window* window = widget()->GetNativeWindow();
ash::FrameMaximizeButton* maximize_button =
- CustomFrameViewAshTest::maximize_button();
+ FrameMaximizeButtonTest::maximize_button();
maximize_button->set_bubble_appearance_delay_ms(0);
gfx::Point button_pos = maximize_button->GetBoundsInScreen().CenterPoint();
gfx::Point off_pos(button_pos.x() + 100, button_pos.y() + 100);
@@ -508,11 +528,11 @@ TEST_F(CustomFrameViewAshTest, MaximizeKeepFocus) {
EXPECT_EQ(active, aura::client::GetFocusClient(window)->GetFocusedWindow());
}
-TEST_F(CustomFrameViewAshTest, MaximizeTap) {
+TEST_F(FrameMaximizeButtonTest, MaximizeTap) {
aura::Window* window = widget()->GetNativeWindow();
aura::RootWindow* root_window = window->GetRootWindow();
ash::FrameMaximizeButton* maximize_button =
- CustomFrameViewAshTest::maximize_button();
+ FrameMaximizeButtonTest::maximize_button();
gfx::Point button_pos = maximize_button->GetBoundsInScreen().CenterPoint();
const int touch_default_radius =
@@ -538,10 +558,10 @@ TEST_F(CustomFrameViewAshTest, MaximizeTap) {
}
// Test that only the left button will activate the maximize button.
-TEST_F(CustomFrameViewAshTest, OnlyLeftButtonMaximizes) {
+TEST_F(FrameMaximizeButtonTest, OnlyLeftButtonMaximizes) {
aura::Window* window = widget()->GetNativeWindow();
ash::FrameMaximizeButton* maximize_button =
- CustomFrameViewAshTest::maximize_button();
+ FrameMaximizeButtonTest::maximize_button();
maximize_button->set_bubble_appearance_delay_ms(0);
gfx::Point button_pos = maximize_button->GetBoundsInScreen().CenterPoint();
gfx::Point off_pos(button_pos.x() + 100, button_pos.y() + 100);
@@ -626,11 +646,11 @@ void ClickMaxButton(
}
// Test that the restore from left/right maximize is properly done.
-TEST_F(CustomFrameViewAshTest, MaximizeLeftRestore) {
+TEST_F(FrameMaximizeButtonTest, MaximizeLeftRestore) {
aura::Window* window = widget()->GetNativeWindow();
gfx::Rect initial_bounds = widget()->GetWindowBoundsInScreen();
ash::FrameMaximizeButton* maximize_button =
- CustomFrameViewAshTest::maximize_button();
+ FrameMaximizeButtonTest::maximize_button();
maximize_button->set_bubble_appearance_delay_ms(0);
ClickMaxButton(maximize_button, window, SNAP_LEFT);
@@ -654,11 +674,11 @@ TEST_F(CustomFrameViewAshTest, MaximizeLeftRestore) {
}
// Maximize, left/right maximize and then restore should works.
-TEST_F(CustomFrameViewAshTest, MaximizeMaximizeLeftRestore) {
+TEST_F(FrameMaximizeButtonTest, MaximizeMaximizeLeftRestore) {
aura::Window* window = widget()->GetNativeWindow();
gfx::Rect initial_bounds = widget()->GetWindowBoundsInScreen();
ash::FrameMaximizeButton* maximize_button =
- CustomFrameViewAshTest::maximize_button();
+ FrameMaximizeButtonTest::maximize_button();
maximize_button->set_bubble_appearance_delay_ms(0);
ClickMaxButton(maximize_button, window, SNAP_NONE);
@@ -684,11 +704,11 @@ TEST_F(CustomFrameViewAshTest, MaximizeMaximizeLeftRestore) {
}
// Left/right maximize, maximize and then restore should work.
-TEST_F(CustomFrameViewAshTest, MaximizeLeftMaximizeRestore) {
+TEST_F(FrameMaximizeButtonTest, MaximizeLeftMaximizeRestore) {
aura::Window* window = widget()->GetNativeWindow();
gfx::Rect initial_bounds = widget()->GetWindowBoundsInScreen();
ash::FrameMaximizeButton* maximize_button =
- CustomFrameViewAshTest::maximize_button();
+ FrameMaximizeButtonTest::maximize_button();
maximize_button->set_bubble_appearance_delay_ms(0);
ClickMaxButton(maximize_button, window, SNAP_LEFT);
@@ -707,37 +727,11 @@ TEST_F(CustomFrameViewAshTest, MaximizeLeftMaximizeRestore) {
// Make sure that there is no restore rectangle left.
EXPECT_EQ(NULL, GetRestoreBoundsInScreen(window));
}
-
-// Starting with a window which has no restore bounds, maximize then left/right
-// maximize should not be centered but left/right maximized.
-TEST_F(CustomFrameViewAshTest, MaximizeThenLeftMaximize) {
- aura::Window* window = widget()->GetNativeWindow();
- gfx::Rect initial_bounds = widget()->GetWindowBoundsInScreen();
- ash::FrameMaximizeButton* maximize_button =
- CustomFrameViewAshTest::maximize_button();
- maximize_button->set_bubble_appearance_delay_ms(0);
- // Make sure that there is no restore rectangle.
- EXPECT_EQ(NULL, GetRestoreBoundsInScreen(window));
-
- ClickMaxButton(maximize_button, window, SNAP_NONE);
- EXPECT_TRUE(ash::wm::IsWindowMaximized(window));
-
- ClickMaxButton(maximize_button, window, SNAP_LEFT);
- EXPECT_FALSE(ash::wm::IsWindowMaximized(window));
-
- gfx::Rect new_bounds = widget()->GetWindowBoundsInScreen();
- EXPECT_EQ(new_bounds.x(), 0);
- EXPECT_EQ(new_bounds.y(), 0);
- // Make sure that the restore rectangle is the original rectangle.
- EXPECT_EQ(initial_bounds.ToString(),
- GetRestoreBoundsInScreen(window)->ToString());
-}
-
// Test that minimizing the window per keyboard closes the maximize bubble.
-TEST_F(CustomFrameViewAshTest, MinimizePerKeyClosesBubble) {
+TEST_F(FrameMaximizeButtonTest, MinimizePerKeyClosesBubble) {
aura::Window* window = widget()->GetNativeWindow();
ash::FrameMaximizeButton* maximize_button =
- CustomFrameViewAshTest::maximize_button();
+ FrameMaximizeButtonTest::maximize_button();
gfx::Point button_pos = maximize_button->GetBoundsInScreen().CenterPoint();
gfx::Point off_pos(button_pos.x() + 100, button_pos.y() + 100);
@@ -758,10 +752,10 @@ TEST_F(CustomFrameViewAshTest, MinimizePerKeyClosesBubble) {
}
// Tests that dragging down on the maximize button minimizes the window.
-TEST_F(CustomFrameViewAshTest, MaximizeButtonDragDownMinimizes) {
+TEST_F(FrameMaximizeButtonTest, MaximizeButtonDragDownMinimizes) {
aura::Window* window = widget()->GetNativeWindow();
ash::FrameMaximizeButton* maximize_button =
- CustomFrameViewAshTest::maximize_button();
+ FrameMaximizeButtonTest::maximize_button();
// Drag down on a maximized window.
wm::MaximizeWindow(window);
@@ -788,11 +782,11 @@ TEST_F(CustomFrameViewAshTest, MaximizeButtonDragDownMinimizes) {
}
// Tests that dragging Left and pressing ESC does properly abort.
-TEST_F(CustomFrameViewAshTest, MaximizeButtonDragLeftEscapeExits) {
+TEST_F(FrameMaximizeButtonTest, MaximizeButtonDragLeftEscapeExits) {
aura::Window* window = widget()->GetNativeWindow();
gfx::Rect initial_bounds = widget()->GetWindowBoundsInScreen();
ash::FrameMaximizeButton* maximize_button =
- CustomFrameViewAshTest::maximize_button();
+ FrameMaximizeButtonTest::maximize_button();
gfx::Point button_pos = maximize_button->GetBoundsInScreen().CenterPoint();
gfx::Point off_pos(button_pos.x() - button_pos.x() / 2, button_pos.y());
diff --git a/ash/wm/maximize_bubble_controller.cc b/ash/wm/caption_buttons/maximize_bubble_controller.cc
index ae108ca3ba..088db3cb71 100644
--- a/ash/wm/maximize_bubble_controller.cc
+++ b/ash/wm/caption_buttons/maximize_bubble_controller.cc
@@ -1,22 +1,22 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ash/wm/maximize_bubble_controller.h"
+#include "ash/wm/caption_buttons/maximize_bubble_controller.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/shell_window_ids.h"
+#include "ash/wm/caption_buttons/frame_maximize_button.h"
#include "ash/wm/window_animations.h"
-#include "ash/wm/workspace/frame_maximize_button.h"
#include "base/timer/timer.h"
#include "grit/ash_resources.h"
#include "grit/ash_strings.h"
#include "third_party/skia/include/core/SkPath.h"
#include "ui/aura/window.h"
-#include "ui/base/animation/animation.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/gfx/animation/animation.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/path.h"
#include "ui/gfx/screen.h"
@@ -218,7 +218,7 @@ class MaximizeBubbleController::Bubble : public views::BubbleDelegateView,
// Overridden from views::BubbleDelegateView.
virtual gfx::Rect GetAnchorRect() OVERRIDE;
- virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
+ virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
virtual bool CanActivate() const OVERRIDE { return false; }
// Overridden from views::WidgetDelegateView.
@@ -390,7 +390,7 @@ MaximizeBubbleController::Bubble::Bubble(
// The window needs to be owned by the root so that the SnapSizer does not
// cover it upon animation.
aura::Window* parent = Shell::GetContainer(
- Shell::GetActiveRootWindow(),
+ Shell::GetTargetRootWindow(),
internal::kShellWindowId_ShelfContainer);
set_parent_window(parent);
@@ -457,7 +457,7 @@ gfx::Rect MaximizeBubbleController::Bubble::GetAnchorRect() {
}
void MaximizeBubbleController::Bubble::AnimationProgressed(
- const ui::Animation* animation) {
+ const gfx::Animation* animation) {
// First do everything needed for the fade by calling the base function.
BubbleDelegateView::AnimationProgressed(animation);
// When fading in we are done.
diff --git a/ash/wm/maximize_bubble_controller.h b/ash/wm/caption_buttons/maximize_bubble_controller.h
index 7328ea29c0..602efd8a58 100644
--- a/ash/wm/maximize_bubble_controller.h
+++ b/ash/wm/caption_buttons/maximize_bubble_controller.h
@@ -1,12 +1,12 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef ASH_WM_MAXIMIZE_BUBBLE_CONTROLLER_H_
-#define ASH_WM_MAXIMIZE_BUBBLE_CONTROLLER_H_
+#ifndef ASH_WM_CAPTION_BUTTONS_MAXIMIZE_BUBBLE_CONTROLLER_H_
+#define ASH_WM_CAPTION_BUTTONS_MAXIMIZE_BUBBLE_CONTROLLER_H_
#include "ash/ash_export.h"
-#include "ash/wm/workspace/maximize_bubble_frame_state.h"
+#include "ash/wm/caption_buttons/maximize_bubble_frame_state.h"
#include "ash/wm/workspace/snap_types.h"
#include "base/memory/scoped_ptr.h"
@@ -98,4 +98,4 @@ class ASH_EXPORT MaximizeBubbleController {
} // namespace ash
-#endif // ASH_WM_MAXIMIZE_BUBBLE_CONTROLLER_H_
+#endif // ASH_WM_CAPTION_BUTTONS_MAXIMIZE_BUBBLE_CONTROLLER_H_
diff --git a/ash/wm/workspace/maximize_bubble_frame_state.h b/ash/wm/caption_buttons/maximize_bubble_frame_state.h
index 80fb835d8b..1737818255 100644
--- a/ash/wm/workspace/maximize_bubble_frame_state.h
+++ b/ash/wm/caption_buttons/maximize_bubble_frame_state.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef ASH_WM_WORKSPACE_MAXIMIZE_BUBBLE_FRAME_STATE_H_
-#define ASH_WM_WORKSPACE_MAXIMIZE_BUBBLE_FRAME_STATE_H_
+#ifndef ASH_WM_CAPTION_BUTTONS_MAXIMIZE_BUBBLE_FRAME_STATE_H_
+#define ASH_WM_CAPTION_BUTTONS_MAXIMIZE_BUBBLE_FRAME_STATE_H_
namespace ash {
@@ -17,4 +17,4 @@ enum MaximizeBubbleFrameState {
} // namespace views
-#endif // ASH_WM_WORKSPACE_MAXIMIZE_BUBBLE_FRAME_STATE_H_
+#endif // ASH_WM_CAPTION_BUTTONS_MAXIMIZE_BUBBLE_FRAME_STATE_H_
diff --git a/ash/wm/custom_frame_view_ash.cc b/ash/wm/custom_frame_view_ash.cc
index 7824464d31..a606f01a2f 100644
--- a/ash/wm/custom_frame_view_ash.cc
+++ b/ash/wm/custom_frame_view_ash.cc
@@ -4,8 +4,8 @@
#include "ash/wm/custom_frame_view_ash.h"
+#include "ash/wm/caption_buttons/frame_caption_button_container_view.h"
#include "ash/wm/frame_painter.h"
-#include "ash/wm/workspace/frame_caption_button_container_view.h"
#include "grit/ash_resources.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
@@ -53,7 +53,7 @@ void CustomFrameViewAsh::Init(views::Widget* frame) {
frame_->widget_delegate()->CanMaximize() ?
FrameCaptionButtonContainerView::MINIMIZE_ALLOWED :
FrameCaptionButtonContainerView::MINIMIZE_DISALLOWED;
- caption_button_container_ = new FrameCaptionButtonContainerView(this, frame,
+ caption_button_container_ = new FrameCaptionButtonContainerView(frame,
minimize_allowed);
AddChildView(caption_button_container_);
diff --git a/ash/wm/custom_frame_view_ash.h b/ash/wm/custom_frame_view_ash.h
index 57526b4806..8628e254af 100644
--- a/ash/wm/custom_frame_view_ash.h
+++ b/ash/wm/custom_frame_view_ash.h
@@ -61,8 +61,6 @@ class ASH_EXPORT CustomFrameViewAsh : public views::NonClientFrameView {
virtual gfx::Size GetMaximumSize() OVERRIDE;
private:
- friend class test::CustomFrameViewAshTest;
-
// Height from top of window to top of client area.
int NonClientTopBorderHeight() const;
diff --git a/ash/wm/dock/docked_window_layout_manager.cc b/ash/wm/dock/docked_window_layout_manager.cc
index 36998df309..30701a94c6 100644
--- a/ash/wm/dock/docked_window_layout_manager.cc
+++ b/ash/wm/dock/docked_window_layout_manager.cc
@@ -4,6 +4,7 @@
#include "ash/wm/dock/docked_window_layout_manager.h"
+#include "ash/ash_switches.h"
#include "ash/launcher/launcher.h"
#include "ash/screen_ash.h"
#include "ash/shelf/shelf_layout_manager.h"
@@ -12,9 +13,11 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/coordinate_conversion.h"
+#include "ash/wm/window_animations.h"
#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
#include "base/auto_reset.h"
+#include "base/command_line.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/aura_constants.h"
@@ -27,10 +30,12 @@ namespace ash {
namespace internal {
// Minimum, maximum width of the dock area and a width of the gap
+// static
+const int DockedWindowLayoutManager::kMaxDockWidth = 360;
+// static
const int DockedWindowLayoutManager::kMinDockWidth = 200;
-const int DockedWindowLayoutManager::kMaxDockWidth = 450;
+// static
const int DockedWindowLayoutManager::kMinDockGap = 2;
-const int kWindowIdealSpacing = 4;
namespace {
@@ -60,7 +65,6 @@ class DockedBackgroundWidget : public views::Widget {
content_view->set_background(
views::Background::CreateSolidBackground(kDockBackgroundColor));
SetContentsView(content_view);
- GetNativeWindow()->layer()->SetOpacity(kDockBackgroundOpacity);
Hide();
}
@@ -207,6 +211,7 @@ void DockedWindowLayoutManager::DockDraggedWindow(aura::Window* window) {
void DockedWindowLayoutManager::UndockDraggedWindow() {
OnWindowUndocked();
Relayout();
+ UpdateDockBounds();
is_dragged_from_dock_ = false;
}
@@ -217,9 +222,13 @@ void DockedWindowLayoutManager::FinishDragging() {
DCHECK (!is_dragged_window_docked_);
// Stop observing a window unless it is docked container's child in which
// case it needs to keep being observed after the drag completes.
- if (dragged_window_->parent() != dock_container_)
+ if (dragged_window_->parent() != dock_container_) {
dragged_window_->RemoveObserver(this);
+ if (last_active_window_ == dragged_window_)
+ last_active_window_ = NULL;
+ }
dragged_window_ = NULL;
+ dragged_bounds_ = gfx::Rect();
Relayout();
UpdateDockBounds();
}
@@ -239,26 +248,20 @@ void DockedWindowLayoutManager::SetLauncher(ash::Launcher* launcher) {
DockedAlignment DockedWindowLayoutManager::GetAlignmentOfWindow(
const aura::Window* window) const {
const gfx::Rect& bounds(window->GetBoundsInScreen());
- const gfx::Rect docked_bounds = dock_container_->GetBoundsInScreen();
- // Do not allow docking if a window is vertically maximized (as is the case
- // when it is snapped).
- const gfx::Rect work_area =
- Shell::GetScreen()->GetDisplayNearestWindow(dock_container_).work_area();
- if (bounds.y() == work_area.y() && bounds.height() == work_area.height())
- return DOCKED_ALIGNMENT_NONE;
-
- // Do not allow docking on the same side as launcher shelf.
- ShelfAlignment shelf_alignment = SHELF_ALIGNMENT_BOTTOM;
- if (launcher_)
- shelf_alignment = launcher_->alignment();
+ // Test overlap with an existing docked area first.
+ if (docked_bounds_.Intersects(bounds) &&
+ alignment_ != DOCKED_ALIGNMENT_NONE) {
+ // A window is being added to other docked windows (on the same side).
+ return alignment_;
+ }
- if (bounds.x() == docked_bounds.x() &&
- shelf_alignment != SHELF_ALIGNMENT_LEFT) {
+ const gfx::Rect container_bounds = dock_container_->GetBoundsInScreen();
+ if (bounds.x() <= container_bounds.x() &&
+ bounds.right() > container_bounds.x()) {
return DOCKED_ALIGNMENT_LEFT;
- }
- if (bounds.right() == docked_bounds.right() &&
- shelf_alignment != SHELF_ALIGNMENT_RIGHT) {
+ } else if (bounds.x() < container_bounds.right() &&
+ bounds.right() >= container_bounds.right()) {
return DOCKED_ALIGNMENT_RIGHT;
}
return DOCKED_ALIGNMENT_NONE;
@@ -281,6 +284,30 @@ DockedAlignment DockedWindowLayoutManager::CalculateAlignment() const {
return DOCKED_ALIGNMENT_NONE;
}
+bool DockedWindowLayoutManager::CanDockWindow(aura::Window* window,
+ SnapType edge) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kAshEnableDockedWindows)) {
+ return false;
+ }
+ // Cannot dock on the other size from an existing dock.
+ const DockedAlignment alignment = CalculateAlignment();
+ if ((edge == SNAP_LEFT && alignment == DOCKED_ALIGNMENT_RIGHT) ||
+ (edge == SNAP_RIGHT && alignment == DOCKED_ALIGNMENT_LEFT)) {
+ return false;
+ }
+
+ // Do not allow docking on the same side as launcher shelf.
+ ShelfAlignment shelf_alignment = SHELF_ALIGNMENT_BOTTOM;
+ if (launcher_)
+ shelf_alignment = launcher_->alignment();
+ if ((edge == SNAP_LEFT && shelf_alignment == SHELF_ALIGNMENT_LEFT) ||
+ (edge == SNAP_RIGHT && shelf_alignment == SHELF_ALIGNMENT_RIGHT)) {
+ return false;
+ }
+ return true;
+}
+
////////////////////////////////////////////////////////////////////////////////
// DockLayoutManager, aura::LayoutManager implementation:
void DockedWindowLayoutManager::OnWindowResized() {
@@ -448,6 +475,8 @@ void DockedWindowLayoutManager::WillChangeVisibilityState(
base::AutoReset<bool> auto_reset_in_layout(&in_layout_, true);
for (size_t i = 0; i < dock_container_->children().size(); ++i) {
aura::Window* window = dock_container_->children()[i];
+ if (window->type() == aura::client::WINDOW_TYPE_POPUP)
+ continue;
if (shelf_hidden_) {
if (window->IsVisible())
MinimizeWindow(window);
@@ -465,12 +494,16 @@ void DockedWindowLayoutManager::WillChangeVisibilityState(
// DockLayoutManager private implementation:
void DockedWindowLayoutManager::MinimizeWindow(aura::Window* window) {
+ DCHECK_NE(window->type(), aura::client::WINDOW_TYPE_POPUP);
+ views::corewm::SetWindowVisibilityAnimationType(
+ window, WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
window->Hide();
if (wm::IsActiveWindow(window))
wm::DeactivateWindow(window);
}
void DockedWindowLayoutManager::RestoreWindow(aura::Window* window) {
+ DCHECK_NE(window->type(), aura::client::WINDOW_TYPE_POPUP);
window->Show();
}
@@ -564,6 +597,17 @@ void DockedWindowLayoutManager::Relayout() {
aura::Window* window = *iter;
gfx::Rect bounds = window->GetBoundsInScreen();
+ DockedAlignment alignment = alignment_;
+ if (alignment == DOCKED_ALIGNMENT_NONE && window == dragged_window_) {
+ alignment = GetAlignmentOfWindow(window);
+ if (alignment == DOCKED_ALIGNMENT_NONE)
+ bounds.set_size(gfx::Size());
+ }
+
+ // Restrict width.
+ if (bounds.width() > kMaxDockWidth)
+ bounds.set_width(kMaxDockWidth);
+
// Fan out windows evenly distributing the overlap or remaining free space.
bounds.set_y(std::max(work_area.y(),
std::min(work_area.bottom() - bounds.height(),
@@ -572,7 +616,7 @@ void DockedWindowLayoutManager::Relayout() {
// All docked windows other than the one currently dragged remain stuck
// to the screen edge.
- switch (alignment_) {
+ switch (alignment) {
case DOCKED_ALIGNMENT_LEFT:
bounds.set_x(dock_bounds.x());
break;
@@ -586,6 +630,8 @@ void DockedWindowLayoutManager::Relayout() {
dragged_bounds_ = bounds;
continue;
}
+ // If the following asserts it is probably because not all the children
+ // have been removed when dock was closed.
DCHECK_NE(alignment_, DOCKED_ALIGNMENT_NONE);
// Keep the dock at least kMinDockWidth when all windows in it overhang.
docked_width_ = std::min(kMaxDockWidth,
@@ -620,10 +666,13 @@ void DockedWindowLayoutManager::UpdateDockBounds() {
Shell::GetScreen()->GetDisplayNearestWindow(dock_container_).work_area();
background_bounds.set_height(work_area.height());
background_widget_->SetBounds(background_bounds);
- if (docked_width_ > 0)
+ if (docked_width_ > 0) {
background_widget_->Show();
- else
+ background_widget_->GetNativeWindow()->layer()->SetOpacity(
+ kDockBackgroundOpacity);
+ } else {
background_widget_->Hide();
+ }
}
void DockedWindowLayoutManager::UpdateStacking(aura::Window* active_window) {
diff --git a/ash/wm/dock/docked_window_layout_manager.h b/ash/wm/dock/docked_window_layout_manager.h
index a3019aa717..e4542b357c 100644
--- a/ash/wm/dock/docked_window_layout_manager.h
+++ b/ash/wm/dock/docked_window_layout_manager.h
@@ -10,6 +10,7 @@
#include "ash/shell_observer.h"
#include "ash/wm/dock/dock_types.h"
#include "ash/wm/property_util.h"
+#include "ash/wm/workspace/snap_types.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
@@ -61,6 +62,9 @@ class ASH_EXPORT DockedWindowLayoutManager
public keyboard::KeyboardControllerObserver,
public ash::ShelfLayoutManagerObserver {
public:
+ // Maximum width of the docked windows area.
+ static const int kMaxDockWidth;
+
explicit DockedWindowLayoutManager(aura::Window* dock_container);
virtual ~DockedWindowLayoutManager();
@@ -94,6 +98,10 @@ class ASH_EXPORT DockedWindowLayoutManager
// Used to snap docked windows to the side of screen during drag.
DockedAlignment CalculateAlignment() const;
+ // Returns true when a window can be docked. Windows cannot be docked at the
+ // edge used by the launcher shelf or the edge opposite from existing dock.
+ bool CanDockWindow(aura::Window* window, SnapType edge);
+
aura::Window* dock_container() const { return dock_container_; }
// Returns current bounding rectangle of docked windows area.
@@ -102,6 +110,9 @@ class ASH_EXPORT DockedWindowLayoutManager
// Returns last known coordinates of |dragged_window_| after Relayout.
const gfx::Rect dragged_bounds() const { return dragged_bounds_;}
+ // Returns true if currently dragged window is docked at the screen edge.
+ bool is_dragged_window_docked() const { return is_dragged_window_docked_; }
+
// aura::LayoutManager:
virtual void OnWindowResized() OVERRIDE;
virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
@@ -138,15 +149,16 @@ class ASH_EXPORT DockedWindowLayoutManager
FRIEND_TEST_ALL_PREFIXES(DockedWindowResizerTest, AttachOneTestSticky);
FRIEND_TEST_ALL_PREFIXES(DockedWindowResizerTest, ResizeTwoWindows);
FRIEND_TEST_ALL_PREFIXES(DockedWindowResizerTest, DragToShelf);
+ FRIEND_TEST_ALL_PREFIXES(DockedWindowLayoutManagerTest, AutoPlacingLeft);
+ FRIEND_TEST_ALL_PREFIXES(DockedWindowLayoutManagerTest, AutoPlacingRight);
+ FRIEND_TEST_ALL_PREFIXES(DockedWindowLayoutManagerTest,
+ AutoPlacingRightSecondScreen);
friend class DockedWindowLayoutManagerTest;
friend class DockedWindowResizerTest;
// Minimum width of the docked windows area.
static const int kMinDockWidth;
- // Maximum width of the docked windows area.
- static const int kMaxDockWidth;
-
// Width of the gap between the docked windows and a workspace.
static const int kMinDockGap;
diff --git a/ash/wm/dock/docked_window_layout_manager_unittest.cc b/ash/wm/dock/docked_window_layout_manager_unittest.cc
index a29f7a3fa0..14ba0ab53b 100644
--- a/ash/wm/dock/docked_window_layout_manager_unittest.cc
+++ b/ash/wm/dock/docked_window_layout_manager_unittest.cc
@@ -16,14 +16,18 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/test/ash_test_base.h"
+#include "ash/test/launcher_test_api.h"
#include "ash/test/launcher_view_test_api.h"
#include "ash/test/shell_test_api.h"
#include "ash/test/test_launcher_delegate.h"
+#include "ash/wm/coordinate_conversion.h"
#include "ash/wm/panels/panel_layout_manager.h"
#include "ash/wm/window_resizer.h"
#include "ash/wm/window_settings.h"
+#include "ash/wm/window_util.h"
#include "base/basictypes.h"
#include "base/command_line.h"
+#include "base/strings/string_number_conversions.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
@@ -51,7 +55,7 @@ class DockedWindowLayoutManagerTest
ASSERT_TRUE(test::TestLauncherDelegate::instance());
launcher_view_test_.reset(new test::LauncherViewTestAPI(
- Launcher::ForPrimaryDisplay()->GetLauncherViewForTest()));
+ test::LauncherTestAPI(Launcher::ForPrimaryDisplay()).launcher_view()));
launcher_view_test_->SetAnimationDuration(1);
}
@@ -97,16 +101,11 @@ class DockedWindowLayoutManagerTest
}
void DragStart(aura::Window* window) {
- initial_location_in_parent_ = window->bounds().origin();
- resizer_.reset(CreateSomeWindowResizer(window,
- initial_location_in_parent_,
- HTCAPTION));
- ASSERT_TRUE(resizer_.get());
+ DragStartAtOffsetFromwindowOrigin(window, 0, 0);
}
void DragStartAtOffsetFromwindowOrigin(aura::Window* window,
- int dx,
- int dy) {
+ int dx, int dy) {
initial_location_in_parent_ =
window->bounds().origin() + gfx::Vector2d(dx, dy);
resizer_.reset(CreateSomeWindowResizer(window,
@@ -169,48 +168,31 @@ class DockedWindowLayoutManagerTest
// horizontally to the edge with an added offset from the edge of |dx|.
void DragVerticallyAndRelativeToEdge(DockedEdge edge,
aura::Window* window,
- int dx,
- int dy) {
- aura::RootWindow* root_window = window->GetRootWindow();
+ int dx, int dy) {
gfx::Rect initial_bounds = window->GetBoundsInScreen();
-
- if (window_type_ == aura::client::WINDOW_TYPE_PANEL) {
- ASSERT_NO_FATAL_FAILURE(DragStart(window));
- EXPECT_TRUE(wm::GetWindowSettings(window)->panel_attached());
-
- // Drag enough to detach since our tests assume panels to be initially
- // detached.
- DragMove(0, dy);
- EXPECT_EQ(CorrectContainerIdDuringDrag(), window->parent()->id());
- EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x());
- EXPECT_EQ(initial_bounds.y() + dy, window->GetBoundsInScreen().y());
-
- // The panel should be detached when the drag completes.
- DragEnd();
-
- EXPECT_FALSE(wm::GetWindowSettings(window)->panel_attached());
- EXPECT_EQ(internal::kShellWindowId_DefaultContainer,
- window->parent()->id());
- EXPECT_EQ(root_window, window->GetRootWindow());
- }
-
// avoid snap by clicking away from the border
ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(window, 25, 5));
+ gfx::Rect work_area =
+ Shell::GetScreen()->GetDisplayNearestWindow(window).work_area();
+ gfx::Point initial_location_in_screen = initial_location_in_parent_;
+ wm::ConvertPointToScreen(window->parent(), &initial_location_in_screen);
// Drag the window left or right to the edge (or almost to it).
if (edge == DOCKED_EDGE_LEFT)
- dx += window->GetRootWindow()->bounds().x() - initial_bounds.x();
+ dx += work_area.x() - initial_location_in_screen.x();
else if (edge == DOCKED_EDGE_RIGHT)
- dx += window->GetRootWindow()->bounds().right() - initial_bounds.right();
- DragMove(dx, window_type_ == aura::client::WINDOW_TYPE_PANEL ? 0 : dy);
+ dx += work_area.right() - 1 - initial_location_in_screen.x();
+ DragMove(dx, dy);
EXPECT_EQ(CorrectContainerIdDuringDrag(), window->parent()->id());
// Release the mouse and the panel should be attached to the dock.
DragEnd();
// x-coordinate can get adjusted by snapping or sticking.
// y-coordinate could be changed by possible automatic layout if docked.
- if (window->parent()->id() != internal::kShellWindowId_DockedContainer)
+ if (window->parent()->id() != internal::kShellWindowId_DockedContainer &&
+ GetRestoreBoundsInScreen(window) == NULL) {
EXPECT_EQ(initial_bounds.y() + dy, window->GetBoundsInScreen().y());
+ }
}
private:
@@ -240,6 +222,162 @@ TEST_P(DockedWindowLayoutManagerTest, AddOneWindow) {
EXPECT_EQ(internal::kShellWindowId_DockedContainer, window->parent()->id());
}
+// Tests that with a window docked on the left the auto-placing logic in
+// RearrangeVisibleWindowOnShow places windows flush with work area edges.
+TEST_P(DockedWindowLayoutManagerTest, AutoPlacingLeft) {
+ if (!SupportsHostWindowResize())
+ return;
+
+ gfx::Rect bounds(0, 0, 201, 201);
+ scoped_ptr<aura::Window> window(CreateTestWindow(bounds));
+ DragRelativeToEdge(DOCKED_EDGE_LEFT, window.get(), 0);
+
+ // The window should be attached and snapped to the right side of the screen.
+ EXPECT_EQ(window->GetRootWindow()->bounds().x(),
+ window->GetBoundsInScreen().x());
+ EXPECT_EQ(internal::kShellWindowId_DockedContainer, window->parent()->id());
+
+ DockedWindowLayoutManager* manager = static_cast<DockedWindowLayoutManager*>(
+ window->parent()->layout_manager());
+
+ // Create two additional windows and test their auto-placement
+ scoped_ptr<aura::Window> window1(CreateTestWindowInShellWithId(1));
+ gfx::Rect desktop_area = window1->parent()->bounds();
+ wm::GetWindowSettings(window1.get())->set_window_position_managed(true);
+ window1->Hide();
+ window1->SetBounds(gfx::Rect(250, 32, 231, 320));
+ window1->Show();
+ // |window1| should be centered in work area.
+ EXPECT_EQ(base::IntToString(
+ manager->docked_width_ + DockedWindowLayoutManager::kMinDockGap +
+ (desktop_area.width() - manager->docked_width_ -
+ DockedWindowLayoutManager::kMinDockGap - window1->bounds().width()) / 2)+
+ ",32 231x320", window1->bounds().ToString());
+
+ scoped_ptr<aura::Window> window2(CreateTestWindowInShellWithId(2));
+ wm::GetWindowSettings(window2.get())->set_window_position_managed(true);
+ // To avoid any auto window manager changes due to SetBounds, the window
+ // gets first hidden and then shown again.
+ window2->Hide();
+ window2->SetBounds(gfx::Rect(250, 48, 150, 300));
+ window2->Show();
+
+ // |window1| should be flush left and |window2| flush right.
+ EXPECT_EQ(
+ base::IntToString(
+ manager->docked_width_ + DockedWindowLayoutManager::kMinDockGap) +
+ ",32 231x320", window1->bounds().ToString());
+ EXPECT_EQ(
+ base::IntToString(
+ desktop_area.width() - window2->bounds().width()) +
+ ",48 150x300", window2->bounds().ToString());
+}
+
+// Tests that with a window docked on the right the auto-placing logic in
+// RearrangeVisibleWindowOnShow places windows flush with work area edges.
+TEST_P(DockedWindowLayoutManagerTest, AutoPlacingRight) {
+ if (!SupportsHostWindowResize())
+ return;
+
+ gfx::Rect bounds(0, 0, 201, 201);
+ scoped_ptr<aura::Window> window(CreateTestWindow(bounds));
+ DragRelativeToEdge(DOCKED_EDGE_RIGHT, window.get(), 0);
+
+ // The window should be attached and snapped to the right side of the screen.
+ EXPECT_EQ(window->GetRootWindow()->bounds().right(),
+ window->GetBoundsInScreen().right());
+ EXPECT_EQ(internal::kShellWindowId_DockedContainer, window->parent()->id());
+
+ DockedWindowLayoutManager* manager = static_cast<DockedWindowLayoutManager*>(
+ window->parent()->layout_manager());
+
+ // Create two additional windows and test their auto-placement
+ scoped_ptr<aura::Window> window1(CreateTestWindowInShellWithId(1));
+ gfx::Rect desktop_area = window1->parent()->bounds();
+ wm::GetWindowSettings(window1.get())->set_window_position_managed(true);
+ window1->Hide();
+ window1->SetBounds(gfx::Rect(16, 32, 231, 320));
+ window1->Show();
+
+ // |window1| should be centered in work area.
+ EXPECT_EQ(base::IntToString(
+ (desktop_area.width() - manager->docked_width_ -
+ DockedWindowLayoutManager::kMinDockGap - window1->bounds().width()) / 2)+
+ ",32 231x320", window1->bounds().ToString());
+
+ scoped_ptr<aura::Window> window2(CreateTestWindowInShellWithId(2));
+ wm::GetWindowSettings(window2.get())->set_window_position_managed(true);
+ // To avoid any auto window manager changes due to SetBounds, the window
+ // gets first hidden and then shown again.
+ window2->Hide();
+ window2->SetBounds(gfx::Rect(32, 48, 256, 512));
+ window2->Show();
+
+ // |window1| should be flush left and |window2| flush right.
+ EXPECT_EQ("0,32 231x320", window1->bounds().ToString());
+ EXPECT_EQ(
+ base::IntToString(
+ desktop_area.width() - window2->bounds().width() -
+ manager->docked_width_ - DockedWindowLayoutManager::kMinDockGap) +
+ ",48 256x512", window2->bounds().ToString());
+}
+
+// Tests that with a window docked on the right the auto-placing logic in
+// RearrangeVisibleWindowOnShow places windows flush with work area edges.
+// Test case for the secondary screen.
+TEST_P(DockedWindowLayoutManagerTest, AutoPlacingRightSecondScreen) {
+ if (!SupportsMultipleDisplays() || !SupportsHostWindowResize())
+ return;
+
+ // Create two screen layout.
+ UpdateDisplay("600x600,600x600");
+
+ gfx::Rect bounds(600, 0, 201, 201);
+ scoped_ptr<aura::Window> window(CreateTestWindow(bounds));
+ // Drag pointer to the right edge of the second screen.
+ DragRelativeToEdge(DOCKED_EDGE_RIGHT, window.get(), 0);
+
+ // The window should be attached and snapped to the right side of the screen.
+ EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().right(),
+ window->GetBoundsInScreen().right());
+ EXPECT_EQ(internal::kShellWindowId_DockedContainer, window->parent()->id());
+
+ DockedWindowLayoutManager* manager = static_cast<DockedWindowLayoutManager*>(
+ window->parent()->layout_manager());
+
+ // Create two additional windows and test their auto-placement
+ bounds = gfx::Rect(616, 32, 231, 320);
+ scoped_ptr<aura::Window> window1(
+ CreateTestWindowInShellWithDelegate(NULL, 1, bounds));
+ gfx::Rect desktop_area = window1->parent()->bounds();
+ wm::GetWindowSettings(window1.get())->set_window_position_managed(true);
+ window1->Hide();
+ window1->Show();
+
+ // |window1| should be centered in work area.
+ EXPECT_EQ(base::IntToString(
+ 600 + (desktop_area.width() - manager->docked_width_ -
+ DockedWindowLayoutManager::kMinDockGap - window1->bounds().width()) / 2)+
+ ",32 231x320", window1->GetBoundsInScreen().ToString());
+
+ bounds = gfx::Rect(632, 48, 256, 512);
+ scoped_ptr<aura::Window> window2(
+ CreateTestWindowInShellWithDelegate(NULL, 2, bounds));
+ wm::GetWindowSettings(window2.get())->set_window_position_managed(true);
+ // To avoid any auto window manager changes due to SetBounds, the window
+ // gets first hidden and then shown again.
+ window2->Hide();
+ window2->Show();
+
+ // |window1| should be flush left and |window2| flush right.
+ EXPECT_EQ("600,32 231x320", window1->GetBoundsInScreen().ToString());
+ EXPECT_EQ(
+ base::IntToString(
+ 600 + desktop_area.width() - window2->bounds().width() -
+ manager->docked_width_ - DockedWindowLayoutManager::kMinDockGap) +
+ ",48 256x512", window2->GetBoundsInScreen().ToString());
+}
+
// Adds two windows and tests that the gaps are evenly distributed.
TEST_P(DockedWindowLayoutManagerTest, AddTwoWindows) {
if (!SupportsHostWindowResize())
@@ -288,7 +426,7 @@ TEST_P(DockedWindowLayoutManagerTest, TwoWindowsDragging) {
// Drag w2 above w1.
ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(w2.get(), 0, 20));
- DragMove(0, w1->bounds().y() - w2->bounds().y() - 20);
+ DragMove(0, w1->bounds().y() - w2->bounds().y() + 20);
DragEnd();
// Test the new windows order and that the gaps differ at most by a pixel.
@@ -362,13 +500,11 @@ TEST_P(DockedWindowLayoutManagerTest, ThreeWindowsDragging) {
// Adds three windows in bottom display and tests layout after a drag.
TEST_P(DockedWindowLayoutManagerTest, ThreeWindowsDraggingSecondScreen) {
- if (!SupportsMultipleDisplays())
- return;
- if (!SupportsHostWindowResize())
+ if (!SupportsMultipleDisplays() || !SupportsHostWindowResize())
return;
// Create two screen vertical layout.
- UpdateDisplay("100+100-600x600,100+700-600x600");
+ UpdateDisplay("600x600,600x600");
// Layout the secondary display to the bottom of the primary.
DisplayLayout layout(DisplayLayout::BOTTOM, 0);
ASSERT_GT(Shell::GetScreen()->GetNumDisplays(), 1);
diff --git a/ash/wm/dock/docked_window_resizer.cc b/ash/wm/dock/docked_window_resizer.cc
index b3561751fd..e16895598d 100644
--- a/ash/wm/dock/docked_window_resizer.cc
+++ b/ash/wm/dock/docked_window_resizer.cc
@@ -5,6 +5,7 @@
#include "ash/wm/dock/docked_window_resizer.h"
#include "ash/ash_switches.h"
+#include "ash/display/display_controller.h"
#include "ash/launcher/launcher.h"
#include "ash/root_window_controller.h"
#include "ash/screen_ash.h"
@@ -17,7 +18,6 @@
#include "ash/wm/property_util.h"
#include "ash/wm/window_settings.h"
#include "ash/wm/workspace/magnetism_matcher.h"
-#include "ash/wm/workspace/phantom_window_controller.h"
#include "ash/wm/workspace/workspace_window_resizer.h"
#include "base/command_line.h"
#include "base/memory/weak_ptr.h"
@@ -38,9 +38,13 @@ namespace {
DockedWindowLayoutManager* GetDockedLayoutManagerAtPoint(
const gfx::Point& point) {
+ gfx::Display display = ScreenAsh::FindDisplayContainingPoint(point);
+ if (!display.is_valid())
+ return NULL;
+ aura::RootWindow* root = Shell::GetInstance()->display_controller()->
+ GetRootWindowForDisplayId(display.id());
aura::Window* dock_container = Shell::GetContainer(
- wm::GetRootWindowAt(point),
- kShellWindowId_DockedContainer);
+ root, kShellWindowId_DockedContainer);
return static_cast<DockedWindowLayoutManager*>(
dock_container->layout_manager());
}
@@ -91,14 +95,14 @@ void DockedWindowResizer::Drag(const gfx::Point& location, int event_flags) {
DockedWindowLayoutManager* new_dock_layout =
GetDockedLayoutManagerAtPoint(last_location_);
- if (new_dock_layout != dock_layout_) {
+ if (new_dock_layout && new_dock_layout != dock_layout_) {
// The window is being dragged to a new display. If the previous
// container is the current parent of the window it will be informed of
// the end of drag when the window is reparented, otherwise let the
// previous container know the drag is complete. If we told the
// window's parent that the drag was complete it would begin
// positioning the window.
- if (is_docked_)
+ if (is_docked_ && dock_layout_->is_dragged_window_docked())
dock_layout_->UndockDraggedWindow();
if (dock_layout_ != initial_dock_layout_)
dock_layout_->FinishDragging();
@@ -109,29 +113,11 @@ void DockedWindowResizer::Drag(const gfx::Point& location, int event_flags) {
if (new_dock_layout != initial_dock_layout_)
new_dock_layout->StartDragging(GetTarget());
}
-
- // Show snapping animation when a window touches a screen edge or when
- // it is about to get docked.
- DockedAlignment new_docked_alignment = GetDraggedWindowAlignment();
- if (new_docked_alignment != DOCKED_ALIGNMENT_NONE) {
- if (!is_docked_) {
- dock_layout_->DockDraggedWindow(GetTarget());
- is_docked_ = true;
- }
- UpdateSnapPhantomWindow();
- } else {
- if (is_docked_) {
- dock_layout_->UndockDraggedWindow();
- is_docked_ = false;
- }
- // Clear phantom window when a window gets undocked.
- snap_phantom_window_controller_.reset();
- }
+ // Window could get docked by the WorkspaceWindowResizer, update the state.
+ is_docked_ = dock_layout_->is_dragged_window_docked();
}
void DockedWindowResizer::CompleteDrag(int event_flags) {
- snap_phantom_window_controller_.reset();
-
// Temporarily clear kWindowTrackedByWorkspaceKey for panels so that they
// don't get forced into the workspace that may be shrunken because of docked
// windows.
@@ -146,8 +132,6 @@ void DockedWindowResizer::CompleteDrag(int event_flags) {
}
void DockedWindowResizer::RevertDrag() {
- snap_phantom_window_controller_.reset();
-
// Temporarily clear kWindowTrackedByWorkspaceKey for panels so that they
// don't get forced into the workspace that may be shrunken because of docked
// windows.
@@ -156,6 +140,11 @@ void DockedWindowResizer::RevertDrag() {
if (was_docked_)
window_settings->SetTrackedByWorkspace(false);
next_window_resizer_->RevertDrag();
+ // Restore docked state to what it was before the drag if necessary.
+ if (was_docked_ && !is_docked_) {
+ dock_layout_->DockDraggedWindow(GetTarget());
+ is_docked_ = was_docked_;
+ }
FinishedDragging();
window_settings->SetTrackedByWorkspace(was_tracked_by_workspace);
}
@@ -189,51 +178,15 @@ DockedWindowResizer::DockedWindowResizer(WindowResizer* next_window_resizer,
is_docked_ = was_docked_;
}
-DockedAlignment DockedWindowResizer::GetDraggedWindowAlignment() {
- aura::Window* window = GetTarget();
- DockedWindowLayoutManager* layout_manager =
- GetDockedLayoutManagerAtPoint(last_location_);
- const DockedAlignment alignment = layout_manager->CalculateAlignment();
- const gfx::Rect& bounds(window->GetBoundsInScreen());
-
- // Check if the window is touching the edge - it may need to get docked.
- if (alignment == DOCKED_ALIGNMENT_NONE)
- return layout_manager->GetAlignmentOfWindow(window);
-
- // Both bounds and pointer location are checked because some drags involve
- // stickiness at the workspace-to-dock boundary and so the |location| may be
- // outside of the |bounds|.
- // It is also possible that all the docked windows are minimized or hidden
- // in which case the dragged window needs to be exactly touching the same
- // edge that those docked windows were aligned before they got minimized.
- // TODO(varkha): Consider eliminating sticky behavior on that boundary when
- // a pointer enters docked area.
- if ((layout_manager->docked_bounds().Intersects(bounds) &&
- layout_manager->docked_bounds().Contains(last_location_)) ||
- alignment == layout_manager->GetAlignmentOfWindow(window)) {
- // A window is being added to other docked windows (on the same side).
- return alignment;
- }
- return DOCKED_ALIGNMENT_NONE;
-}
-
bool DockedWindowResizer::MaybeSnapToEdge(const gfx::Rect& bounds,
gfx::Point* offset) {
- aura::Window* dock_container = Shell::GetContainer(
- wm::GetRootWindowAt(last_location_),
- kShellWindowId_DockedContainer);
- DockedAlignment dock_alignment =
- GetDockedLayoutManagerAtPoint(last_location_)->CalculateAlignment();
- gfx::Rect dock_bounds = ScreenAsh::ConvertRectFromScreen(
- GetTarget()->parent(), dock_container->GetBoundsInScreen());
- // Windows only snap magnetically when they are close to the edge of the
- // screen and when the cursor is over other docked windows.
- // When a window being dragged is the last window that was previously
- // docked it is still allowed to magnetically snap to either side.
- bool can_snap = was_docked_ ||
- (GetDraggedWindowAlignment() != DOCKED_ALIGNMENT_NONE);
- if (!can_snap)
+ // Windows only snap magnetically when they were previously docked.
+ if (!was_docked_)
return false;
+ DockedAlignment dock_alignment = dock_layout_->CalculateAlignment();
+ gfx::Rect dock_bounds = ScreenAsh::ConvertRectFromScreen(
+ GetTarget()->parent(),
+ dock_layout_->dock_container()->GetBoundsInScreen());
// Distance in pixels that the cursor must move past an edge for a window
// to move beyond that edge. Same constant as in WorkspaceWindowResizer
@@ -245,19 +198,17 @@ bool DockedWindowResizer::MaybeSnapToEdge(const gfx::Rect& bounds,
const int kSnapToDockDistance = MagnetismMatcher::kMagneticDistance;
if (dock_alignment == DOCKED_ALIGNMENT_LEFT ||
- (dock_alignment == DOCKED_ALIGNMENT_NONE && was_docked_)) {
+ dock_alignment == DOCKED_ALIGNMENT_NONE) {
const int distance = bounds.x() - dock_bounds.x();
- if (distance < (was_docked_ ? kSnapToDockDistance : 0) &&
- distance > -kStickyDistance) {
+ if (distance < kSnapToDockDistance && distance > -kStickyDistance) {
offset->set_x(-distance);
return true;
}
}
if (dock_alignment == DOCKED_ALIGNMENT_RIGHT ||
- (dock_alignment == DOCKED_ALIGNMENT_NONE && was_docked_)) {
+ dock_alignment == DOCKED_ALIGNMENT_NONE) {
const int distance = dock_bounds.right() - bounds.right();
- if (distance < (was_docked_ ? kSnapToDockDistance : 0) &&
- distance > -kStickyDistance) {
+ if (distance < kSnapToDockDistance && distance > -kStickyDistance) {
offset->set_x(distance);
return true;
}
@@ -294,25 +245,22 @@ void DockedWindowResizer::FinishedDragging() {
return;
aura::Window* window = GetTarget();
- bool should_dock = was_docked_;
const bool attached_panel =
window->type() == aura::client::WINDOW_TYPE_PANEL &&
wm::GetWindowSettings(window)->panel_attached();
- // If a window was previously docked then keep it docked if it is resized and
- // still aligned at the screen edge.
- if ((was_docked_ ||
- ((details_.bounds_change & WindowResizer::kBoundsChange_Repositions) &&
- !(details_.bounds_change & WindowResizer::kBoundsChange_Resizes)))) {
- should_dock = GetDraggedWindowAlignment() != DOCKED_ALIGNMENT_NONE;
- }
+ const bool is_resized =
+ (details_.bounds_change & WindowResizer::kBoundsChange_Resizes) != 0;
+ // No longer restore to pre-docked bounds if a window has been resized.
+ if (is_resized && is_docked_)
+ ClearRestoreBounds(window);
// Check if the window needs to be docked or returned to workspace.
aura::Window* dock_container = Shell::GetContainer(
window->GetRootWindow(),
kShellWindowId_DockedContainer);
- if (!attached_panel &&
- should_dock != (window->parent() == dock_container)) {
- if (should_dock) {
+ if ((is_resized || !attached_panel) &&
+ is_docked_ != (window->parent() == dock_container)) {
+ if (is_docked_) {
dock_container->AddChild(window);
} else if (window->parent()->id() == kShellWindowId_DockedContainer) {
// Reparent the window back to workspace.
@@ -337,16 +285,5 @@ void DockedWindowResizer::FinishedDragging() {
is_docked_ = false;
}
-void DockedWindowResizer::UpdateSnapPhantomWindow() {
- if (!did_move_or_resize_ || details_.window_component != HTCAPTION)
- return;
-
- if (!snap_phantom_window_controller_) {
- snap_phantom_window_controller_.reset(
- new PhantomWindowController(GetTarget()));
- }
- snap_phantom_window_controller_->Show(dock_layout_->dragged_bounds());
-}
-
} // namespace internal
} // namespace ash
diff --git a/ash/wm/dock/docked_window_resizer.h b/ash/wm/dock/docked_window_resizer.h
index 3f4bd47fb2..567b438a59 100644
--- a/ash/wm/dock/docked_window_resizer.h
+++ b/ash/wm/dock/docked_window_resizer.h
@@ -24,7 +24,6 @@ namespace ash {
namespace internal {
class DockedWindowLayoutManager;
-class PhantomWindowController;
// DockWindowResizer is used by ToplevelWindowEventFilter to handle dragging,
// moving or resizing of a window while it is docked to the side of a screen.
@@ -55,12 +54,6 @@ class ASH_EXPORT DockedWindowResizer : public WindowResizer {
DockedWindowResizer(WindowResizer* next_window_resizer,
const Details& details);
- // Returns the side of the screen that the window should dock to or
- // DOCKED_ALIGNMENT_NONE when the window is not on a side or when some other
- // windows are already docked on the other side or when launcher (shelf) is
- // aligned on the same side.
- DockedAlignment GetDraggedWindowAlignment();
-
// Checks if the provided window bounds should snap to the side of a screen.
// If so the offset returned gives the necessary adjustment to snap.
bool MaybeSnapToEdge(const gfx::Rect& bounds, gfx::Point* offset);
@@ -73,9 +66,6 @@ class ASH_EXPORT DockedWindowResizer : public WindowResizer {
// of the drag start.
void FinishedDragging();
- // Updates the bounds of the phantom window that is used as a docking hint.
- void UpdateSnapPhantomWindow();
-
const Details details_;
gfx::Point last_location_;
@@ -90,9 +80,6 @@ class ASH_EXPORT DockedWindowResizer : public WindowResizer {
// Set to true once Drag() is invoked and the bounds of the window change.
bool did_move_or_resize_;
- // Gives a preview of where the the window will end up.
- scoped_ptr<PhantomWindowController> snap_phantom_window_controller_;
-
// Set to true if the window that is being dragged was docked before drag.
bool was_docked_;
diff --git a/ash/wm/dock/docked_window_resizer_unittest.cc b/ash/wm/dock/docked_window_resizer_unittest.cc
index 5d6566ee9b..34a39d23d7 100644
--- a/ash/wm/dock/docked_window_resizer_unittest.cc
+++ b/ash/wm/dock/docked_window_resizer_unittest.cc
@@ -18,6 +18,7 @@
#include "ash/test/cursor_manager_test_api.h"
#include "ash/test/shell_test_api.h"
#include "ash/test/test_launcher_delegate.h"
+#include "ash/wm/coordinate_conversion.h"
#include "ash/wm/dock/docked_window_layout_manager.h"
#include "ash/wm/drag_window_resizer.h"
#include "ash/wm/panels/panel_layout_manager.h"
@@ -95,16 +96,11 @@ class DockedWindowResizerTest
}
void DragStart(aura::Window* window) {
- initial_location_in_parent_ = window->bounds().origin();
- resizer_.reset(CreateSomeWindowResizer(window,
- initial_location_in_parent_,
- HTCAPTION));
- ASSERT_TRUE(resizer_.get());
+ DragStartAtOffsetFromwindowOrigin(window, 0, 0);
}
void DragStartAtOffsetFromwindowOrigin(aura::Window* window,
- int dx,
- int dy) {
+ int dx, int dy) {
initial_location_in_parent_ =
window->bounds().origin() + gfx::Vector2d(dx, dy);
resizer_.reset(CreateSomeWindowResizer(window,
@@ -114,8 +110,7 @@ class DockedWindowResizerTest
}
void ResizeStartAtOffsetFromwindowOrigin(aura::Window* window,
- int dx,
- int dy,
+ int dx, int dy,
int window_component) {
initial_location_in_parent_ =
window->bounds().origin() + gfx::Vector2d(dx, dy);
@@ -156,8 +151,8 @@ class DockedWindowResizerTest
DragVerticallyAndRelativeToEdge(
edge,
window,
- dx,
- window_type_ == aura::client::WINDOW_TYPE_PANEL ? -100 : 20);
+ dx, window_type_ == aura::client::WINDOW_TYPE_PANEL ? -100 : 20,
+ 25, 5);
}
void DragToVerticalPositionAndToEdge(DockedEdge edge,
@@ -171,55 +166,43 @@ class DockedWindowResizerTest
int dx,
int y) {
gfx::Rect initial_bounds = window->GetBoundsInScreen();
- DragVerticallyAndRelativeToEdge(edge, window, dx, y - initial_bounds.y());
+ DragVerticallyAndRelativeToEdge(edge,
+ window,
+ dx, y - initial_bounds.y(),
+ 25, 5);
}
// Detach if our window is a panel, then drag it vertically by |dy| and
// horizontally to the edge with an added offset from the edge of |dx|.
void DragVerticallyAndRelativeToEdge(DockedEdge edge,
aura::Window* window,
- int dx,
- int dy) {
- aura::RootWindow* root_window = window->GetRootWindow();
+ int dx, int dy,
+ int grab_x, int grab_y) {
gfx::Rect initial_bounds = window->GetBoundsInScreen();
-
- if (window_type_ == aura::client::WINDOW_TYPE_PANEL) {
- ASSERT_NO_FATAL_FAILURE(DragStart(window));
- EXPECT_TRUE(wm::GetWindowSettings(window)->panel_attached());
-
- // Drag enough to detach since our tests assume panels to be initially
- // detached.
- DragMove(0, dy);
- EXPECT_EQ(CorrectContainerIdDuringDrag(), window->parent()->id());
- EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x());
- EXPECT_EQ(initial_bounds.y() + dy, window->GetBoundsInScreen().y());
-
- // The panel should be detached when the drag completes.
- DragEnd();
-
- EXPECT_FALSE(wm::GetWindowSettings(window)->panel_attached());
- EXPECT_EQ(internal::kShellWindowId_DefaultContainer,
- window->parent()->id());
- EXPECT_EQ(root_window, window->GetRootWindow());
- }
-
// avoid snap by clicking away from the border
- ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(window, 25, 5));
+ ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(window,
+ grab_x, grab_y));
+ gfx::Rect work_area =
+ Shell::GetScreen()->GetDisplayNearestWindow(window).work_area();
+ gfx::Point initial_location_in_screen = initial_location_in_parent_;
+ wm::ConvertPointToScreen(window->parent(), &initial_location_in_screen);
// Drag the window left or right to the edge (or almost to it).
if (edge == DOCKED_EDGE_LEFT)
- dx += window->GetRootWindow()->bounds().x() - initial_bounds.x();
+ dx += work_area.x() - initial_location_in_screen.x();
else if (edge == DOCKED_EDGE_RIGHT)
- dx += window->GetRootWindow()->bounds().right() - initial_bounds.right();
- DragMove(dx, window_type_ == aura::client::WINDOW_TYPE_PANEL ? 0 : dy);
+ dx += work_area.right() - 1 - initial_location_in_screen.x();
+ DragMove(dx, dy);
EXPECT_EQ(CorrectContainerIdDuringDrag(), window->parent()->id());
// Release the mouse and the panel should be attached to the dock.
DragEnd();
// x-coordinate can get adjusted by snapping or sticking.
// y-coordinate could be changed by possible automatic layout if docked.
- if (window->parent()->id() != internal::kShellWindowId_DockedContainer)
+ if (window->parent()->id() != internal::kShellWindowId_DockedContainer &&
+ GetRestoreBoundsInScreen(window) == NULL) {
EXPECT_EQ(initial_bounds.y() + dy, window->GetBoundsInScreen().y());
+ }
}
bool test_panels() const {
@@ -253,7 +236,7 @@ TEST_P(DockedWindowResizerTest, AttachRightPrecise) {
}
// Verifies a window can be dragged and attached to the dock
-// even if we overshoot the screen edge by a few pixels (sticky edge)
+// even if pointer overshoots the screen edge by a few pixels (sticky edge)
TEST_P(DockedWindowResizerTest, AttachRightOvershoot) {
if (!SupportsHostWindowResize())
return;
@@ -267,17 +250,28 @@ TEST_P(DockedWindowResizerTest, AttachRightOvershoot) {
EXPECT_EQ(internal::kShellWindowId_DockedContainer, window->parent()->id());
}
-// Verifies a window can be dragged and then if not quite reaching the screen
-// edge it does not get docked to a screen edge and stays in the desktop.
+// Verifies a window can be dragged and then if a pointer is not quite reaching
+// the screen edge the window does not get docked and stays in the desktop.
TEST_P(DockedWindowResizerTest, AttachRightUndershoot) {
if (!SupportsHostWindowResize())
return;
scoped_ptr<aura::Window> window(CreateTestWindow(gfx::Rect(0, 0, 201, 201)));
- DragRelativeToEdge(DOCKED_EDGE_RIGHT, window.get(), -1);
-
- // The window should not be attached to the dock.
- EXPECT_EQ(window->GetRootWindow()->bounds().right() - 1,
+ // Grabbing at 70px ensures that at least 30% of the window is in screen,
+ // otherwise the window would be adjusted in
+ // WorkspaceLayoutManager::AdjustWindowBoundsWhenAdded.
+ const int kGrabOffsetX = 70;
+ const int kUndershootBy = 1;
+ DragVerticallyAndRelativeToEdge(DOCKED_EDGE_RIGHT,
+ window.get(),
+ -kUndershootBy, test_panels() ? -100 : 20,
+ kGrabOffsetX, 5);
+
+ // The window right should be past the screen edge but not docked.
+ // Initial touch point is 70px to the right which helps to find where the edge
+ // should be.
+ EXPECT_EQ(window->GetRootWindow()->bounds().right() +
+ window->bounds().width() - kGrabOffsetX - kUndershootBy - 1,
window->GetBoundsInScreen().right());
EXPECT_EQ(internal::kShellWindowId_DefaultContainer,
window->parent()->id());
@@ -298,7 +292,7 @@ TEST_P(DockedWindowResizerTest, AttachLeftPrecise) {
}
// Verifies a window can be dragged and attached to the dock
-// even if we overshoot the screen edge by a few pixels (sticky edge)
+// even if pointer overshoots the screen edge by a few pixels (sticky edge)
TEST_P(DockedWindowResizerTest, AttachLeftOvershoot) {
if (!SupportsHostWindowResize())
return;
@@ -312,8 +306,8 @@ TEST_P(DockedWindowResizerTest, AttachLeftOvershoot) {
EXPECT_EQ(internal::kShellWindowId_DockedContainer, window->parent()->id());
}
-// Verifies a window can be dragged and then if not quite reaching the screen
-// edge it does not get docked to a screen edge and stays in the desktop.
+// Verifies a window can be dragged and then if a pointer is not quite reaching
+// the screen edge the window does not get docked and stays in the desktop.
TEST_P(DockedWindowResizerTest, AttachLeftUndershoot) {
if (!SupportsHostWindowResize())
return;
@@ -321,8 +315,8 @@ TEST_P(DockedWindowResizerTest, AttachLeftUndershoot) {
scoped_ptr<aura::Window> window(CreateTestWindow(gfx::Rect(0, 0, 201, 201)));
DragRelativeToEdge(DOCKED_EDGE_LEFT, window.get(), 1);
- // The window should not be attached to the dock.
- EXPECT_EQ(window->GetRootWindow()->bounds().x() + 1,
+ // The window should be touching the screen edge but not docked.
+ EXPECT_EQ(window->GetRootWindow()->bounds().x(),
window->GetBoundsInScreen().x());
EXPECT_EQ(internal::kShellWindowId_DefaultContainer,
window->parent()->id());
@@ -487,6 +481,7 @@ TEST_P(DockedWindowResizerTest, AttachOnTwoSides)
EXPECT_EQ(internal::kShellWindowId_DockedContainer, w1->parent()->id());
// The second window should be near the left edge but not snapped.
+ // Normal window will get side-maximized while panels will not.
EXPECT_EQ(w2->GetRootWindow()->bounds().x(), w2->GetBoundsInScreen().x());
EXPECT_EQ(internal::kShellWindowId_DefaultContainer, w2->parent()->id());
}
@@ -525,6 +520,7 @@ TEST_P(DockedWindowResizerTest, DragAcrossDisplays) {
UpdateDisplay("800x800,800x800");
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
+ EXPECT_EQ(2, static_cast<int>(root_windows.size()));
scoped_ptr<aura::Window> window(CreateTestWindow(gfx::Rect(0, 0, 201, 201)));
gfx::Rect initial_bounds = window->GetBoundsInScreen();
EXPECT_EQ(root_windows[0], window->GetRootWindow());
@@ -535,21 +531,11 @@ TEST_P(DockedWindowResizerTest, DragAcrossDisplays) {
window->GetBoundsInScreen().right());
EXPECT_EQ(internal::kShellWindowId_DockedContainer, window->parent()->id());
- // Undock and move to the right - enough to get it peeking at the other screen
- // but not enough to land in the other screen
- ASSERT_NO_FATAL_FAILURE(DragStart(window.get()));
- DragMove(70, 0);
- EXPECT_EQ(CorrectContainerIdDuringDrag(), window->parent()->id());
- DragEnd();
- EXPECT_NE(window->GetRootWindow()->bounds().right(),
- window->GetBoundsInScreen().right());
- EXPECT_EQ(internal::kShellWindowId_DefaultContainer,
- window->parent()->id());
- EXPECT_EQ(root_windows[0], window->GetRootWindow());
-
- // Move back left - should dock again.
+ // Try dragging to the right - enough to get it peeking at the other screen
+ // but not enough to land in the other screen.
+ // The window should stay on the left screen.
ASSERT_NO_FATAL_FAILURE(DragStart(window.get()));
- DragMove(-70, 0);
+ DragMove(100, 0);
EXPECT_EQ(CorrectContainerIdDuringDrag(), window->parent()->id());
DragEnd();
EXPECT_EQ(window->GetRootWindow()->bounds().right(),
@@ -574,8 +560,8 @@ TEST_P(DockedWindowResizerTest, DragAcrossDisplays) {
window->parent()->id());
EXPECT_EQ(root_windows[1], window->GetRootWindow());
- // Keep dragging it to the right until it docks. The window should now be
- // in the second screen.
+ // Keep dragging it to the right until its left edge touches the screen edge.
+ // The window should now be in the second screen and not docked.
ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(
window.get(),
window->bounds().width()/2 + 10,
@@ -587,7 +573,7 @@ TEST_P(DockedWindowResizerTest, DragAcrossDisplays) {
DragEnd();
EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().x(),
window->GetBoundsInScreen().x());
- EXPECT_EQ(internal::kShellWindowId_DockedContainer, window->parent()->id());
+ EXPECT_EQ(internal::kShellWindowId_DefaultContainer, window->parent()->id());
EXPECT_EQ(root_windows[1], window->GetRootWindow());
}
@@ -665,7 +651,7 @@ TEST_P(DockedWindowResizerTest, AttachTwoWindowsDetachOne)
EXPECT_EQ(w1->bounds().width(), manager->docked_width_);
}
-// Dock one windows. Maximize other testing desktop resizing.
+// Dock one of the windows. Maximize other testing desktop resizing.
TEST_P(DockedWindowResizerTest, AttachWindowMaximizeOther)
{
if (!SupportsHostWindowResize())
@@ -687,10 +673,13 @@ TEST_P(DockedWindowResizerTest, AttachWindowMaximizeOther)
EXPECT_EQ(DOCKED_ALIGNMENT_RIGHT, manager->alignment_);
EXPECT_EQ(w1->bounds().width(), manager->docked_width_);
- DragToVerticalPositionRelativeToEdge(DOCKED_EDGE_RIGHT,
- w2.get(),
- -(w2->bounds().width()/2 + 20),
- 50);
+ ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(w2.get(), 25, 5));
+ DragMove(w2->GetRootWindow()->bounds().right()
+ -w2->bounds().width()
+ -(w2->bounds().width()/2 + 20)
+ -w2->bounds().x(),
+ 50 - w2->bounds().y());
+ DragEnd();
// The first window should be still docked.
EXPECT_EQ(w1->GetRootWindow()->bounds().right(),
w1->GetBoundsInScreen().right());
@@ -738,7 +727,8 @@ TEST_P(DockedWindowResizerTest, AttachWindowMaximizeOther)
// Dock the first window to the left edge.
// Click at an offset from origin to prevent snapping.
ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(w1.get(), 10, 0));
- DragMove(-w1->bounds().x(), 0);
+ // Drag left to get pointer touching the screen edge.
+ DragMove(-w1->bounds().x() - 10, 0);
// Alignment set to "NONE" during the drag of the window when none are docked.
EXPECT_EQ(DOCKED_ALIGNMENT_NONE, manager->alignment_);
// Release the mouse and the window should be now attached to the edge.
@@ -787,10 +777,11 @@ TEST_P(DockedWindowResizerTest, AttachOneTestSticky)
EXPECT_EQ(DOCKED_ALIGNMENT_LEFT, manager->alignment_);
EXPECT_EQ(w1->bounds().width(), manager->docked_width_);
- // Position second window in the desktop just to the right of the docked w1.
+ // Position second window in the desktop 20px to the right of the docked w1.
DragToVerticalPositionRelativeToEdge(DOCKED_EDGE_LEFT,
w2.get(),
- w1->bounds().right() + 20,
+ 20 + 25 -
+ DockedWindowLayoutManager::kMinDockGap,
50);
// The second window should be floating on the desktop.
EXPECT_EQ(w2->GetRootWindow()->bounds().x() + (w1->bounds().right() + 20),
@@ -895,8 +886,7 @@ TEST_P(DockedWindowResizerTest, ResizeTwoWindows)
int previous_width = w1->bounds().width();
const int kResizeSpan1 = 30;
ASSERT_NO_FATAL_FAILURE(ResizeStartAtOffsetFromwindowOrigin(w1.get(),
- 0,
- 20,
+ 0, 20,
HTLEFT));
DragMove(-kResizeSpan1, 0);
// Alignment set to "RIGHT" during the drag because dock has a window in it.
@@ -917,12 +907,11 @@ TEST_P(DockedWindowResizerTest, ResizeTwoWindows)
ScreenAsh::GetDisplayWorkAreaBoundsInParent(w2.get()).width());
// Resize the first window left by more than the dock maximum width.
- // This should cause the window to overhang and the dock to shrink to w2.
+ // This should cause the window width to be restricted by maximum dock width.
previous_width = w1->bounds().width();
const int kResizeSpan2 = 250;
ASSERT_NO_FATAL_FAILURE(ResizeStartAtOffsetFromwindowOrigin(w1.get(),
- 0,
- 20,
+ 0, 20,
HTLEFT));
DragMove(-kResizeSpan2, 0);
// Alignment set to "RIGHT" during the drag because dock has a window in it.
@@ -933,11 +922,11 @@ TEST_P(DockedWindowResizerTest, ResizeTwoWindows)
EXPECT_EQ(internal::kShellWindowId_DockedContainer, w1->parent()->id());
EXPECT_EQ(internal::kShellWindowId_DockedContainer, w2->parent()->id());
EXPECT_EQ(DOCKED_ALIGNMENT_RIGHT, manager->alignment_);
- // w1 is now wider than the maximum dock width and the dock should shrink to
- // the next widest window (w2).
- EXPECT_EQ(previous_width + kResizeSpan2, w1->bounds().width());
+ // w1 is now as wide as the maximum dock width and the dock should get
+ // resized to the maximum width.
+ EXPECT_EQ(DockedWindowLayoutManager::kMaxDockWidth, w1->bounds().width());
EXPECT_GT(w1->bounds().width(), w2->bounds().width());
- EXPECT_EQ(w2->bounds().width(), manager->docked_width_);
+ EXPECT_EQ(w1->bounds().width(), manager->docked_width_);
// Desktop work area should shrink.
EXPECT_EQ(ScreenAsh::GetDisplayBoundsInParent(w2.get()).width() -
manager->docked_width_ - DockedWindowLayoutManager::kMinDockGap,
@@ -947,8 +936,7 @@ TEST_P(DockedWindowResizerTest, ResizeTwoWindows)
previous_width = w1->bounds().width();
const int kResizeSpan3 = 100;
ASSERT_NO_FATAL_FAILURE(ResizeStartAtOffsetFromwindowOrigin(w1.get(),
- 0,
- 20,
+ 0, 20,
HTLEFT));
DragMove(kResizeSpan3, 0);
// Alignment set to "RIGHT" during the drag because dock has a window in it.
@@ -971,28 +959,29 @@ TEST_P(DockedWindowResizerTest, ResizeTwoWindows)
// Resize the first window left to be overhang again.
previous_width = w1->bounds().width();
ASSERT_NO_FATAL_FAILURE(ResizeStartAtOffsetFromwindowOrigin(w1.get(),
- 0,
- 20,
+ 0, 20,
HTLEFT));
DragMove(-kResizeSpan3, 0);
DragEnd();
EXPECT_EQ(previous_width + kResizeSpan3, w1->bounds().width());
EXPECT_EQ(internal::kShellWindowId_DockedContainer, w1->parent()->id());
- // Docked area should be as wide as the second window - the first is too wide.
- EXPECT_EQ(w2->bounds().width(), manager->docked_width_);
+ // Docked area should be as wide as possible (maximum) and same as w1.
+ EXPECT_EQ(DockedWindowLayoutManager::kMaxDockWidth, manager->docked_width_);
+ EXPECT_EQ(w1->bounds().width(), manager->docked_width_);
// Undock the second window. Docked area should shrink to its minimum size.
ASSERT_NO_FATAL_FAILURE(DragStart(w2.get()));
// Drag up as well to avoid attaching panels to launcher shelf.
- DragMove(-40, -100);
+ DragMove(-(400 - 201), -100);
// Alignment set to "RIGHT" since we have another window docked.
EXPECT_EQ(DOCKED_ALIGNMENT_RIGHT, manager->alignment_);
// Release the mouse and the window should be no longer attached to the edge.
DragEnd();
EXPECT_EQ(internal::kShellWindowId_DefaultContainer, w2->parent()->id());
- // Dock should get shrunk to minimum size.
+ // Dock should be as wide as w1 (and same as maximum width).
EXPECT_EQ(DOCKED_ALIGNMENT_RIGHT, manager->alignment_);
- EXPECT_EQ(manager->kMinDockWidth, manager->docked_width_);
+ EXPECT_EQ(DockedWindowLayoutManager::kMaxDockWidth, manager->docked_width_);
+ EXPECT_EQ(w1->bounds().width(), manager->docked_width_);
// The first window should be still docked.
EXPECT_EQ(internal::kShellWindowId_DockedContainer, w1->parent()->id());
// Desktop work area should be inset.
diff --git a/ash/wm/drag_window_resizer_unittest.cc b/ash/wm/drag_window_resizer_unittest.cc
index 2e8648f14d..a17f9b5988 100644
--- a/ash/wm/drag_window_resizer_unittest.cc
+++ b/ash/wm/drag_window_resizer_unittest.cc
@@ -119,6 +119,16 @@ class DragWindowResizerTest : public test::AshTestBase {
aura::client::WINDOW_MOVE_SOURCE_MOUSE).release();
}
+ bool WarpMouseCursorIfNecessary(aura::RootWindow* target_root,
+ const gfx::Point& point_in_screen) {
+ MouseCursorEventFilter* event_filter =
+ Shell::GetInstance()->mouse_cursor_filter();
+ bool is_warped = event_filter->WarpMouseCursorIfNecessary(target_root,
+ point_in_screen);
+ event_filter->reset_was_mouse_warped_for_test();
+ return is_warped;
+ }
+
aura::test::TestWindowDelegate delegate_;
aura::test::TestWindowDelegate delegate2_;
aura::test::TestWindowDelegate delegate3_;
@@ -224,7 +234,7 @@ TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplaysActiveRoot) {
EXPECT_TRUE(ash::wm::CanActivateWindow(window.get()));
ash::wm::ActivateWindow(window.get());
EXPECT_EQ(root_windows[0], window->GetRootWindow());
- EXPECT_EQ(root_windows[0], ash::Shell::GetActiveRootWindow());
+ EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow());
{
// Grab (0, 0) of the window.
scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer(
@@ -237,7 +247,7 @@ TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplaysActiveRoot) {
// The whole window is on the secondary display now. The parent should be
// changed.
EXPECT_EQ(root_windows[1], window->GetRootWindow());
- EXPECT_EQ(root_windows[1], ash::Shell::GetActiveRootWindow());
+ EXPECT_EQ(root_windows[1], ash::Shell::GetTargetRootWindow());
}
}
@@ -414,8 +424,6 @@ TEST_F(DragWindowResizerTest, CursorDeviceScaleFactor) {
test::CursorManagerTestApi cursor_test_api(
Shell::GetInstance()->cursor_manager());
- MouseCursorEventFilter* event_filter =
- Shell::GetInstance()->mouse_cursor_filter();
// Move window from the root window with 1.0 device scale factor to the root
// window with 2.0 device scale factor.
{
@@ -428,8 +436,7 @@ TEST_F(DragWindowResizerTest, CursorDeviceScaleFactor) {
EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor());
ASSERT_TRUE(resizer.get());
resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0);
- event_filter->WarpMouseCursorIfNecessary(root_windows[0],
- gfx::Point(399, 200));
+ WarpMouseCursorIfNecessary(root_windows[0], gfx::Point(399, 200));
EXPECT_EQ(2.0f, cursor_test_api.GetDisplay().device_scale_factor());
resizer->CompleteDrag(0);
EXPECT_EQ(2.0f, cursor_test_api.GetDisplay().device_scale_factor());
@@ -448,8 +455,7 @@ TEST_F(DragWindowResizerTest, CursorDeviceScaleFactor) {
EXPECT_EQ(2.0f, cursor_test_api.GetDisplay().device_scale_factor());
ASSERT_TRUE(resizer.get());
resizer->Drag(CalculateDragPoint(*resizer, -200, 200), 0);
- event_filter->WarpMouseCursorIfNecessary(root_windows[1],
- gfx::Point(400, 200));
+ WarpMouseCursorIfNecessary(root_windows[1], gfx::Point(400, 200));
EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor());
resizer->CompleteDrag(0);
EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor());
@@ -467,8 +473,6 @@ TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) {
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
ASSERT_EQ(2U, root_windows.size());
- MouseCursorEventFilter* event_filter =
- Shell::GetInstance()->mouse_cursor_filter();
// Normal window can be moved across display.
{
@@ -480,8 +484,8 @@ TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) {
window, gfx::Point(), HTCAPTION));
ASSERT_TRUE(resizer.get());
resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0);
- EXPECT_TRUE(event_filter->WarpMouseCursorIfNecessary(root_windows[0],
- gfx::Point(399, 200)));
+ EXPECT_TRUE(WarpMouseCursorIfNecessary(root_windows[0],
+ gfx::Point(399, 200)));
resizer->CompleteDrag(0);
}
@@ -495,8 +499,8 @@ TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) {
window, gfx::Point(), HTCAPTION));
ASSERT_TRUE(resizer.get());
resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0);
- EXPECT_TRUE(event_filter->WarpMouseCursorIfNecessary(root_windows[0],
- gfx::Point(399, 200)));
+ EXPECT_TRUE(WarpMouseCursorIfNecessary(root_windows[0],
+ gfx::Point(399, 200)));
resizer->CompleteDrag(0);
}
@@ -510,8 +514,8 @@ TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) {
window, gfx::Point(), HTCAPTION));
ASSERT_TRUE(resizer.get());
resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0);
- EXPECT_TRUE(event_filter->WarpMouseCursorIfNecessary(root_windows[0],
- gfx::Point(399, 200)));
+ EXPECT_TRUE(WarpMouseCursorIfNecessary(root_windows[0],
+ gfx::Point(399, 200)));
resizer->CompleteDrag(0);
}
@@ -525,7 +529,7 @@ TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) {
window, gfx::Point(), HTCAPTION));
ASSERT_TRUE(resizer.get());
resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0);
- EXPECT_FALSE(event_filter->WarpMouseCursorIfNecessary(
+ EXPECT_FALSE(WarpMouseCursorIfNecessary(
root_windows[0],
gfx::Point(399, 200)));
resizer->CompleteDrag(0);
@@ -541,8 +545,8 @@ TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) {
window, gfx::Point(), HTCAPTION));
ASSERT_TRUE(resizer.get());
resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0);
- EXPECT_TRUE(event_filter->WarpMouseCursorIfNecessary(root_windows[0],
- gfx::Point(399, 200)));
+ EXPECT_TRUE(WarpMouseCursorIfNecessary(root_windows[0],
+ gfx::Point(399, 200)));
resizer->CompleteDrag(0);
}
@@ -556,8 +560,8 @@ TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) {
window, gfx::Point(), HTCAPTION));
ASSERT_TRUE(resizer.get());
resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0);
- EXPECT_TRUE(event_filter->WarpMouseCursorIfNecessary(root_windows[0],
- gfx::Point(399, 200)));
+ EXPECT_TRUE(WarpMouseCursorIfNecessary(root_windows[0],
+ gfx::Point(399, 200)));
resizer->CompleteDrag(0);
}
}
diff --git a/ash/wm/event_rewriter_event_filter.cc b/ash/wm/event_rewriter_event_filter.cc
index 315f9c6f60..369ba15cd1 100644
--- a/ash/wm/event_rewriter_event_filter.cc
+++ b/ash/wm/event_rewriter_event_filter.cc
@@ -6,7 +6,7 @@
#include "ash/event_rewriter_delegate.h"
#include "base/logging.h"
-#include "ui/base/events/event.h"
+#include "ui/events/event.h"
#if defined(OS_CHROMEOS)
#include "ash/wm/sticky_keys.h"
diff --git a/ash/wm/event_rewriter_event_filter.h b/ash/wm/event_rewriter_event_filter.h
index 87cf07fa28..e109cef416 100644
--- a/ash/wm/event_rewriter_event_filter.h
+++ b/ash/wm/event_rewriter_event_filter.h
@@ -9,7 +9,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_handler.h"
namespace ash {
diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc
index 3b723f500a..3e1a31d1cd 100644
--- a/ash/wm/frame_painter.cc
+++ b/ash/wm/frame_painter.cc
@@ -11,10 +11,10 @@
#include "ash/root_window_settings.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
+#include "ash/wm/caption_buttons/frame_caption_button_container_view.h"
#include "ash/wm/property_util.h"
#include "ash/wm/window_settings.h"
#include "ash/wm/window_util.h"
-#include "ash/wm/workspace/frame_caption_button_container_view.h"
#include "base/logging.h" // DCHECK
#include "grit/ash_resources.h"
#include "third_party/skia/include/core/SkCanvas.h"
@@ -25,11 +25,11 @@
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
-#include "ui/base/animation/slide_animation.h"
#include "ui/base/hit_test.h"
#include "ui/base/layout.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/theme_provider.h"
+#include "ui/gfx/animation/slide_animation.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/font.h"
#include "ui/gfx/image/image.h"
@@ -230,6 +230,7 @@ FramePainter::~FramePainter() {
// Sometimes we are destroyed before the window closes, so ensure we clean up.
if (window_) {
window_->RemoveObserver(this);
+ wm::GetWindowSettings(window_)->RemoveObserver(this);
}
}
@@ -417,7 +418,7 @@ void FramePainter::PaintHeader(views::NonClientFrameView* view,
parent->layer()->GetAnimator()->IsAnimatingProperty(
ui::LayerAnimationElement::VISIBILITY));
if (!parent_animating) {
- crossfade_animation_.reset(new ui::SlideAnimation(this));
+ crossfade_animation_.reset(new gfx::SlideAnimation(this));
crossfade_theme_frame_id_ = previous_theme_frame_id_;
crossfade_theme_frame_overlay_id_ = previous_theme_frame_overlay_id_;
crossfade_opacity_ = previous_opacity_;
@@ -701,9 +702,9 @@ void FramePainter::OnWindowRemovingFromRootWindow(aura::Window* window) {
}
///////////////////////////////////////////////////////////////////////////////
-// ui::AnimationDelegate overrides:
+// gfx::AnimationDelegate overrides:
-void FramePainter::AnimationProgressed(const ui::Animation* animation) {
+void FramePainter::AnimationProgressed(const gfx::Animation* animation) {
frame_->non_client_view()->SchedulePaintInRect(header_frame_bounds_);
}
diff --git a/ash/wm/frame_painter.h b/ash/wm/frame_painter.h
index a5d40fb524..d7902218ec 100644
--- a/ash/wm/frame_painter.h
+++ b/ash/wm/frame_painter.h
@@ -12,7 +12,7 @@
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
#include "ui/aura/window_observer.h"
-#include "ui/base/animation/animation_delegate.h"
+#include "ui/gfx/animation/animation_delegate.h"
#include "ui/gfx/rect.h"
namespace aura {
@@ -25,8 +25,6 @@ class Font;
class ImageSkia;
class Point;
class Size;
-}
-namespace ui {
class SlideAnimation;
}
namespace views {
@@ -42,7 +40,7 @@ class FrameCaptionButtonContainerView;
// various implementations of views::NonClientFrameView. Canonical source of
// layout constants for Ash window frames.
class ASH_EXPORT FramePainter : public aura::WindowObserver,
- public ui::AnimationDelegate,
+ public gfx::AnimationDelegate,
public wm::WindowSettings::Observer {
public:
// Opacity values for the window header in various states, from 0 to 255.
@@ -151,8 +149,8 @@ class ASH_EXPORT FramePainter : public aura::WindowObserver,
virtual void OnTrackedByWorkspaceChanged(aura::Window* window,
bool old) OVERRIDE;
- // Overridden from ui::AnimationDelegate
- virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
+ // Overridden from gfx::AnimationDelegate
+ virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
private:
FRIEND_TEST_ALL_PREFIXES(FramePainterTest, CreateAndDeleteSingleWindow);
@@ -238,7 +236,7 @@ class ASH_EXPORT FramePainter : public aura::WindowObserver,
int crossfade_opacity_;
gfx::Rect header_frame_bounds_;
- scoped_ptr<ui::SlideAnimation> crossfade_animation_;
+ scoped_ptr<gfx::SlideAnimation> crossfade_animation_;
DISALLOW_COPY_AND_ASSIGN(FramePainter);
};
diff --git a/ash/wm/frame_painter_unittest.cc b/ash/wm/frame_painter_unittest.cc
index 1bc6923aeb..7353bc48ba 100644
--- a/ash/wm/frame_painter_unittest.cc
+++ b/ash/wm/frame_painter_unittest.cc
@@ -9,9 +9,9 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/test/ash_test_base.h"
+#include "ash/wm/caption_buttons/frame_caption_button_container_view.h"
#include "ash/wm/window_settings.h"
#include "ash/wm/window_util.h"
-#include "ash/wm/workspace/frame_caption_button_container_view.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "grit/ash_resources.h"
@@ -119,7 +119,6 @@ FramePainter* CreateTestPainter(Widget* widget) {
NonClientFrameView* frame_view = widget->non_client_view()->frame_view();
ash::FrameCaptionButtonContainerView* container =
new ash::FrameCaptionButtonContainerView(
- frame_view,
widget,
ash::FrameCaptionButtonContainerView::MINIMIZE_ALLOWED);
// Add the container to the widget's non-client frame view so that it will be
@@ -208,7 +207,7 @@ class FramePainterTest : public ash::test::AshTestBase {
TEST_F(FramePainterTest, CreateAndDeleteSingleWindow) {
// Ensure that creating/deleting a window works well and doesn't cause
// crashes. See crbug.com/155634
- aura::RootWindow* root = Shell::GetActiveRootWindow();
+ aura::RootWindow* root = Shell::GetTargetRootWindow();
scoped_ptr<Widget> widget(CreateTestWidget());
scoped_ptr<FramePainter> painter(CreateTestPainter(widget.get()));
@@ -576,7 +575,7 @@ TEST_F(FramePainterTest, MinimalHeaderStyle) {
TEST_F(FramePainterTest, TitleIconAlignment) {
scoped_ptr<Widget> w(CreateTestWidget());
FramePainter p;
- ash::FrameCaptionButtonContainerView container(NULL, w.get(),
+ ash::FrameCaptionButtonContainerView container(w.get(),
ash::FrameCaptionButtonContainerView::MINIMIZE_ALLOWED);
views::View window_icon;
window_icon.SetBounds(0, 0, 16, 16);
diff --git a/ash/wm/gestures/long_press_affordance_handler.cc b/ash/wm/gestures/long_press_affordance_handler.cc
index 8b8468f006..516f4c7541 100644
--- a/ash/wm/gestures/long_press_affordance_handler.cc
+++ b/ash/wm/gestures/long_press_affordance_handler.cc
@@ -165,7 +165,7 @@ class LongPressAffordanceHandler::LongPressAffordanceView
virtual ~LongPressAffordanceView() {
}
- void UpdateWithGrowAnimation(ui::Animation* animation) {
+ void UpdateWithGrowAnimation(gfx::Animation* animation) {
// Update the portion of the circle filled so far and re-draw.
current_angle_ = animation->CurrentValueBetween(kAffordanceAngleStartValue,
kAffordanceAngleEndValue);
@@ -177,7 +177,7 @@ class LongPressAffordanceHandler::LongPressAffordanceView
SchedulePaint();
}
- void UpdateWithShrinkAnimation(ui::Animation* animation) {
+ void UpdateWithShrinkAnimation(gfx::Animation* animation) {
current_scale_ = animation->CurrentValueBetween(kAffordanceScaleEndValue,
kAffordanceShrinkScaleEndValue);
widget_->GetNativeView()->layer()->SetOpacity(
@@ -236,7 +236,7 @@ class LongPressAffordanceHandler::LongPressAffordanceView
// LongPressAffordanceHandler, public
LongPressAffordanceHandler::LongPressAffordanceHandler()
- : ui::LinearAnimation(kAffordanceFrameRateHz, this),
+ : gfx::LinearAnimation(kAffordanceFrameRateHz, this),
tap_down_touch_id_(-1),
tap_down_display_id_(0),
current_animation_type_(NONE) {}
@@ -351,7 +351,7 @@ bool LongPressAffordanceHandler::ShouldSendCanceledFromStop() {
}
void LongPressAffordanceHandler::AnimationEnded(
- const ui::Animation* animation) {
+ const gfx::Animation* animation) {
switch (current_animation_type_) {
case GROW_ANIMATION:
current_animation_type_ = SHRINK_ANIMATION;
diff --git a/ash/wm/gestures/long_press_affordance_handler.h b/ash/wm/gestures/long_press_affordance_handler.h
index 14ff0f3c1f..5fe6e00937 100644
--- a/ash/wm/gestures/long_press_affordance_handler.h
+++ b/ash/wm/gestures/long_press_affordance_handler.h
@@ -6,8 +6,8 @@
#define ASH_WM_GESTURES_LONG_PRESS_AFFORDANCE_HANDLER_H_
#include "base/timer/timer.h"
-#include "ui/base/animation/animation_delegate.h"
-#include "ui/base/animation/linear_animation.h"
+#include "ui/gfx/animation/animation_delegate.h"
+#include "ui/gfx/animation/linear_animation.h"
#include "ui/gfx/point.h"
namespace aura {
@@ -33,8 +33,8 @@ namespace internal {
// during grow animation.
// The second part is a shrink animation that start after grow and shrinks the
// affordance out of view.
-class LongPressAffordanceHandler : public ui::AnimationDelegate,
- public ui::LinearAnimation {
+class LongPressAffordanceHandler : public gfx::AnimationDelegate,
+ public gfx::LinearAnimation {
public:
LongPressAffordanceHandler();
virtual ~LongPressAffordanceHandler();
@@ -56,12 +56,12 @@ class LongPressAffordanceHandler : public ui::AnimationDelegate,
void StartAnimation();
void StopAnimation();
- // Overridden from ui::LinearAnimation.
+ // Overridden from gfx::LinearAnimation.
virtual void AnimateToState(double state) OVERRIDE;
virtual bool ShouldSendCanceledFromStop() OVERRIDE;
- // Overridden from ui::AnimationDelegate.
- virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
+ // Overridden from gfx::AnimationDelegate.
+ virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE;
class LongPressAffordanceView;
scoped_ptr<LongPressAffordanceView> view_;
diff --git a/ash/wm/gestures/system_pinch_handler.cc b/ash/wm/gestures/system_pinch_handler.cc
index a0f5d12e00..3b97f5aa44 100644
--- a/ash/wm/gestures/system_pinch_handler.cc
+++ b/ash/wm/gestures/system_pinch_handler.cc
@@ -13,9 +13,9 @@
#include "ash/wm/window_util.h"
#include "ash/wm/workspace/snap_sizer.h"
#include "ui/aura/window.h"
-#include "ui/base/events/event_constants.h"
#include "ui/base/gestures/gesture_types.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/events/event_constants.h"
#include "ui/gfx/rect.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
diff --git a/ash/wm/gestures/tray_gesture_handler.cc b/ash/wm/gestures/tray_gesture_handler.cc
index 78b0fb308c..0d2e8cfdd6 100644
--- a/ash/wm/gestures/tray_gesture_handler.cc
+++ b/ash/wm/gestures/tray_gesture_handler.cc
@@ -8,8 +8,8 @@
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_bubble.h"
#include "ui/aura/window.h"
-#include "ui/base/events/event.h"
#include "ui/compositor/layer.h"
+#include "ui/events/event.h"
#include "ui/gfx/transform.h"
#include "ui/views/widget/widget.h"
diff --git a/ash/wm/gestures/two_finger_drag_handler.cc b/ash/wm/gestures/two_finger_drag_handler.cc
index 49f7ecc02d..c379f54875 100644
--- a/ash/wm/gestures/two_finger_drag_handler.cc
+++ b/ash/wm/gestures/two_finger_drag_handler.cc
@@ -10,11 +10,11 @@
#include "ui/aura/client/window_types.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_constants.h"
#include "ui/base/hit_test.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/events/event.h"
+#include "ui/events/event_constants.h"
namespace {
diff --git a/ash/wm/image_cursors.h b/ash/wm/image_cursors.h
index fafc10ae2c..55bc34c0c4 100644
--- a/ash/wm/image_cursors.h
+++ b/ash/wm/image_cursors.h
@@ -8,6 +8,7 @@
#include "ash/ash_export.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
+#include "ui/base/cursor/cursor.h"
#include "ui/gfx/native_widget_types.h"
namespace gfx {
diff --git a/ash/wm/mru_window_tracker.cc b/ash/wm/mru_window_tracker.cc
index 8c90efb8e3..8b31c173a5 100644
--- a/ash/wm/mru_window_tracker.cc
+++ b/ash/wm/mru_window_tracker.cc
@@ -14,8 +14,8 @@
#include "ash/wm/workspace_controller.h"
#include "ui/aura/client/activation_client.h"
#include "ui/aura/root_window.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event.h"
+#include "ui/events/event_handler.h"
namespace ash {
@@ -41,7 +41,7 @@ MruWindowTracker::WindowList BuildWindowListInternal(
MruWindowTracker::WindowList windows;
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
- aura::RootWindow* active_root = Shell::GetActiveRootWindow();
+ aura::RootWindow* active_root = Shell::GetTargetRootWindow();
for (Shell::RootWindowList::const_iterator iter = root_windows.begin();
iter != root_windows.end(); ++iter) {
if (*iter == active_root)
@@ -90,7 +90,8 @@ MruWindowTracker::WindowList BuildWindowListInternal(
const int kSwitchableWindowContainerIds[] = {
internal::kShellWindowId_DefaultContainer,
- internal::kShellWindowId_AlwaysOnTopContainer
+ internal::kShellWindowId_AlwaysOnTopContainer,
+ internal::kShellWindowId_PanelContainer
};
const size_t kSwitchableWindowContainerIdsLength =
diff --git a/ash/wm/overlay_event_filter.cc b/ash/wm/overlay_event_filter.cc
index 2319d2fca2..07db4f38ff 100644
--- a/ash/wm/overlay_event_filter.cc
+++ b/ash/wm/overlay_event_filter.cc
@@ -7,7 +7,7 @@
#include "ash/wm/partial_screenshot_view.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
-#include "ui/base/events/event.h"
+#include "ui/events/event.h"
#include "ui/views/widget/widget.h"
namespace ash {
diff --git a/ash/wm/overlay_event_filter.h b/ash/wm/overlay_event_filter.h
index 1989e454f1..0d5afb6974 100644
--- a/ash/wm/overlay_event_filter.h
+++ b/ash/wm/overlay_event_filter.h
@@ -8,7 +8,7 @@
#include "ash/shell_observer.h"
#include "base/compiler_specific.h"
#include "ui/aura/window.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_handler.h"
namespace ash {
namespace internal {
diff --git a/ash/wm/overview/scoped_transform_overview_window.cc b/ash/wm/overview/scoped_transform_overview_window.cc
new file mode 100644
index 0000000000..5dc7dbe2a0
--- /dev/null
+++ b/ash/wm/overview/scoped_transform_overview_window.cc
@@ -0,0 +1,287 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/wm/overview/scoped_transform_overview_window.h"
+
+#include "ash/shell.h"
+#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/client/screen_position_client.h"
+#include "ui/aura/root_window.h"
+#include "ui/aura/window.h"
+#include "ui/compositor/layer_animation_observer.h"
+#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/gfx/display.h"
+#include "ui/gfx/interpolated_transform.h"
+#include "ui/gfx/transform_util.h"
+#include "ui/views/corewm/shadow_types.h"
+#include "ui/views/corewm/window_animations.h"
+#include "ui/views/corewm/window_util.h"
+#include "ui/views/widget/widget.h"
+
+namespace ash {
+
+namespace {
+
+// Creates a copy of |window| with |recreated_layer| in the |target_root|.
+views::Widget* CreateCopyOfWindow(aura::RootWindow* target_root,
+ aura::Window* src_window,
+ ui::Layer* recreated_layer) {
+ views::Widget* widget = new views::Widget;
+ views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
+ params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
+ params.parent = src_window->parent();
+ params.can_activate = false;
+ params.keep_on_top = true;
+ widget->set_focus_on_creation(false);
+ widget->Init(params);
+ widget->SetVisibilityChangedAnimationsEnabled(false);
+ std::string name = src_window->name() + " (Copy)";
+ widget->GetNativeWindow()->SetName(name);
+ views::corewm::SetShadowType(widget->GetNativeWindow(),
+ views::corewm::SHADOW_TYPE_RECTANGULAR);
+
+ // Set the bounds in the target root window.
+ gfx::Display target_display =
+ Shell::GetScreen()->GetDisplayNearestWindow(target_root);
+ aura::client::ScreenPositionClient* screen_position_client =
+ aura::client::GetScreenPositionClient(src_window->GetRootWindow());
+ if (screen_position_client && target_display.is_valid()) {
+ screen_position_client->SetBounds(widget->GetNativeWindow(),
+ src_window->GetBoundsInScreen(), target_display);
+ } else {
+ widget->SetBounds(src_window->GetBoundsInScreen());
+ }
+ widget->StackAbove(src_window);
+
+ // Move the |recreated_layer| to the newly created window.
+ recreated_layer->set_delegate(src_window->layer()->delegate());
+ gfx::Rect layer_bounds = recreated_layer->bounds();
+ layer_bounds.set_origin(gfx::Point(0, 0));
+ recreated_layer->SetBounds(layer_bounds);
+ recreated_layer->SetVisible(false);
+ recreated_layer->parent()->Remove(recreated_layer);
+
+ aura::Window* window = widget->GetNativeWindow();
+ recreated_layer->SetVisible(true);
+ window->layer()->Add(recreated_layer);
+ window->layer()->StackAtTop(recreated_layer);
+ window->layer()->SetOpacity(1);
+ window->Show();
+ return widget;
+}
+
+// An observer which closes the widget and deletes the layer after an
+// animation finishes.
+class CleanupWidgetAfterAnimationObserver : public ui::LayerAnimationObserver {
+ public:
+ CleanupWidgetAfterAnimationObserver(views::Widget* widget, ui::Layer* layer);
+
+ virtual void OnLayerAnimationEnded(
+ ui::LayerAnimationSequence* sequence) OVERRIDE;
+ virtual void OnLayerAnimationAborted(
+ ui::LayerAnimationSequence* sequence) OVERRIDE;
+ virtual void OnLayerAnimationScheduled(
+ ui::LayerAnimationSequence* sequence) OVERRIDE;
+
+ protected:
+ virtual ~CleanupWidgetAfterAnimationObserver();
+
+ private:
+ views::Widget* widget_;
+ ui::Layer* layer_;
+
+ DISALLOW_COPY_AND_ASSIGN(CleanupWidgetAfterAnimationObserver);
+};
+
+CleanupWidgetAfterAnimationObserver::CleanupWidgetAfterAnimationObserver(
+ views::Widget* widget,
+ ui::Layer* layer)
+ : widget_(widget),
+ layer_(layer) {
+ widget_->GetNativeWindow()->layer()->GetAnimator()->AddObserver(this);
+}
+
+void CleanupWidgetAfterAnimationObserver::OnLayerAnimationEnded(
+ ui::LayerAnimationSequence* sequence) {
+ delete this;
+}
+
+void CleanupWidgetAfterAnimationObserver::OnLayerAnimationAborted(
+ ui::LayerAnimationSequence* sequence) {
+ delete this;
+}
+
+void CleanupWidgetAfterAnimationObserver::OnLayerAnimationScheduled(
+ ui::LayerAnimationSequence* sequence) {
+}
+
+CleanupWidgetAfterAnimationObserver::~CleanupWidgetAfterAnimationObserver() {
+ widget_->GetNativeWindow()->layer()->GetAnimator()->RemoveObserver(this);
+ widget_->Close();
+ widget_ = NULL;
+ if (layer_) {
+ views::corewm::DeepDeleteLayers(layer_);
+ layer_ = NULL;
+ }
+}
+
+// The animation settings used for window selector animations.
+class WindowSelectorAnimationSettings
+ : public ui::ScopedLayerAnimationSettings {
+ public:
+ WindowSelectorAnimationSettings(aura::Window* window) :
+ ui::ScopedLayerAnimationSettings(window->layer()->GetAnimator()) {
+ SetPreemptionStrategy(
+ ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
+ SetTransitionDuration(base::TimeDelta::FromMilliseconds(
+ ScopedTransformOverviewWindow::kTransitionMilliseconds));
+ }
+
+ virtual ~WindowSelectorAnimationSettings() {
+ }
+};
+
+} // namespace
+
+const int ScopedTransformOverviewWindow::kTransitionMilliseconds = 100;
+
+ScopedTransformOverviewWindow::ScopedTransformOverviewWindow(
+ aura::Window* window)
+ : window_(window),
+ window_copy_(NULL),
+ layer_(NULL),
+ minimized_(window->GetProperty(aura::client::kShowStateKey) ==
+ ui::SHOW_STATE_MINIMIZED),
+ overview_started_(false),
+ original_transform_(window->layer()->GetTargetTransform()) {
+}
+
+ScopedTransformOverviewWindow::~ScopedTransformOverviewWindow() {
+ if (window_) {
+ WindowSelectorAnimationSettings animation_settings(window_);
+ gfx::Transform transform;
+ // If the initial window wasn't destroyed and we have copied the window
+ // layer, the copy needs to be animated out.
+ // CleanupWidgetAfterAnimationObserver will destroy the widget and
+ // layer after the animation is complete.
+ if (window_copy_)
+ new CleanupWidgetAfterAnimationObserver(window_copy_, layer_);
+ AnimateTransformOnWindowAndTransientChildren(original_transform_);
+ window_copy_ = NULL;
+ layer_ = NULL;
+ if (minimized_ && window_->GetProperty(aura::client::kShowStateKey) !=
+ ui::SHOW_STATE_MINIMIZED) {
+ // Setting opacity 0 and visible false ensures that the property change
+ // to SHOW_STATE_MINIMIZED will not animate the window from its original
+ // bounds to the minimized position.
+ window_->layer()->SetOpacity(0);
+ window_->Hide();
+ window_->SetProperty(aura::client::kShowStateKey,
+ ui::SHOW_STATE_MINIMIZED);
+ }
+ } else if (window_copy_) {
+ // If this class still owns a copy of the window, clean up the copy. This
+ // will be the case if the window was destroyed.
+ window_copy_->Close();
+ if (layer_)
+ views::corewm::DeepDeleteLayers(layer_);
+ window_copy_ = NULL;
+ layer_ = NULL;
+ }
+}
+
+bool ScopedTransformOverviewWindow::Contains(const aura::Window* window) const {
+ if (window_copy_ && window_copy_->GetNativeWindow()->Contains(window))
+ return true;
+ return window_->Contains(window);
+}
+
+void ScopedTransformOverviewWindow::RestoreWindow() {
+ if (minimized_ && window_->GetProperty(aura::client::kShowStateKey) ==
+ ui::SHOW_STATE_MINIMIZED) {
+ window_->Show();
+ }
+}
+
+void ScopedTransformOverviewWindow::RestoreWindowOnExit() {
+ minimized_ = false;
+ original_transform_ = gfx::Transform();
+}
+
+void ScopedTransformOverviewWindow::OnWindowDestroyed() {
+ window_ = NULL;
+}
+
+gfx::Transform ScopedTransformOverviewWindow::
+ GetTransformForRectPreservingAspectRatio(const gfx::Rect& rect,
+ const gfx::Rect& bounds) {
+ DCHECK(!rect.IsEmpty());
+ DCHECK(!bounds.IsEmpty());
+ float scale = std::min(1.0f,
+ std::min(static_cast<float>(bounds.width()) / rect.width(),
+ static_cast<float>(bounds.height()) / rect.height()));
+ gfx::Transform transform;
+ gfx::Vector2d offset(
+ 0.5 * (bounds.width() - scale * rect.width()),
+ 0.5 * (bounds.height() - scale * rect.height()));
+ transform.Translate(bounds.x() - rect.x() + offset.x(),
+ bounds.y() - rect.y() + offset.y());
+ transform.Scale(scale, scale);
+ return transform;
+}
+
+void ScopedTransformOverviewWindow::SetTransform(
+ aura::RootWindow* root_window,
+ const gfx::Transform& transform) {
+ // If this is the first transform, perform one-time window modifications
+ // necessary for overview mode.
+ if (!overview_started_) {
+ OnOverviewStarted();
+ overview_started_ = true;
+ }
+
+ if (root_window != window_->GetRootWindow() && !window_copy_) {
+ DCHECK(!layer_);
+ layer_ = views::corewm::RecreateWindowLayers(window_, true);
+ window_copy_ = CreateCopyOfWindow(root_window, window_, layer_);
+ }
+ AnimateTransformOnWindowAndTransientChildren(transform);
+}
+
+void ScopedTransformOverviewWindow::
+ AnimateTransformOnWindowAndTransientChildren(
+ const gfx::Transform& transform) {
+ WindowSelectorAnimationSettings animation_settings(window_);
+ window_->SetTransform(transform);
+
+ if (window_copy_) {
+ WindowSelectorAnimationSettings animation_settings(
+ window_copy_->GetNativeWindow());
+ window_copy_->GetNativeWindow()->SetTransform(transform);
+ }
+
+ // TODO(flackr): Create copies of the transient children windows as well.
+ // Currently they will only be visible on the window's initial display.
+ aura::Window::Windows transient_children = window_->transient_children();
+ for (aura::Window::Windows::iterator iter = transient_children.begin();
+ iter != transient_children.end(); ++iter) {
+ aura::Window* transient_child = *iter;
+ WindowSelectorAnimationSettings animation_settings(transient_child);
+ gfx::Transform transient_window_transform;
+ gfx::Rect window_bounds = window_->bounds();
+ gfx::Rect child_bounds = transient_child->bounds();
+ transient_window_transform.Translate(window_bounds.x() - child_bounds.x(),
+ window_bounds.y() - child_bounds.y());
+ transient_window_transform.PreconcatTransform(transform);
+ transient_window_transform.Translate(child_bounds.x() - window_bounds.x(),
+ child_bounds.y() - window_bounds.y());
+ transient_child->SetTransform(transient_window_transform);
+ }
+}
+
+void ScopedTransformOverviewWindow::OnOverviewStarted() {
+ RestoreWindow();
+}
+
+} // namespace ash
diff --git a/ash/wm/overview/scoped_transform_overview_window.h b/ash/wm/overview/scoped_transform_overview_window.h
new file mode 100644
index 0000000000..d6099d3d27
--- /dev/null
+++ b/ash/wm/overview/scoped_transform_overview_window.h
@@ -0,0 +1,102 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_
+#define ASH_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_
+
+#include "base/compiler_specific.h"
+#include "ui/gfx/rect.h"
+#include "ui/gfx/transform.h"
+
+namespace aura {
+class RootWindow;
+class Window;
+}
+
+namespace ui {
+class Layer;
+}
+
+namespace views {
+class Widget;
+}
+
+namespace ash {
+
+// Manages a window in the overview mode. This class allows transforming the
+// window with a helper to determine the best fit in certain bounds and
+// copies the window if being moved to another display. The window's state is
+// restored on destruction of this object.
+class ScopedTransformOverviewWindow {
+ public:
+ // The duration of transitions used for window transforms.
+ static const int kTransitionMilliseconds;
+
+ // Returns the transform necessary to fit |rect| into |bounds| preserving
+ // aspect ratio and centering.
+ static gfx::Transform GetTransformForRectPreservingAspectRatio(
+ const gfx::Rect& rect,
+ const gfx::Rect& bounds);
+
+ explicit ScopedTransformOverviewWindow(aura::Window* window);
+ virtual ~ScopedTransformOverviewWindow();
+
+ // Returns true if this window selector window contains the |target|. This is
+ // used to determine if an event targetted this window.
+ bool Contains(const aura::Window* target) const;
+
+ // Restores the window if it was minimized.
+ void RestoreWindow();
+
+ // Restores this window on exit rather than returning it to a minimized state
+ // if it was minimized on entering overview mode.
+ void RestoreWindowOnExit();
+
+ // Informs the ScopedTransformOverviewWindow that the window being watched was
+ // destroyed. This resets the internal window pointer to avoid calling
+ // anything on the window at destruction time.
+ void OnWindowDestroyed();
+
+ // Sets |transform| on the window and a copy of the window if the target
+ // |root_window| is not the window's root window.
+ void SetTransform(aura::RootWindow* root_window,
+ const gfx::Transform& transform);
+
+ aura::Window* window() const { return window_; }
+
+ protected:
+ // Dispatched when the overview of this window has started.
+ virtual void OnOverviewStarted();
+
+ private:
+ // Applies the |transform| to the overview window and all of its transient
+ // children using animations.
+ void AnimateTransformOnWindowAndTransientChildren(
+ const gfx::Transform& transform);
+
+ // A weak pointer to the real window in the overview.
+ aura::Window* window_;
+
+ // A copy of the window used to transition the window to another root.
+ views::Widget* window_copy_;
+
+ // A weak pointer to a deep copy of the window's layers.
+ ui::Layer* layer_;
+
+ // If true, the window was minimized and should be restored if the window
+ // was not selected.
+ bool minimized_;
+
+ // True if the window has been transformed for overview mode.
+ bool overview_started_;
+
+ // The original transform of the window before entering overview mode.
+ gfx::Transform original_transform_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedTransformOverviewWindow);
+};
+
+} // namespace ash
+
+#endif // ASH_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_
diff --git a/ash/wm/overview/window_overview.cc b/ash/wm/overview/window_overview.cc
index ea139a2b48..f4c9c08295 100644
--- a/ash/wm/overview/window_overview.cc
+++ b/ash/wm/overview/window_overview.cc
@@ -10,12 +10,12 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/overview/window_selector.h"
-#include "ash/wm/overview/window_selector_window.h"
+#include "ash/wm/overview/window_selector_item.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
-#include "ui/base/events/event.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/events/event.h"
#include "ui/views/widget/widget.h"
namespace ash {
@@ -31,14 +31,14 @@ const float kWindowOverviewSelectionOpacity = 0.5f;
const int kWindowOverviewSelectionPadding = 15;
// A comparator for locating a given target window.
-struct WindowSelectorWindowComparator
- : public std::unary_function<WindowSelectorWindow*, bool> {
- explicit WindowSelectorWindowComparator(const aura::Window* target_window)
+struct WindowSelectorItemComparator
+ : public std::unary_function<WindowSelectorItem*, bool> {
+ explicit WindowSelectorItemComparator(const aura::Window* target_window)
: target(target_window) {
}
- bool operator()(const WindowSelectorWindow* window) const {
- return target == window->window();
+ bool operator()(WindowSelectorItem* window) const {
+ return window->TargetedWindow(target) != NULL;
}
const aura::Window* target;
@@ -47,7 +47,7 @@ struct WindowSelectorWindowComparator
} // namespace
WindowOverview::WindowOverview(WindowSelector* window_selector,
- WindowSelectorWindowList* windows,
+ WindowSelectorItemList* windows,
aura::RootWindow* single_root_window)
: window_selector_(window_selector),
windows_(windows),
@@ -89,9 +89,9 @@ void WindowOverview::OnEvent(ui::Event* event) {
// If the event is targetted at any of the windows in the overview, then
// prevent it from propagating.
aura::Window* target = static_cast<aura::Window*>(event->target());
- for (WindowSelectorWindowList::iterator iter = windows_->begin();
+ for (WindowSelectorItemList::iterator iter = windows_->begin();
iter != windows_->end(); ++iter) {
- if ((*iter)->Contains(target)) {
+ if ((*iter)->TargetedWindow(target)) {
// TODO(flackr): StopPropogation prevents generation of gesture events.
// We should find a better way to prevent events from being delivered to
// the window, perhaps a transparent window in front of the target window
@@ -116,24 +116,24 @@ void WindowOverview::OnKeyEvent(ui::KeyEvent* event) {
void WindowOverview::OnMouseEvent(ui::MouseEvent* event) {
if (event->type() != ui::ET_MOUSE_RELEASED)
return;
- WindowSelectorWindow* target = GetEventTarget(event);
+ aura::Window* target = GetEventTarget(event);
if (!target)
return;
- window_selector_->SelectWindow(target->window());
+ window_selector_->SelectWindow(target);
}
void WindowOverview::OnTouchEvent(ui::TouchEvent* event) {
if (event->type() != ui::ET_TOUCH_PRESSED)
return;
- WindowSelectorWindow* target = GetEventTarget(event);
+ aura::Window* target = GetEventTarget(event);
if (!target)
return;
- window_selector_->SelectWindow(target->window());
+ window_selector_->SelectWindow(target);
}
-WindowSelectorWindow* WindowOverview::GetEventTarget(ui::LocatedEvent* event) {
+aura::Window* WindowOverview::GetEventTarget(ui::LocatedEvent* event) {
aura::Window* target = static_cast<aura::Window*>(event->target());
// If the target window doesn't actually contain the event location (i.e.
// mouse down over the window and mouse up elsewhere) then do not select the
@@ -141,18 +141,19 @@ WindowSelectorWindow* WindowOverview::GetEventTarget(ui::LocatedEvent* event) {
if (!target->HitTest(event->location()))
return NULL;
- for (WindowSelectorWindowList::iterator iter = windows_->begin();
+ for (WindowSelectorItemList::iterator iter = windows_->begin();
iter != windows_->end(); ++iter) {
- if ((*iter)->Contains(target))
- return *iter;
+ aura::Window* selected = (*iter)->TargetedWindow(target);
+ if (selected)
+ return selected;
}
return NULL;
}
void WindowOverview::PositionWindows() {
if (single_root_window_) {
- std::vector<WindowSelectorWindow*> windows;
- for (WindowSelectorWindowList::iterator iter = windows_->begin();
+ std::vector<WindowSelectorItem*> windows;
+ for (WindowSelectorItemList::iterator iter = windows_->begin();
iter != windows_->end(); ++iter) {
windows.push_back(*iter);
}
@@ -165,10 +166,10 @@ void WindowOverview::PositionWindows() {
}
void WindowOverview::PositionWindowsFromRoot(aura::RootWindow* root_window) {
- std::vector<WindowSelectorWindow*> windows;
- for (WindowSelectorWindowList::iterator iter = windows_->begin();
+ std::vector<WindowSelectorItem*> windows;
+ for (WindowSelectorItemList::iterator iter = windows_->begin();
iter != windows_->end(); ++iter) {
- if ((*iter)->window()->GetRootWindow() == root_window)
+ if ((*iter)->GetRootWindow() == root_window)
windows.push_back(*iter);
}
PositionWindowsOnRoot(root_window, windows);
@@ -176,7 +177,7 @@ void WindowOverview::PositionWindowsFromRoot(aura::RootWindow* root_window) {
void WindowOverview::PositionWindowsOnRoot(
aura::RootWindow* root_window,
- const std::vector<WindowSelectorWindow*>& windows) {
+ const std::vector<WindowSelectorItem*>& windows) {
if (windows.empty())
return;
@@ -213,7 +214,7 @@ void WindowOverview::PositionWindowsOnRoot(
window_size.width(),
window_size.height());
target_bounds.Inset(kWindowMargin, kWindowMargin);
- windows[i]->TransformToFitBounds(root_window, target_bounds);
+ windows[i]->SetBounds(root_window, target_bounds);
}
}
diff --git a/ash/wm/overview/window_overview.h b/ash/wm/overview/window_overview.h
index 640de0348c..b8c81dbf72 100644
--- a/ash/wm/overview/window_overview.h
+++ b/ash/wm/overview/window_overview.h
@@ -8,9 +8,10 @@
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_handler.h"
namespace aura {
+class Window;
class RootWindow;
}
@@ -25,21 +26,21 @@ class Widget;
namespace ash {
class WindowSelector;
-class WindowSelectorWindow;
+class WindowSelectorItem;
// The WindowOverview shows a grid of all of your windows and allows selecting
// a window by clicking or tapping on it. It also displays a selection widget
// used to indicate the current selection when alt-tabbing between windows.
class WindowOverview : public ui::EventHandler {
public:
- typedef ScopedVector<WindowSelectorWindow> WindowSelectorWindowList;
+ typedef ScopedVector<WindowSelectorItem> WindowSelectorItemList;
// Enters an overview mode displaying |windows| and dispatches methods
// on |window_selector| when a window is selected or selection is canceled.
// If |single_root_window| is not NULL, all windows will be positioned on the
// given root window.
WindowOverview(WindowSelector* window_selector,
- WindowSelectorWindowList* windows,
+ WindowSelectorItemList* windows,
aura::RootWindow* single_root_window);
virtual ~WindowOverview();
@@ -58,7 +59,7 @@ class WindowOverview : public ui::EventHandler {
private:
// Returns the target of |event| or NULL if the event is not targeted at
// any of the windows in the selector.
- WindowSelectorWindow* GetEventTarget(ui::LocatedEvent* event);
+ aura::Window* GetEventTarget(ui::LocatedEvent* event);
// Position all of the windows based on the current selection mode.
void PositionWindows();
@@ -66,7 +67,7 @@ class WindowOverview : public ui::EventHandler {
void PositionWindowsFromRoot(aura::RootWindow* root_window);
// Position all of the |windows| to fit on the |root_window|.
void PositionWindowsOnRoot(aura::RootWindow* root_window,
- const std::vector<WindowSelectorWindow*>& windows);
+ const std::vector<WindowSelectorItem*>& windows);
void InitializeSelectionWidget();
@@ -80,7 +81,7 @@ class WindowOverview : public ui::EventHandler {
// A weak pointer to the collection of windows in the overview wrapped by a
// helper class which restores their state and helps transform them to other
// root windows.
- WindowSelectorWindowList* windows_;
+ WindowSelectorItemList* windows_;
// Widget indicating which window is currently selected.
scoped_ptr<views::Widget> selection_widget_;
diff --git a/ash/wm/overview/window_selector.cc b/ash/wm/overview/window_selector.cc
index 847740c932..3d6a34e33a 100644
--- a/ash/wm/overview/window_selector.cc
+++ b/ash/wm/overview/window_selector.cc
@@ -10,36 +10,52 @@
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/overview/window_overview.h"
#include "ash/wm/overview/window_selector_delegate.h"
+#include "ash/wm/overview/window_selector_panels.h"
#include "ash/wm/overview/window_selector_window.h"
+#include "ash/wm/window_settings.h"
#include "base/auto_reset.h"
#include "base/timer/timer.h"
#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/focus_client.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event.h"
+#include "ui/events/event_handler.h"
namespace ash {
namespace {
-const int kOverviewDelayOnCycleMilliseconds = 300;
+const int kOverviewDelayOnCycleMilliseconds = 500;
// A comparator for locating a given target window.
-struct WindowSelectorWindowComparator
- : public std::unary_function<WindowSelectorWindow*, bool> {
- explicit WindowSelectorWindowComparator(const aura::Window* target_window)
+struct WindowSelectorItemComparator
+ : public std::unary_function<WindowSelectorItem*, bool> {
+ explicit WindowSelectorItemComparator(const aura::Window* target_window)
: target(target_window) {
}
- bool operator()(const WindowSelectorWindow* window) const {
- return target == window->window();
+ bool operator()(WindowSelectorItem* window) const {
+ return window->TargetedWindow(target) != NULL;
}
const aura::Window* target;
};
+// A comparator for locating a selector item for a given root.
+struct WindowSelectorItemForRoot
+ : public std::unary_function<WindowSelectorItem*, bool> {
+ explicit WindowSelectorItemForRoot(const aura::RootWindow* root)
+ : root_window(root) {
+ }
+
+ bool operator()(WindowSelectorItem* item) const {
+ return item->GetRootWindow() == root_window;
+ }
+
+ const aura::RootWindow* root_window;
+};
+
// Filter to watch for the termination of a keyboard gesture to cycle through
// multiple windows.
class WindowSelectorEventFilter : public ui::EventHandler {
@@ -90,14 +106,32 @@ WindowSelector::WindowSelector(const WindowList& windows,
restore_focus_window_(NULL),
restoring_focus_(false) {
DCHECK(delegate_);
- RemoveFocusAndSetRestoreWindow();
+ std::vector<WindowSelectorPanels*> panels_items;
for (size_t i = 0; i < windows.size(); ++i) {
- // restore_focus_window_ is already observed from the call to
- // RemoveFocusAndSetRestoreWindow.
- if (windows[i] != restore_focus_window_)
- windows[i]->AddObserver(this);
- windows_.push_back(new WindowSelectorWindow(windows[i]));
+ windows[i]->AddObserver(this);
+ observed_windows_.insert(windows[i]);
+
+ if (windows[i]->type() == aura::client::WINDOW_TYPE_PANEL &&
+ wm::GetWindowSettings(windows[i])->panel_attached()) {
+ // Attached panel windows are grouped into a single overview item per
+ // root window (display).
+ std::vector<WindowSelectorPanels*>::iterator iter =
+ std::find_if(panels_items.begin(), panels_items.end(),
+ WindowSelectorItemForRoot(windows[i]->GetRootWindow()));
+ WindowSelectorPanels* panels_item = NULL;
+ if (iter == panels_items.end()) {
+ panels_item = new WindowSelectorPanels();
+ panels_items.push_back(panels_item);
+ windows_.push_back(panels_item);
+ } else {
+ panels_item = *iter;
+ }
+ panels_item->AddWindow(windows[i]);
+ } else {
+ windows_.push_back(new WindowSelectorWindow(windows[i]));
+ }
}
+ RemoveFocusAndSetRestoreWindow();
// Observe window activations and switchable containers on all root windows
// for newly created windows during overview.
@@ -121,8 +155,9 @@ WindowSelector::WindowSelector(const WindowList& windows,
WindowSelector::~WindowSelector() {
ResetFocusRestoreWindow(true);
- for (size_t i = 0; i < windows_.size(); i++) {
- windows_[i]->window()->RemoveObserver(this);
+ for (std::set<aura::Window*>::iterator iter = observed_windows_.begin();
+ iter != observed_windows_.end(); ++iter) {
+ (*iter)->RemoveObserver(this);
}
Shell::GetInstance()->activation_client()->RemoveObserver(this);
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
@@ -143,7 +178,8 @@ void WindowSelector::Step(WindowSelector::Direction direction) {
if (window_overview_) {
window_overview_->SetSelection(selected_window_);
} else {
- aura::Window* current_window = windows_[selected_window_]->window();
+ aura::Window* current_window =
+ windows_[selected_window_]->SelectionWindow();
current_window->Show();
current_window->SetTransform(gfx::Transform());
current_window->parent()->StackChildAtTop(current_window);
@@ -153,17 +189,17 @@ void WindowSelector::Step(WindowSelector::Direction direction) {
void WindowSelector::SelectWindow() {
ResetFocusRestoreWindow(false);
- SelectWindow(windows_[selected_window_]->window());
+ SelectWindow(windows_[selected_window_]->SelectionWindow());
}
void WindowSelector::SelectWindow(aura::Window* window) {
- ScopedVector<WindowSelectorWindow>::iterator iter =
+ ScopedVector<WindowSelectorItem>::iterator iter =
std::find_if(windows_.begin(), windows_.end(),
- WindowSelectorWindowComparator(window));
+ WindowSelectorItemComparator(window));
DCHECK(iter != windows_.end());
// The selected window should not be minimized when window selection is
// ended.
- (*iter)->RestoreWindowOnExit();
+ (*iter)->RestoreWindowOnExit(window);
delegate_->OnWindowSelected(window);
}
@@ -188,9 +224,9 @@ void WindowSelector::OnWindowAdded(aura::Window* new_window) {
}
void WindowSelector::OnWindowDestroyed(aura::Window* window) {
- ScopedVector<WindowSelectorWindow>::iterator iter =
+ ScopedVector<WindowSelectorItem>::iterator iter =
std::find_if(windows_.begin(), windows_.end(),
- WindowSelectorWindowComparator(window));
+ WindowSelectorItemComparator(window));
DCHECK(window == restore_focus_window_ || iter != windows_.end());
window->RemoveObserver(this);
if (window == restore_focus_window_)
@@ -198,14 +234,21 @@ void WindowSelector::OnWindowDestroyed(aura::Window* window) {
if (iter == windows_.end())
return;
+ observed_windows_.erase(window);
+ (*iter)->RemoveWindow(window);
+ // If there are still windows in this selector entry then the overview is
+ // still active and the active selection remains the same.
+ if (!(*iter)->empty())
+ return;
+
size_t deleted_index = iter - windows_.begin();
- (*iter)->OnWindowDestroyed();
windows_.erase(iter);
if (windows_.empty()) {
CancelSelection();
return;
}
- window_overview_->OnWindowsChanged();
+ if (window_overview_)
+ window_overview_->OnWindowsChanged();
if (mode_ == CYCLE && selected_window_ >= deleted_index) {
if (selected_window_ > deleted_index)
selected_window_--;
@@ -236,19 +279,22 @@ void WindowSelector::OnAttemptToReactivateWindow(aura::Window* request_active,
void WindowSelector::StartOverview() {
DCHECK(!window_overview_);
window_overview_.reset(new WindowOverview(this, &windows_,
- mode_ == CYCLE ? Shell::GetActiveRootWindow() : NULL));
+ mode_ == CYCLE ? windows_[selected_window_]->GetRootWindow() : NULL));
if (mode_ == CYCLE)
window_overview_->SetSelection(selected_window_);
}
void WindowSelector::RemoveFocusAndSetRestoreWindow() {
aura::client::FocusClient* focus_client = aura::client::GetFocusClient(
- Shell::GetActiveRootWindow());
+ Shell::GetPrimaryRootWindow());
DCHECK(!restore_focus_window_);
restore_focus_window_ = focus_client->GetFocusedWindow();
if (restore_focus_window_) {
focus_client->FocusWindow(NULL);
- restore_focus_window_->AddObserver(this);
+ if (observed_windows_.find(restore_focus_window_) ==
+ observed_windows_.end()) {
+ restore_focus_window_->AddObserver(this);
+ }
}
}
@@ -259,10 +305,10 @@ void WindowSelector::ResetFocusRestoreWindow(bool focus) {
base::AutoReset<bool> restoring_focus(&restoring_focus_, true);
restore_focus_window_->Focus();
}
- // If the window is in the windows_ list it needs to continue to be observed.
- if (std::find_if(windows_.begin(), windows_.end(),
- WindowSelectorWindowComparator(restore_focus_window_)) ==
- windows_.end()) {
+ // If the window is in the observed_windows_ list it needs to continue to be
+ // observed.
+ if (observed_windows_.find(restore_focus_window_) ==
+ observed_windows_.end()) {
restore_focus_window_->RemoveObserver(this);
}
restore_focus_window_ = NULL;
diff --git a/ash/wm/overview/window_selector.h b/ash/wm/overview/window_selector.h
index 4059540df8..b93b5dab1e 100644
--- a/ash/wm/overview/window_selector.h
+++ b/ash/wm/overview/window_selector.h
@@ -5,6 +5,7 @@
#ifndef ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_
#define ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_
+#include <set>
#include <vector>
#include "ash/ash_export.h"
@@ -31,7 +32,7 @@ class WindowSelectorTest;
class WindowOverview;
class WindowSelectorDelegate;
-class WindowSelectorWindow;
+class WindowSelectorItem;
// The WindowSelector allows selecting a window by alt-tabbing (CYCLE mode) or
// by clicking or tapping on it (OVERVIEW mode). A WindowOverview will be shown
@@ -94,9 +95,12 @@ class ASH_EXPORT WindowSelector
// |focus|, restores focus to the stored window.
void ResetFocusRestoreWindow(bool focus);
- // The collection of windows in the overview wrapped by a helper class which
+ // The collection of items in the overview wrapped by a helper class which
// restores their state and helps transform them to other root windows.
- ScopedVector<WindowSelectorWindow> windows_;
+ ScopedVector<WindowSelectorItem> windows_;
+
+ // Tracks observed windows.
+ std::set<aura::Window*> observed_windows_;
// The window selection mode.
Mode mode_;
diff --git a/ash/wm/overview/window_selector_item.cc b/ash/wm/overview/window_selector_item.cc
new file mode 100644
index 0000000000..b5ee7c1b60
--- /dev/null
+++ b/ash/wm/overview/window_selector_item.cc
@@ -0,0 +1,21 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/wm/overview/window_selector_item.h"
+
+namespace ash {
+
+WindowSelectorItem::WindowSelectorItem() {
+}
+
+WindowSelectorItem::~WindowSelectorItem() {
+}
+
+void WindowSelectorItem::SetBounds(aura::RootWindow* root_window,
+ const gfx::Rect& target_bounds) {
+ bounds_ = target_bounds;
+ SetItemBounds(root_window, target_bounds);
+}
+
+} // namespace ash
diff --git a/ash/wm/overview/window_selector_item.h b/ash/wm/overview/window_selector_item.h
new file mode 100644
index 0000000000..d2993f0ea8
--- /dev/null
+++ b/ash/wm/overview/window_selector_item.h
@@ -0,0 +1,69 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_
+#define ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_
+
+#include "base/compiler_specific.h"
+#include "ui/gfx/rect.h"
+
+namespace aura {
+class RootWindow;
+class Window;
+}
+
+namespace ash {
+
+// This class represents an item in overview mode. An item can have one or more
+// windows, of which only one can be activated by keyboard (i.e. alt+tab) but
+// any can be selected with a pointer (touch or mouse).
+class WindowSelectorItem {
+ public:
+ WindowSelectorItem();
+ virtual ~WindowSelectorItem();
+
+ // Returns the root window on which this item is shown.
+ virtual aura::RootWindow* GetRootWindow() = 0;
+
+ // Returns the targeted window given the event |target| window.
+ // Returns NULL if no Window in this item was selected.
+ virtual aura::Window* TargetedWindow(const aura::Window* target) = 0;
+
+ // Restores |window| on exiting window overview rather than returning it
+ // to its previous state.
+ virtual void RestoreWindowOnExit(aura::Window* window) = 0;
+
+ // Returns the |window| to activate on selecting of this item.
+ virtual aura::Window* SelectionWindow() = 0;
+
+ // Removes |window| from this item. Check empty() after calling this to see
+ // if the entire item is now empty.
+ virtual void RemoveWindow(const aura::Window* window) = 0;
+
+ // Returns true if this item has no more selectable windows (i.e. after
+ // calling RemoveWindow for the last contained window).
+ virtual bool empty() const = 0;
+
+ // Sets the bounds of this window selector item to |target_bounds| in the
+ // |root_window| root window.
+ void SetBounds(aura::RootWindow* root_window,
+ const gfx::Rect& target_bounds);
+
+ // Returns the current bounds of this selector item.
+ const gfx::Rect& bounds() { return bounds_; }
+
+ protected:
+ virtual void SetItemBounds(aura::RootWindow* root_window,
+ const gfx::Rect& target_bounds) = 0;
+
+ private:
+ // The bounds this item is fit to.
+ gfx::Rect bounds_;
+
+ DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem);
+};
+
+} // namespace ash
+
+#endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_
diff --git a/ash/wm/overview/window_selector_panels.cc b/ash/wm/overview/window_selector_panels.cc
new file mode 100644
index 0000000000..ea3ee69e3e
--- /dev/null
+++ b/ash/wm/overview/window_selector_panels.cc
@@ -0,0 +1,176 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/wm/overview/window_selector_panels.h"
+
+#include "ash/screen_ash.h"
+#include "ash/shell.h"
+#include "ash/shell_window_ids.h"
+#include "ash/wm/overview/scoped_transform_overview_window.h"
+#include "ash/wm/panels/panel_layout_manager.h"
+#include "ui/aura/client/screen_position_client.h"
+#include "ui/aura/window.h"
+#include "ui/compositor/layer.h"
+#include "ui/compositor/layer_animation_observer.h"
+#include "ui/compositor/layer_animation_sequence.h"
+#include "ui/views/widget/widget.h"
+
+namespace ash {
+
+namespace {
+
+const int kPanelCalloutFadeInDurationMilliseconds = 50;
+
+// This class extends ScopedTransformOverviewMode to hide and show the callout
+// widget for a panel window when entering / leaving overview mode.
+class ScopedTransformPanelWindow : public ScopedTransformOverviewWindow {
+ public:
+ ScopedTransformPanelWindow(aura::Window* window);
+ virtual ~ScopedTransformPanelWindow();
+
+ protected:
+ virtual void OnOverviewStarted() OVERRIDE;
+
+ private:
+ // Returns the callout widget for the transformed panel.
+ views::Widget* GetCalloutWidget();
+
+ // Restores the callout visibility.
+ void RestoreCallout();
+
+ // Trigger relayout
+ void Relayout();
+
+ bool callout_visible_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedTransformPanelWindow);
+};
+
+ScopedTransformPanelWindow::ScopedTransformPanelWindow(aura::Window* window)
+ : ScopedTransformOverviewWindow(window) {
+}
+
+ScopedTransformPanelWindow::~ScopedTransformPanelWindow() {
+ // window() will be NULL if the window was destroyed.
+ if (window())
+ RestoreCallout();
+}
+
+void ScopedTransformPanelWindow::OnOverviewStarted() {
+ ScopedTransformOverviewWindow::OnOverviewStarted();
+ GetCalloutWidget()->GetLayer()->SetOpacity(0.0f);
+}
+
+views::Widget* ScopedTransformPanelWindow::GetCalloutWidget() {
+ DCHECK(window()->parent()->id() == internal::kShellWindowId_PanelContainer);
+ internal::PanelLayoutManager* panel_layout_manager =
+ static_cast<internal::PanelLayoutManager*>(
+ window()->parent()->layout_manager());
+ return panel_layout_manager->GetCalloutWidgetForPanel(window());
+}
+
+void ScopedTransformPanelWindow::RestoreCallout() {
+ scoped_ptr<ui::LayerAnimationSequence> sequence(
+ new ui::LayerAnimationSequence);
+ ui::LayerAnimationElement::AnimatableProperties paused_properties;
+ paused_properties.insert(ui::LayerAnimationElement::OPACITY);
+ sequence->AddElement(ui::LayerAnimationElement::CreatePauseElement(
+ paused_properties, base::TimeDelta::FromMilliseconds(
+ ScopedTransformOverviewWindow::kTransitionMilliseconds)));
+ sequence->AddElement(ui::LayerAnimationElement::CreateOpacityElement(1,
+ base::TimeDelta::FromMilliseconds(
+ kPanelCalloutFadeInDurationMilliseconds)));
+ GetCalloutWidget()->GetLayer()->GetAnimator()->StartAnimation(
+ sequence.release());
+}
+
+} // namespace
+
+WindowSelectorPanels::WindowSelectorPanels() {
+}
+
+WindowSelectorPanels::~WindowSelectorPanels() {
+}
+
+void WindowSelectorPanels::AddWindow(aura::Window* window) {
+ transform_windows_.push_back(new ScopedTransformPanelWindow(window));
+}
+
+aura::RootWindow* WindowSelectorPanels::GetRootWindow() {
+ return transform_windows_.front()->window()->GetRootWindow();
+}
+
+aura::Window* WindowSelectorPanels::TargetedWindow(const aura::Window* target) {
+ for (WindowList::const_iterator iter = transform_windows_.begin();
+ iter != transform_windows_.end(); ++iter) {
+ if ((*iter)->Contains(target))
+ return (*iter)->window();
+ }
+ return NULL;
+}
+
+void WindowSelectorPanels::RestoreWindowOnExit(aura::Window* window) {
+ for (WindowList::iterator iter = transform_windows_.begin();
+ iter != transform_windows_.end(); ++iter) {
+ if ((*iter)->Contains(window)) {
+ (*iter)->RestoreWindowOnExit();
+ break;
+ }
+ }
+}
+
+aura::Window* WindowSelectorPanels::SelectionWindow() {
+ return transform_windows_.front()->window();
+}
+
+void WindowSelectorPanels::RemoveWindow(const aura::Window* window) {
+ for (WindowList::iterator iter = transform_windows_.begin();
+ iter != transform_windows_.end(); ++iter) {
+ if ((*iter)->Contains(window)) {
+ (*iter)->OnWindowDestroyed();
+ transform_windows_.erase(iter);
+ break;
+ }
+ }
+}
+
+bool WindowSelectorPanels::empty() const {
+ return transform_windows_.empty();
+}
+
+void WindowSelectorPanels::SetItemBounds(aura::RootWindow* root_window,
+ const gfx::Rect& target_bounds) {
+ // Panel windows affect the position of each other. Restore all panel windows
+ // first in order to have the correct layout.
+ for (WindowList::iterator iter = transform_windows_.begin();
+ iter != transform_windows_.end(); ++iter) {
+ (*iter)->RestoreWindow();
+ }
+ gfx::Rect bounding_rect;
+ for (WindowList::iterator iter = transform_windows_.begin();
+ iter != transform_windows_.end(); ++iter) {
+ aura::Window* panel = (*iter)->window();
+ gfx::Rect bounds = ScreenAsh::ConvertRectToScreen(
+ panel->parent(), panel->GetTargetBounds());
+ bounding_rect.Union(bounds);
+ }
+ gfx::Transform bounding_transform =
+ ScopedTransformOverviewWindow::GetTransformForRectPreservingAspectRatio(
+ bounding_rect, target_bounds);
+ for (WindowList::iterator iter = transform_windows_.begin();
+ iter != transform_windows_.end(); ++iter) {
+ gfx::Transform transform;
+ aura::Window* panel = (*iter)->window();
+ gfx::Rect bounds = ScreenAsh::ConvertRectToScreen(
+ panel->parent(), panel->GetTargetBounds());
+ transform.Translate(bounding_rect.x() - bounds.x(),
+ bounding_rect.y() - bounds.y());
+ transform.PreconcatTransform(bounding_transform);
+ transform.Translate(bounds.x() - bounding_rect.x(),
+ bounds.y() - bounding_rect.y());
+ (*iter)->SetTransform(root_window, transform);
+ }
+}
+
+} // namespace ash
diff --git a/ash/wm/overview/window_selector_panels.h b/ash/wm/overview/window_selector_panels.h
new file mode 100644
index 0000000000..96239e21bc
--- /dev/null
+++ b/ash/wm/overview/window_selector_panels.h
@@ -0,0 +1,53 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_WM_OVERVIEW_WINDOW_SELECTOR_PANELS_H_
+#define ASH_WM_OVERVIEW_WINDOW_SELECTOR_PANELS_H_
+
+#include "ash/wm/overview/window_selector_item.h"
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_vector.h"
+#include "ui/gfx/rect.h"
+
+namespace aura {
+class RootWindow;
+class Window;
+}
+
+namespace ash {
+
+class ScopedTransformOverviewWindow;
+
+// This class implements a window selector item containing one or more attached
+// panel windows. These panels are grouped into a single overview item in
+// overview mode and the callout arrows are hidden at this point.
+class WindowSelectorPanels : public WindowSelectorItem {
+ public:
+ WindowSelectorPanels();
+ virtual ~WindowSelectorPanels();
+
+ // Adds |window| to the selector item. This window should be an attached
+ // panel window.
+ void AddWindow(aura::Window* window);
+
+ // WindowSelectorItem:
+ virtual aura::RootWindow* GetRootWindow() OVERRIDE;
+ virtual aura::Window* TargetedWindow(const aura::Window* target) OVERRIDE;
+ virtual void RestoreWindowOnExit(aura::Window* window) OVERRIDE;
+ virtual aura::Window* SelectionWindow() OVERRIDE;
+ virtual void RemoveWindow(const aura::Window* window) OVERRIDE;
+ virtual bool empty() const OVERRIDE;
+ virtual void SetItemBounds(aura::RootWindow* root_window,
+ const gfx::Rect& target_bounds) OVERRIDE;
+
+ private:
+ typedef ScopedVector<ScopedTransformOverviewWindow> WindowList;
+ WindowList transform_windows_;
+
+ DISALLOW_COPY_AND_ASSIGN(WindowSelectorPanels);
+};
+
+} // namespace ash
+
+#endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_PANELS_H_
diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc
index 3210259ca4..4da88f52f4 100644
--- a/ash/wm/overview/window_selector_unittest.cc
+++ b/ash/wm/overview/window_selector_unittest.cc
@@ -2,11 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "ash/launcher/launcher.h"
#include "ash/root_window_controller.h"
#include "ash/screen_ash.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
+#include "ash/test/launcher_test_api.h"
+#include "ash/test/launcher_view_test_api.h"
#include "ash/test/shell_test_api.h"
+#include "ash/test/test_launcher_delegate.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/overview/window_selector.h"
#include "ash/wm/overview/window_selector_controller.h"
@@ -34,10 +38,27 @@ class WindowSelectorTest : public test::AshTestBase {
WindowSelectorTest() {}
virtual ~WindowSelectorTest() {}
+ virtual void SetUp() OVERRIDE {
+ test::AshTestBase::SetUp();
+ ASSERT_TRUE(test::TestLauncherDelegate::instance());
+
+ launcher_view_test_.reset(new test::LauncherViewTestAPI(
+ test::LauncherTestAPI(Launcher::ForPrimaryDisplay()).launcher_view()));
+ launcher_view_test_->SetAnimationDuration(1);
+ }
+
aura::Window* CreateWindow(const gfx::Rect& bounds) {
return CreateTestWindowInShellWithDelegate(&wd, -1, bounds);
}
+ aura::Window* CreatePanelWindow(const gfx::Rect& bounds) {
+ aura::Window* window = CreateTestWindowInShellWithDelegateAndType(
+ NULL, aura::client::WINDOW_TYPE_PANEL, 0, bounds);
+ test::TestLauncherDelegate::instance()->AddLauncherItem(window);
+ launcher_view_test()->RunMessageLoopUntilAnimationsDone();
+ return window;
+ }
+
bool WindowsOverlapping(aura::Window* window1, aura::Window* window2) {
gfx::RectF window1_bounds = GetTransformedTargetBounds(window1);
gfx::RectF window2_bounds = GetTransformedTargetBounds(window2);
@@ -67,15 +88,30 @@ class WindowSelectorTest : public test::AshTestBase {
StartOverview();
}
+ gfx::Transform GetTransformRelativeTo(gfx::PointF origin,
+ const gfx::Transform& transform) {
+ gfx::Transform t;
+ t.Translate(origin.x(), origin.y());
+ t.PreconcatTransform(transform);
+ t.Translate(-origin.x(), -origin.y());
+ return t;
+ }
+
gfx::RectF GetTransformedBounds(aura::Window* window) {
- gfx::RectF bounds(window->layer()->bounds());
- window->layer()->transform().TransformRect(&bounds);
+ gfx::RectF bounds(ash::ScreenAsh::ConvertRectToScreen(
+ window->parent(), window->layer()->bounds()));
+ gfx::Transform transform(GetTransformRelativeTo(bounds.origin(),
+ window->layer()->transform()));
+ transform.TransformRect(&bounds);
return bounds;
}
gfx::RectF GetTransformedTargetBounds(aura::Window* window) {
- gfx::RectF bounds(window->layer()->GetTargetBounds());
- window->layer()->GetTargetTransform().TransformRect(&bounds);
+ gfx::RectF bounds(ash::ScreenAsh::ConvertRectToScreen(
+ window->parent(), window->layer()->GetTargetBounds()));
+ gfx::Transform transform(GetTransformRelativeTo(bounds.origin(),
+ window->layer()->GetTargetTransform()));
+ transform.TransformRect(&bounds);
return bounds;
}
@@ -92,11 +128,16 @@ class WindowSelectorTest : public test::AshTestBase {
aura::Window* GetFocusedWindow() {
return aura::client::GetFocusClient(
- Shell::GetActiveRootWindow())->GetFocusedWindow();
+ Shell::GetPrimaryRootWindow())->GetFocusedWindow();
+ }
+
+ test::LauncherViewTestAPI* launcher_view_test() {
+ return launcher_view_test_.get();
}
private:
aura::test::TestWindowDelegate wd;
+ scoped_ptr<test::LauncherViewTestAPI> launcher_view_test_;
DISALLOW_COPY_AND_ASSIGN(WindowSelectorTest);
};
@@ -106,7 +147,10 @@ TEST_F(WindowSelectorTest, Basic) {
gfx::Rect bounds(0, 0, 400, 400);
scoped_ptr<aura::Window> window1(CreateWindow(bounds));
scoped_ptr<aura::Window> window2(CreateWindow(bounds));
+ scoped_ptr<aura::Window> panel1(CreatePanelWindow(bounds));
+ scoped_ptr<aura::Window> panel2(CreatePanelWindow(bounds));
EXPECT_TRUE(WindowsOverlapping(window1.get(), window2.get()));
+ EXPECT_TRUE(WindowsOverlapping(panel1.get(), panel2.get()));
wm::ActivateWindow(window2.get());
EXPECT_FALSE(wm::IsActiveWindow(window1.get()));
EXPECT_TRUE(wm::IsActiveWindow(window2.get()));
@@ -117,6 +161,10 @@ TEST_F(WindowSelectorTest, Basic) {
ToggleOverview();
EXPECT_EQ(NULL, GetFocusedWindow());
EXPECT_FALSE(WindowsOverlapping(window1.get(), window2.get()));
+ EXPECT_FALSE(WindowsOverlapping(window1.get(), panel1.get()));
+ // Panels 1 and 2 should still be overlapping being in a single selector
+ // item.
+ EXPECT_TRUE(WindowsOverlapping(panel1.get(), panel2.get()));
// Clicking window 1 should activate it.
ClickWindow(window1.get());
@@ -148,6 +196,81 @@ TEST_F(WindowSelectorTest, BasicCycle) {
EXPECT_TRUE(wm::IsActiveWindow(window3.get()));
}
+// Tests cycles between panel and normal windows.
+TEST_F(WindowSelectorTest, CyclePanels) {
+ gfx::Rect bounds(0, 0, 400, 400);
+ scoped_ptr<aura::Window> window1(CreateWindow(bounds));
+ scoped_ptr<aura::Window> window2(CreateWindow(bounds));
+ scoped_ptr<aura::Window> panel1(CreatePanelWindow(bounds));
+ scoped_ptr<aura::Window> panel2(CreatePanelWindow(bounds));
+ wm::ActivateWindow(window2.get());
+ wm::ActivateWindow(window1.get());
+ wm::ActivateWindow(panel2.get());
+ wm::ActivateWindow(panel1.get());
+ EXPECT_TRUE(wm::IsActiveWindow(panel1.get()));
+
+ // Cycling once should select window1 since the panels are grouped into a
+ // single selectable item.
+ Cycle(WindowSelector::FORWARD);
+ StopCycling();
+ EXPECT_TRUE(wm::IsActiveWindow(window1.get()));
+
+ // Cycling again should select the most recently used panel.
+ Cycle(WindowSelector::FORWARD);
+ StopCycling();
+ EXPECT_TRUE(wm::IsActiveWindow(panel1.get()));
+}
+
+// Tests cycles between panel and normal windows.
+TEST_F(WindowSelectorTest, CyclePanelsDestroyed) {
+ gfx::Rect bounds(0, 0, 400, 400);
+ scoped_ptr<aura::Window> window1(CreateWindow(bounds));
+ scoped_ptr<aura::Window> window2(CreateWindow(bounds));
+ scoped_ptr<aura::Window> window3(CreateWindow(bounds));
+ scoped_ptr<aura::Window> panel1(CreatePanelWindow(bounds));
+ scoped_ptr<aura::Window> panel2(CreatePanelWindow(bounds));
+ wm::ActivateWindow(window3.get());
+ wm::ActivateWindow(panel2.get());
+ wm::ActivateWindow(panel1.get());
+ wm::ActivateWindow(window2.get());
+ wm::ActivateWindow(window1.get());
+ EXPECT_TRUE(wm::IsActiveWindow(window1.get()));
+
+ // Cycling once highlights window2.
+ Cycle(WindowSelector::FORWARD);
+ // All panels are destroyed.
+ panel1.reset();
+ panel2.reset();
+ // Cycling again should now select window3.
+ Cycle(WindowSelector::FORWARD);
+ StopCycling();
+ EXPECT_TRUE(wm::IsActiveWindow(window3.get()));
+}
+
+// Tests cycles between panel and normal windows.
+TEST_F(WindowSelectorTest, CycleMruPanelDestroyed) {
+ gfx::Rect bounds(0, 0, 400, 400);
+ scoped_ptr<aura::Window> window1(CreateWindow(bounds));
+ scoped_ptr<aura::Window> window2(CreateWindow(bounds));
+ scoped_ptr<aura::Window> panel1(CreatePanelWindow(bounds));
+ scoped_ptr<aura::Window> panel2(CreatePanelWindow(bounds));
+ wm::ActivateWindow(panel2.get());
+ wm::ActivateWindow(panel1.get());
+ wm::ActivateWindow(window2.get());
+ wm::ActivateWindow(window1.get());
+ EXPECT_TRUE(wm::IsActiveWindow(window1.get()));
+
+ // Cycling once highlights window2.
+ Cycle(WindowSelector::FORWARD);
+ // Panel 1 is the next item as the MRU panel, removing it should make panel 2
+ // the next window to be selected.
+ panel1.reset();
+ // Cycling again should now select window3.
+ Cycle(WindowSelector::FORWARD);
+ StopCycling();
+ EXPECT_TRUE(wm::IsActiveWindow(panel2.get()));
+}
+
// Tests that a newly created window aborts overview.
TEST_F(WindowSelectorTest, NewWindowCancelsOveriew) {
gfx::Rect bounds(0, 0, 400, 400);
@@ -257,32 +380,86 @@ TEST_F(WindowSelectorTest, MultipleDisplays) {
if (!SupportsMultipleDisplays())
return;
- UpdateDisplay("400x400,400x400");
+ UpdateDisplay("600x400,600x400");
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
-
- scoped_ptr<aura::Window> window1(CreateWindow(gfx::Rect(0, 0, 100, 100)));
- scoped_ptr<aura::Window> window2(CreateWindow(gfx::Rect(0, 0, 100, 100)));
- scoped_ptr<aura::Window> window3(CreateWindow(gfx::Rect(450, 0, 100, 100)));
- scoped_ptr<aura::Window> window4(CreateWindow(gfx::Rect(450, 0, 100, 100)));
+ gfx::Rect bounds1(0, 0, 400, 400);
+ gfx::Rect bounds2(650, 0, 400, 400);
+
+ scoped_ptr<aura::Window> window1(CreateWindow(bounds1));
+ scoped_ptr<aura::Window> window2(CreateWindow(bounds1));
+ scoped_ptr<aura::Window> window3(CreateWindow(bounds2));
+ scoped_ptr<aura::Window> window4(CreateWindow(bounds2));
+ scoped_ptr<aura::Window> panel1(CreatePanelWindow(bounds1));
+ scoped_ptr<aura::Window> panel2(CreatePanelWindow(bounds1));
+ scoped_ptr<aura::Window> panel3(CreatePanelWindow(bounds2));
+ scoped_ptr<aura::Window> panel4(CreatePanelWindow(bounds2));
EXPECT_EQ(root_windows[0], window1->GetRootWindow());
EXPECT_EQ(root_windows[0], window2->GetRootWindow());
EXPECT_EQ(root_windows[1], window3->GetRootWindow());
EXPECT_EQ(root_windows[1], window4->GetRootWindow());
+ EXPECT_EQ(root_windows[0], panel1->GetRootWindow());
+ EXPECT_EQ(root_windows[0], panel2->GetRootWindow());
+ EXPECT_EQ(root_windows[1], panel3->GetRootWindow());
+ EXPECT_EQ(root_windows[1], panel4->GetRootWindow());
+
// In overview mode, each window remains in the same root window.
ToggleOverview();
EXPECT_EQ(root_windows[0], window1->GetRootWindow());
EXPECT_EQ(root_windows[0], window2->GetRootWindow());
EXPECT_EQ(root_windows[1], window3->GetRootWindow());
EXPECT_EQ(root_windows[1], window4->GetRootWindow());
- root_windows[0]->bounds().Contains(
- ToEnclosingRect(GetTransformedBounds(window1.get())));
- root_windows[0]->bounds().Contains(
- ToEnclosingRect(GetTransformedBounds(window2.get())));
- root_windows[1]->bounds().Contains(
- ToEnclosingRect(GetTransformedBounds(window3.get())));
- root_windows[1]->bounds().Contains(
- ToEnclosingRect(GetTransformedBounds(window4.get())));
+ EXPECT_EQ(root_windows[0], panel1->GetRootWindow());
+ EXPECT_EQ(root_windows[0], panel2->GetRootWindow());
+ EXPECT_EQ(root_windows[1], panel3->GetRootWindow());
+ EXPECT_EQ(root_windows[1], panel4->GetRootWindow());
+
+ EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains(
+ ToEnclosingRect(GetTransformedTargetBounds(window1.get()))));
+ EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains(
+ ToEnclosingRect(GetTransformedTargetBounds(window2.get()))));
+ EXPECT_TRUE(root_windows[1]->GetBoundsInScreen().Contains(
+ ToEnclosingRect(GetTransformedTargetBounds(window3.get()))));
+ EXPECT_TRUE(root_windows[1]->GetBoundsInScreen().Contains(
+ ToEnclosingRect(GetTransformedTargetBounds(window4.get()))));
+
+ EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains(
+ ToEnclosingRect(GetTransformedTargetBounds(panel1.get()))));
+ EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains(
+ ToEnclosingRect(GetTransformedTargetBounds(panel2.get()))));
+ EXPECT_TRUE(root_windows[1]->GetBoundsInScreen().Contains(
+ ToEnclosingRect(GetTransformedTargetBounds(panel3.get()))));
+ EXPECT_TRUE(root_windows[1]->GetBoundsInScreen().Contains(
+ ToEnclosingRect(GetTransformedTargetBounds(panel4.get()))));
+ EXPECT_TRUE(WindowsOverlapping(panel1.get(), panel2.get()));
+ EXPECT_TRUE(WindowsOverlapping(panel3.get(), panel4.get()));
+ EXPECT_FALSE(WindowsOverlapping(panel1.get(), panel3.get()));
+}
+
+// Verifies that the single display overview used during alt tab cycling uses
+// the display of the currently selected window.
+TEST_F(WindowSelectorTest, CycleOverviewUsesCurrentDisplay) {
+ if (!SupportsMultipleDisplays())
+ return;
+
+ UpdateDisplay("400x400,400x400");
+ Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
+
+ scoped_ptr<aura::Window> window1(CreateWindow(gfx::Rect(0, 0, 100, 100)));
+ scoped_ptr<aura::Window> window2(CreateWindow(gfx::Rect(450, 0, 100, 100)));
+ EXPECT_EQ(root_windows[0], window1->GetRootWindow());
+ EXPECT_EQ(root_windows[1], window2->GetRootWindow());
+ wm::ActivateWindow(window2.get());
+ wm::ActivateWindow(window1.get());
+ EXPECT_EQ(root_windows[0], Shell::GetTargetRootWindow());
+
+ Cycle(WindowSelector::FORWARD);
+ FireOverviewStartTimer();
+
+ EXPECT_TRUE(root_windows[1]->GetBoundsInScreen().Contains(
+ ToEnclosingRect(GetTransformedTargetBounds(window1.get()))));
+ EXPECT_TRUE(root_windows[1]->GetBoundsInScreen().Contains(
+ ToEnclosingRect(GetTransformedTargetBounds(window2.get()))));
}
} // namespace internal
diff --git a/ash/wm/overview/window_selector_window.cc b/ash/wm/overview/window_selector_window.cc
index 226c782462..1406a2f353 100644
--- a/ash/wm/overview/window_selector_window.cc
+++ b/ash/wm/overview/window_selector_window.cc
@@ -4,239 +4,50 @@
#include "ash/wm/overview/window_selector_window.h"
-#include "ash/shell.h"
-#include "ui/aura/client/aura_constants.h"
-#include "ui/aura/client/screen_position_client.h"
-#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
-#include "ui/compositor/layer_animation_observer.h"
-#include "ui/compositor/scoped_layer_animation_settings.h"
-#include "ui/gfx/display.h"
-#include "ui/gfx/interpolated_transform.h"
-#include "ui/gfx/transform_util.h"
-#include "ui/views/corewm/shadow_types.h"
-#include "ui/views/corewm/window_animations.h"
-#include "ui/views/corewm/window_util.h"
-#include "ui/views/widget/widget.h"
namespace ash {
-namespace {
-
-const int kOverviewWindowTransitionMilliseconds = 100;
-
-// Creates a copy of |window| with |recreated_layer| in the |target_root|.
-views::Widget* CreateCopyOfWindow(aura::RootWindow* target_root,
- aura::Window* src_window,
- ui::Layer* recreated_layer) {
- views::Widget* widget = new views::Widget;
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
- params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
- params.parent = src_window->parent();
- params.can_activate = false;
- params.keep_on_top = true;
- widget->set_focus_on_creation(false);
- widget->Init(params);
- widget->SetVisibilityChangedAnimationsEnabled(false);
- std::string name = src_window->name() + " (Copy)";
- widget->GetNativeWindow()->SetName(name);
- views::corewm::SetShadowType(widget->GetNativeWindow(),
- views::corewm::SHADOW_TYPE_RECTANGULAR);
-
- // Set the bounds in the target root window.
- gfx::Display target_display =
- Shell::GetScreen()->GetDisplayNearestWindow(target_root);
- aura::client::ScreenPositionClient* screen_position_client =
- aura::client::GetScreenPositionClient(src_window->GetRootWindow());
- if (screen_position_client && target_display.is_valid()) {
- screen_position_client->SetBounds(widget->GetNativeWindow(),
- src_window->GetBoundsInScreen(), target_display);
- } else {
- widget->SetBounds(src_window->GetBoundsInScreen());
- }
- widget->StackAbove(src_window);
-
- // Move the |recreated_layer| to the newly created window.
- recreated_layer->set_delegate(src_window->layer()->delegate());
- gfx::Rect layer_bounds = recreated_layer->bounds();
- layer_bounds.set_origin(gfx::Point(0, 0));
- recreated_layer->SetBounds(layer_bounds);
- recreated_layer->SetVisible(false);
- recreated_layer->parent()->Remove(recreated_layer);
-
- aura::Window* window = widget->GetNativeWindow();
- recreated_layer->SetVisible(true);
- window->layer()->Add(recreated_layer);
- window->layer()->StackAtTop(recreated_layer);
- window->layer()->SetOpacity(1);
- window->Show();
- return widget;
-}
-
-// An observer which closes the widget and deletes the layer after an
-// animation finishes.
-class CleanupWidgetAfterAnimationObserver : public ui::LayerAnimationObserver {
- public:
- CleanupWidgetAfterAnimationObserver(views::Widget* widget, ui::Layer* layer);
-
- virtual void OnLayerAnimationEnded(
- ui::LayerAnimationSequence* sequence) OVERRIDE;
- virtual void OnLayerAnimationAborted(
- ui::LayerAnimationSequence* sequence) OVERRIDE;
- virtual void OnLayerAnimationScheduled(
- ui::LayerAnimationSequence* sequence) OVERRIDE;
-
- protected:
- virtual ~CleanupWidgetAfterAnimationObserver();
-
- private:
- views::Widget* widget_;
- ui::Layer* layer_;
-
- DISALLOW_COPY_AND_ASSIGN(CleanupWidgetAfterAnimationObserver);
-};
-
-CleanupWidgetAfterAnimationObserver::CleanupWidgetAfterAnimationObserver(
- views::Widget* widget,
- ui::Layer* layer)
- : widget_(widget),
- layer_(layer) {
- widget_->GetNativeWindow()->layer()->GetAnimator()->AddObserver(this);
-}
-
-void CleanupWidgetAfterAnimationObserver::OnLayerAnimationEnded(
- ui::LayerAnimationSequence* sequence) {
- delete this;
+WindowSelectorWindow::WindowSelectorWindow(aura::Window* window)
+ : transform_window_(window) {
}
-void CleanupWidgetAfterAnimationObserver::OnLayerAnimationAborted(
- ui::LayerAnimationSequence* sequence) {
- delete this;
+WindowSelectorWindow::~WindowSelectorWindow() {
}
-void CleanupWidgetAfterAnimationObserver::OnLayerAnimationScheduled(
- ui::LayerAnimationSequence* sequence) {
+aura::RootWindow* WindowSelectorWindow::GetRootWindow() {
+ return transform_window_.window()->GetRootWindow();
}
-CleanupWidgetAfterAnimationObserver::~CleanupWidgetAfterAnimationObserver() {
- widget_->GetNativeWindow()->layer()->GetAnimator()->RemoveObserver(this);
- widget_->Close();
- widget_ = NULL;
- if (layer_) {
- views::corewm::DeepDeleteLayers(layer_);
- layer_ = NULL;
- }
+aura::Window* WindowSelectorWindow::TargetedWindow(const aura::Window* target) {
+ if (transform_window_.Contains(target))
+ return transform_window_.window();
+ return NULL;
}
-// The animation settings used for window selector animations.
-class WindowSelectorAnimationSettings
- : public ui::ScopedLayerAnimationSettings {
- public:
- WindowSelectorAnimationSettings(aura::Window* window) :
- ui::ScopedLayerAnimationSettings(window->layer()->GetAnimator()) {
- SetPreemptionStrategy(
- ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
- SetTransitionDuration(base::TimeDelta::FromMilliseconds(
- kOverviewWindowTransitionMilliseconds));
- }
-
- virtual ~WindowSelectorAnimationSettings() {
- }
-};
-
-} // namespace
-
-WindowSelectorWindow::WindowSelectorWindow(aura::Window* window)
- : window_(window),
- window_copy_(NULL),
- layer_(NULL),
- minimized_(window->GetProperty(aura::client::kShowStateKey) ==
- ui::SHOW_STATE_MINIMIZED),
- original_transform_(window->layer()->GetTargetTransform()) {
-}
-
-WindowSelectorWindow::~WindowSelectorWindow() {
- if (window_) {
- WindowSelectorAnimationSettings animation_settings(window_);
- gfx::Transform transform;
- window_->SetTransform(original_transform_);
- if (minimized_ && window_->GetProperty(aura::client::kShowStateKey) !=
- ui::SHOW_STATE_MINIMIZED) {
- // Setting opacity 0 and visible false ensures that the property change
- // to SHOW_STATE_MINIMIZED will not animate the window from its original
- // bounds to the minimized position.
- window_->layer()->SetOpacity(0);
- window_->layer()->SetVisible(false);
- window_->SetProperty(aura::client::kShowStateKey,
- ui::SHOW_STATE_MINIMIZED);
- }
- }
- // If a copy of the window was created, clean it up.
- if (window_copy_) {
- if (window_) {
- // If the initial window wasn't destroyed, the copy needs to be animated
- // out. CleanupWidgetAfterAnimationObserver will destroy the widget and
- // layer after the animation is complete.
- new CleanupWidgetAfterAnimationObserver(window_copy_, layer_);
- WindowSelectorAnimationSettings animation_settings(
- window_copy_->GetNativeWindow());
- window_copy_->GetNativeWindow()->SetTransform(original_transform_);
- } else {
- window_copy_->Close();
- if (layer_)
- views::corewm::DeepDeleteLayers(layer_);
- }
- window_copy_ = NULL;
- layer_ = NULL;
- }
+void WindowSelectorWindow::RestoreWindowOnExit(aura::Window* window) {
+ transform_window_.RestoreWindowOnExit();
}
-bool WindowSelectorWindow::Contains(const aura::Window* window) const {
- if (window_copy_ && window_copy_->GetNativeWindow()->Contains(window))
- return true;
- return window_->Contains(window);
+aura::Window* WindowSelectorWindow::SelectionWindow() {
+ return transform_window_.window();
}
-void WindowSelectorWindow::RestoreWindowOnExit() {
- minimized_ = false;
- original_transform_ = gfx::Transform();
+void WindowSelectorWindow::RemoveWindow(const aura::Window* window) {
+ DCHECK_EQ(transform_window_.window(), window);
+ transform_window_.OnWindowDestroyed();
}
-void WindowSelectorWindow::OnWindowDestroyed() {
- window_ = NULL;
+bool WindowSelectorWindow::empty() const {
+ return transform_window_.window() == NULL;
}
-void WindowSelectorWindow::TransformToFitBounds(
- aura::RootWindow* root_window,
- const gfx::Rect& target_bounds) {
- if (minimized_ && window_->GetProperty(aura::client::kShowStateKey) ==
- ui::SHOW_STATE_MINIMIZED) {
- window_->Show();
- }
- fit_bounds_ = target_bounds;
- const gfx::Rect bounds = window_->GetBoundsInScreen();
- float scale = std::min(1.0f,
- std::min(static_cast<float>(target_bounds.width()) / bounds.width(),
- static_cast<float>(target_bounds.height()) / bounds.height()));
- gfx::Transform transform;
- gfx::Vector2d offset(
- 0.5 * (target_bounds.width() - scale * bounds.width()),
- 0.5 * (target_bounds.height() - scale * bounds.height()));
- transform.Translate(target_bounds.x() - bounds.x() + offset.x(),
- target_bounds.y() - bounds.y() + offset.y());
- transform.Scale(scale, scale);
- if (root_window != window_->GetRootWindow()) {
- if (!window_copy_) {
- DCHECK(!layer_);
- layer_ = views::corewm::RecreateWindowLayers(window_, true);
- window_copy_ = CreateCopyOfWindow(root_window, window_, layer_);
- }
- WindowSelectorAnimationSettings animation_settings(
- window_copy_->GetNativeWindow());
- window_copy_->GetNativeWindow()->SetTransform(transform);
- }
- WindowSelectorAnimationSettings animation_settings(window_);
- window_->SetTransform(transform);
+void WindowSelectorWindow::SetItemBounds(aura::RootWindow* root_window,
+ const gfx::Rect& target_bounds) {
+ gfx::Rect bounding_rect = transform_window_.window()->GetBoundsInScreen();
+ transform_window_.SetTransform(root_window,
+ ScopedTransformOverviewWindow::GetTransformForRectPreservingAspectRatio(
+ transform_window_.window()->GetBoundsInScreen(), target_bounds));
}
} // namespace ash
diff --git a/ash/wm/overview/window_selector_window.h b/ash/wm/overview/window_selector_window.h
index 050ac93742..7bf83fa41e 100644
--- a/ash/wm/overview/window_selector_window.h
+++ b/ash/wm/overview/window_selector_window.h
@@ -5,76 +5,37 @@
#ifndef ASH_WM_OVERVIEW_WINDOW_SELECTOR_WINDOW_H_
#define ASH_WM_OVERVIEW_WINDOW_SELECTOR_WINDOW_H_
+#include "ash/wm/overview/scoped_transform_overview_window.h"
+#include "ash/wm/overview/window_selector_item.h"
#include "base/compiler_specific.h"
#include "ui/gfx/rect.h"
-#include "ui/gfx/transform.h"
namespace aura {
class RootWindow;
class Window;
}
-namespace ui {
-class Layer;
-}
-
-namespace views {
-class Widget;
-}
-
namespace ash {
-// Manages a window in the overview mode. This class transitions the window
-// to the best fit within the available overview rectangle, copying it if the
-// window is sent to another display and restores the window state on
-// deletion.
-class WindowSelectorWindow {
+// This implements a window overview item with a single window which can be
+// selected.
+class WindowSelectorWindow : public WindowSelectorItem {
public:
- explicit WindowSelectorWindow(aura::Window* window);
+ WindowSelectorWindow(aura::Window* window);
virtual ~WindowSelectorWindow();
- aura::Window* window() { return window_; }
- const aura::Window* window() const { return window_; }
-
- // Returns true if this window selector window contains the |target|. This is
- // used to determine if an event targetted this window.
- bool Contains(const aura::Window* target) const;
-
- // Restores this window on exit rather than returning it to a minimized state
- // if it was minimized on entering overview mode.
- void RestoreWindowOnExit();
-
- // Informs the WindowSelectorWindow that the window being watched was
- // destroyed. This resets the internal window pointer to avoid calling
- // anything on the window at destruction time.
- void OnWindowDestroyed();
-
- // Applies a transform to the window to fit within |target_bounds| while
- // maintaining its aspect ratio.
- void TransformToFitBounds(aura::RootWindow* root_window,
- const gfx::Rect& target_bounds);
-
- const gfx::Rect& bounds() { return fit_bounds_; }
+ // WindowSelectorItem:
+ virtual aura::RootWindow* GetRootWindow() OVERRIDE;
+ virtual aura::Window* TargetedWindow(const aura::Window* target) OVERRIDE;
+ virtual void RestoreWindowOnExit(aura::Window* window) OVERRIDE;
+ virtual aura::Window* SelectionWindow() OVERRIDE;
+ virtual void RemoveWindow(const aura::Window* window) OVERRIDE;
+ virtual bool empty() const OVERRIDE;
+ virtual void SetItemBounds(aura::RootWindow* root_window,
+ const gfx::Rect& target_bounds) OVERRIDE;
private:
- // A weak pointer to the real window in the overview.
- aura::Window* window_;
-
- // A copy of the window used to transition the window to another root.
- views::Widget* window_copy_;
-
- // A weak pointer to a deep copy of the window's layers.
- ui::Layer* layer_;
-
- // If true, the window was minimized and should be restored if the window
- // was not selected.
- bool minimized_;
-
- // The original transform of the window before entering overview mode.
- gfx::Transform original_transform_;
-
- // The bounds this window is fit to.
- gfx::Rect fit_bounds_;
+ ScopedTransformOverviewWindow transform_window_;
DISALLOW_COPY_AND_ASSIGN(WindowSelectorWindow);
};
diff --git a/ash/wm/panels/panel_frame_view.cc b/ash/wm/panels/panel_frame_view.cc
index db137fadae..7a1e31f1fc 100644
--- a/ash/wm/panels/panel_frame_view.cc
+++ b/ash/wm/panels/panel_frame_view.cc
@@ -4,15 +4,15 @@
#include "ash/wm/panels/panel_frame_view.h"
+#include "ash/wm/caption_buttons/frame_caption_button_container_view.h"
#include "ash/wm/frame_painter.h"
-#include "ash/wm/workspace/frame_caption_button_container_view.h"
#include "grit/ash_resources.h"
#include "third_party/skia/include/core/SkPaint.h"
-#include "ui/base/animation/throb_animation.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/hit_test.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/gfx/animation/throb_animation.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/font.h"
#include "ui/gfx/image/image.h"
@@ -45,7 +45,7 @@ const char* PanelFrameView::GetClassName() const {
void PanelFrameView::InitFramePainter() {
frame_painter_.reset(new FramePainter);
- caption_button_container_ = new FrameCaptionButtonContainerView(this, frame_,
+ caption_button_container_ = new FrameCaptionButtonContainerView(frame_,
FrameCaptionButtonContainerView::MINIMIZE_ALLOWED);
AddChildView(caption_button_container_);
diff --git a/ash/wm/panels/panel_layout_manager.cc b/ash/wm/panels/panel_layout_manager.cc
index 65f15e69ab..ea6f9e9cbc 100644
--- a/ash/wm/panels/panel_layout_manager.cc
+++ b/ash/wm/panels/panel_layout_manager.cc
@@ -330,6 +330,15 @@ void PanelLayoutManager::ToggleMinimize(aura::Window* panel) {
}
}
+views::Widget* PanelLayoutManager::GetCalloutWidgetForPanel(
+ aura::Window* panel) {
+ DCHECK(panel->parent() == panel_container_);
+ PanelList::iterator found =
+ std::find(panel_windows_.begin(), panel_windows_.end(), panel);
+ DCHECK(found != panel_windows_.end());
+ return found->callout_widget;
+}
+
////////////////////////////////////////////////////////////////////////////////
// PanelLayoutManager, aura::LayoutManager implementation:
void PanelLayoutManager::OnWindowResized() {
@@ -832,7 +841,8 @@ void PanelLayoutManager::UpdateCallouts() {
ui::Layer* layer = callout_widget->GetNativeWindow()->layer();
// If the panel is not over the callout position or has just become visible
// then fade in the callout.
- if (distance_until_over_panel > 0 || layer->GetTargetOpacity() < 1) {
+ if ((distance_until_over_panel > 0 || layer->GetTargetOpacity() < 1) &&
+ panel->layer()->GetTargetTransform().IsIdentity()) {
if (distance_until_over_panel > 0 &&
slide_distance >= distance_until_over_panel) {
layer->SetOpacity(0);
diff --git a/ash/wm/panels/panel_layout_manager.h b/ash/wm/panels/panel_layout_manager.h
index f3b128cb18..9c35b00203 100644
--- a/ash/wm/panels/panel_layout_manager.h
+++ b/ash/wm/panels/panel_layout_manager.h
@@ -71,6 +71,9 @@ class ASH_EXPORT PanelLayoutManager
void ToggleMinimize(aura::Window* panel);
+ // Returns the callout widget (arrow) for |panel|.
+ views::Widget* GetCalloutWidgetForPanel(aura::Window* panel);
+
ash::Launcher* launcher() { return launcher_; }
void SetLauncher(ash::Launcher* launcher);
diff --git a/ash/wm/panels/panel_layout_manager_unittest.cc b/ash/wm/panels/panel_layout_manager_unittest.cc
index 0670b445bf..ae305e9830 100644
--- a/ash/wm/panels/panel_layout_manager_unittest.cc
+++ b/ash/wm/panels/panel_layout_manager_unittest.cc
@@ -17,6 +17,7 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/test/ash_test_base.h"
+#include "ash/test/launcher_test_api.h"
#include "ash/test/launcher_view_test_api.h"
#include "ash/test/shell_test_api.h"
#include "ash/test/test_launcher_delegate.h"
@@ -50,7 +51,7 @@ class PanelLayoutManagerTest : public test::AshTestBase {
ASSERT_TRUE(test::TestLauncherDelegate::instance());
launcher_view_test_.reset(new test::LauncherViewTestAPI(
- Launcher::ForPrimaryDisplay()->GetLauncherViewForTest()));
+ GetLauncherView(Launcher::ForPrimaryDisplay())));
launcher_view_test_->SetAnimationDuration(1);
}
@@ -251,8 +252,7 @@ class PanelLayoutManagerTest : public test::AshTestBase {
RootWindowController::ForWindow(window)->shelf()->
shelf_layout_manager();
shelf->SetAutoHideBehavior(behavior);
- LauncherView* launcher_view =
- Launcher::ForWindow(window)->GetLauncherViewForTest();
+ LauncherView* launcher_view = GetLauncherView(Launcher::ForWindow(window));
test::LauncherViewTestAPI test_api(launcher_view);
test_api.RunMessageLoopUntilAnimationsDone();
}
@@ -265,6 +265,10 @@ class PanelLayoutManagerTest : public test::AshTestBase {
shelf->SetState(visibility_state);
}
+ internal::LauncherView* GetLauncherView(Launcher* launcher) {
+ return test::LauncherTestAPI(launcher).launcher_view();
+ }
+
private:
scoped_ptr<test::LauncherViewTestAPI> launcher_view_test_;
@@ -607,9 +611,9 @@ TEST_F(PanelLayoutManagerTest, PanelMoveBetweenMultipleDisplays) {
scoped_ptr<aura::Window> p2_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50)));
LauncherView* launcher_view_1st =
- Launcher::ForPrimaryDisplay()->GetLauncherViewForTest();
+ GetLauncherView(Launcher::ForPrimaryDisplay());
LauncherView* launcher_view_2nd =
- Launcher::ForWindow(root_windows[1])->GetLauncherViewForTest();
+ GetLauncherView(Launcher::ForWindow(root_windows[1]));
EXPECT_EQ(root_windows[0], p1_d1->GetRootWindow());
EXPECT_EQ(root_windows[0], p2_d1->GetRootWindow());
diff --git a/ash/wm/panels/panel_window_event_handler.cc b/ash/wm/panels/panel_window_event_handler.cc
index 7f00e55405..b15d8b6ba1 100644
--- a/ash/wm/panels/panel_window_event_handler.cc
+++ b/ash/wm/panels/panel_window_event_handler.cc
@@ -7,8 +7,8 @@
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
-#include "ui/base/events/event.h"
#include "ui/base/hit_test.h"
+#include "ui/events/event.h"
namespace ash {
namespace internal {
diff --git a/ash/wm/partial_screenshot_view.cc b/ash/wm/partial_screenshot_view.cc
index 1b2fa6661a..e3f55283a4 100644
--- a/ash/wm/partial_screenshot_view.cc
+++ b/ash/wm/partial_screenshot_view.cc
@@ -14,7 +14,7 @@
#include "ui/aura/client/capture_client.h"
#include "ui/aura/root_window.h"
#include "ui/base/cursor/cursor.h"
-#include "ui/base/events/event.h"
+#include "ui/events/event.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/rect.h"
#include "ui/views/view.h"
diff --git a/ash/wm/session_state_animator.cc b/ash/wm/session_state_animator.cc
index 35ac4cc49d..81e3fcc2bc 100644
--- a/ash/wm/session_state_animator.cc
+++ b/ash/wm/session_state_animator.cc
@@ -163,11 +163,11 @@ void HideWindow(aura::Window* window,
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
settings.SetTransitionDuration(duration);
- settings.SetTweenType(ui::Tween::EASE_OUT);
+ settings.SetTweenType(gfx::Tween::EASE_OUT);
SetTransformForScaleAnimation(layer,
above ? LAYER_SCALE_ANIMATION_ABOVE : LAYER_SCALE_ANIMATION_BELOW);
- settings.SetTweenType(ui::Tween::EASE_IN_OUT);
+ settings.SetTweenType(gfx::Tween::EASE_IN_OUT);
layer->SetOpacity(0.0f);
// After the animation completes snap the transform back to the identity,
@@ -203,10 +203,10 @@ void TransformWindowToBaseState(aura::Window* window,
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
settings.SetTransitionDuration(duration);
- settings.SetTweenType(ui::Tween::EASE_OUT);
+ settings.SetTweenType(gfx::Tween::EASE_OUT);
layer->SetTransform(gfx::Transform());
- settings.SetTweenType(ui::Tween::EASE_IN_OUT);
+ settings.SetTweenType(gfx::Tween::EASE_IN_OUT);
layer->SetOpacity(1.0f);
// A bit of a dirty trick: we need to catch the end of the animation we don't
@@ -246,7 +246,7 @@ void StartGrayscaleBrightnessAnimationForWindow(
aura::Window* window,
float target,
base::TimeDelta duration,
- ui::Tween::Type tween_type,
+ gfx::Tween::Type tween_type,
ui::LayerAnimationObserver* observer) {
ui::LayerAnimator* animator = window->layer()->GetAnimator();
@@ -604,11 +604,11 @@ void SessionStateAnimator::RunAnimationForWindow(
break;
case ANIMATION_GRAYSCALE_BRIGHTNESS:
StartGrayscaleBrightnessAnimationForWindow(
- window, 1.0, duration, ui::Tween::EASE_IN, observer);
+ window, 1.0, duration, gfx::Tween::EASE_IN, observer);
break;
case ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS:
StartGrayscaleBrightnessAnimationForWindow(
- window, 0.0, duration, ui::Tween::EASE_IN_OUT, observer);
+ window, 0.0, duration, gfx::Tween::EASE_IN_OUT, observer);
break;
}
}
diff --git a/ash/wm/stacking_controller.cc b/ash/wm/stacking_controller.cc
index 51e13b3c16..d846c78c90 100644
--- a/ash/wm/stacking_controller.cc
+++ b/ash/wm/stacking_controller.cc
@@ -25,7 +25,7 @@ namespace {
// return the active root window.
aura::RootWindow* FindContainerRoot(const gfx::Rect& bounds) {
if (bounds.x() == 0 && bounds.y() == 0 && bounds.IsEmpty())
- return Shell::GetActiveRootWindow();
+ return Shell::GetTargetRootWindow();
return wm::GetRootWindowMatching(bounds);
}
diff --git a/ash/wm/sticky_keys.cc b/ash/wm/sticky_keys.cc
index 55c5c9b887..74a86994df 100644
--- a/ash/wm/sticky_keys.cc
+++ b/ash/wm/sticky_keys.cc
@@ -10,8 +10,8 @@
#include "base/basictypes.h"
#include "base/debug/stack_trace.h"
#include "ui/aura/root_window.h"
-#include "ui/base/events/event.h"
-#include "ui/base/keycodes/keyboard_code_conversion.h"
+#include "ui/events/event.h"
+#include "ui/events/keycodes/keyboard_code_conversion.h"
namespace ash {
diff --git a/ash/wm/sticky_keys.h b/ash/wm/sticky_keys.h
index 8a4bc68054..7a75a435fb 100644
--- a/ash/wm/sticky_keys.h
+++ b/ash/wm/sticky_keys.h
@@ -7,7 +7,7 @@
#include "ash/ash_export.h"
#include "base/memory/scoped_ptr.h"
-#include "ui/base/events/event_constants.h"
+#include "ui/events/event_constants.h"
namespace ui {
class KeyEvent;
diff --git a/ash/wm/system_gesture_event_filter.cc b/ash/wm/system_gesture_event_filter.cc
index 4371bd0a34..98e5abffa8 100644
--- a/ash/wm/system_gesture_event_filter.cc
+++ b/ash/wm/system_gesture_event_filter.cc
@@ -17,8 +17,8 @@
#include "ash/wm/window_util.h"
#include "base/command_line.h"
#include "ui/aura/root_window.h"
-#include "ui/base/events/event.h"
#include "ui/base/ui_base_switches.h"
+#include "ui/events/event.h"
#if defined(OS_CHROMEOS)
#include "ui/base/touch/touch_factory_x11.h"
diff --git a/ash/wm/system_gesture_event_filter.h b/ash/wm/system_gesture_event_filter.h
index a2a5c738db..aa85688041 100644
--- a/ash/wm/system_gesture_event_filter.h
+++ b/ash/wm/system_gesture_event_filter.h
@@ -9,9 +9,7 @@
#include "ash/touch/touch_uma.h"
#include "base/timer/timer.h"
#include "ui/aura/window_observer.h"
-#include "ui/base/animation/animation_delegate.h"
-#include "ui/base/animation/linear_animation.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_handler.h"
#include "ui/gfx/point.h"
#include <map>
diff --git a/ash/wm/system_gesture_event_filter_unittest.cc b/ash/wm/system_gesture_event_filter_unittest.cc
index b54364ea05..c7305a0b53 100644
--- a/ash/wm/system_gesture_event_filter_unittest.cc
+++ b/ash/wm/system_gesture_event_filter_unittest.cc
@@ -25,11 +25,11 @@
#include "ui/aura/root_window.h"
#include "ui/aura/test/event_generator.h"
#include "ui/aura/test/test_windows.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_utils.h"
#include "ui/base/gestures/gesture_configuration.h"
#include "ui/base/hit_test.h"
#include "ui/base/ui_base_switches.h"
+#include "ui/events/event.h"
+#include "ui/events/event_utils.h"
#include "ui/gfx/screen.h"
#include "ui/gfx/size.h"
#include "ui/views/widget/widget_delegate.h"
diff --git a/ash/wm/system_modal_container_event_filter.cc b/ash/wm/system_modal_container_event_filter.cc
index 532bb44acd..4412a9c2d4 100644
--- a/ash/wm/system_modal_container_event_filter.cc
+++ b/ash/wm/system_modal_container_event_filter.cc
@@ -6,7 +6,7 @@
#include "ash/wm/system_modal_container_event_filter_delegate.h"
#include "ui/aura/window.h"
-#include "ui/base/events/event.h"
+#include "ui/events/event.h"
namespace ash {
namespace internal {
diff --git a/ash/wm/system_modal_container_event_filter.h b/ash/wm/system_modal_container_event_filter.h
index 64d522da4f..e1f2e8ea42 100644
--- a/ash/wm/system_modal_container_event_filter.h
+++ b/ash/wm/system_modal_container_event_filter.h
@@ -8,7 +8,7 @@
#include "ash/ash_export.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_handler.h"
namespace ash {
namespace internal {
diff --git a/ash/wm/system_modal_container_layout_manager.cc b/ash/wm/system_modal_container_layout_manager.cc
index 453002689e..99889d2f59 100644
--- a/ash/wm/system_modal_container_layout_manager.cc
+++ b/ash/wm/system_modal_container_layout_manager.cc
@@ -15,11 +15,11 @@
#include "ui/aura/client/capture_client.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
-#include "ui/base/events/event.h"
#include "ui/base/ui_base_switches_util.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animator.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/events/event.h"
#include "ui/gfx/screen.h"
#include "ui/views/corewm/compound_event_filter.h"
#include "ui/views/view.h"
diff --git a/ash/wm/system_modal_container_layout_manager_unittest.cc b/ash/wm/system_modal_container_layout_manager_unittest.cc
index 52643f499b..0a113290dc 100644
--- a/ash/wm/system_modal_container_layout_manager_unittest.cc
+++ b/ash/wm/system_modal_container_layout_manager_unittest.cc
@@ -250,17 +250,9 @@ TEST_F(SystemModalContainerLayoutManagerTest, ModalNonTransient) {
EXPECT_TRUE(do2.destroyed());
}
-// Fails on Mac only. Needs to be implemented. http://crbug.com/111279.
-#if defined(OS_MACOSX)
-#define MAYBE_CanActivateAfterEndModalSession \
- DISABLED_CanActivateAfterEndModalSession
-#else
-#define MAYBE_CanActivateAfterEndModalSession CanActivateAfterEndModalSession
-#endif
// Tests that we can activate an unrelated window after a modal window is closed
// for a window.
-TEST_F(SystemModalContainerLayoutManagerTest,
- MAYBE_CanActivateAfterEndModalSession) {
+TEST_F(SystemModalContainerLayoutManagerTest, CanActivateAfterEndModalSession) {
scoped_ptr<aura::Window> unrelated(OpenToplevelTestWindow(false));
unrelated->SetBounds(gfx::Rect(100, 100, 50, 50));
scoped_ptr<aura::Window> parent(OpenToplevelTestWindow(false));
diff --git a/ash/wm/toplevel_window_event_handler.cc b/ash/wm/toplevel_window_event_handler.cc
index 8f30b0ed65..d58087d923 100644
--- a/ash/wm/toplevel_window_event_handler.cc
+++ b/ash/wm/toplevel_window_event_handler.cc
@@ -21,13 +21,13 @@
#include "ui/aura/window_delegate.h"
#include "ui/aura/window_observer.h"
#include "ui/base/cursor/cursor.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_utils.h"
#include "ui/base/gestures/gesture_recognizer.h"
#include "ui/base/hit_test.h"
#include "ui/base/ui_base_types.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/events/event.h"
+#include "ui/events/event_utils.h"
#include "ui/gfx/screen.h"
namespace {
@@ -353,13 +353,11 @@ aura::client::WindowMoveResult ToplevelWindowEventHandler::RunMoveLoop(
CreateScopedWindowResizer(source, drag_location, HTCAPTION, move_source);
bool destroyed = false;
destroyed_ = &destroyed;
-#if !defined(OS_MACOSX)
base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
base::MessageLoop::ScopedNestableTaskAllower allow_nested(loop);
base::RunLoop run_loop(aura::Env::GetInstance()->GetDispatcher());
quit_closure_ = run_loop.QuitClosure();
run_loop.Run();
-#endif // !defined(OS_MACOSX)
if (destroyed)
return aura::client::MOVE_CANCELED;
destroyed_ = NULL;
diff --git a/ash/wm/toplevel_window_event_handler.h b/ash/wm/toplevel_window_event_handler.h
index 89ad46aa56..98c9296c94 100644
--- a/ash/wm/toplevel_window_event_handler.h
+++ b/ash/wm/toplevel_window_event_handler.h
@@ -13,7 +13,7 @@
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "ui/aura/client/window_move_client.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_handler.h"
#include "ui/gfx/point.h"
#include "ui/gfx/rect.h"
diff --git a/ash/wm/toplevel_window_event_handler_unittest.cc b/ash/wm/toplevel_window_event_handler_unittest.cc
index c84f8b3f12..ab6012ecfc 100644
--- a/ash/wm/toplevel_window_event_handler_unittest.cc
+++ b/ash/wm/toplevel_window_event_handler_unittest.cc
@@ -25,8 +25,8 @@
#include "ui/aura/test/event_generator.h"
#include "ui/aura/test/test_activation_client.h"
#include "ui/aura/test/test_window_delegate.h"
-#include "ui/base/events/event.h"
#include "ui/base/hit_test.h"
+#include "ui/events/event.h"
#include "ui/gfx/screen.h"
#if defined(OS_WIN)
@@ -616,7 +616,7 @@ TEST_F(ToplevelWindowEventHandlerTest, GestureDragMultipleWindows) {
// Verifies pressing escape resets the bounds to the original bounds.
// Disabled crbug.com/166219.
-#if defined(OS_MACOSX) || defined(OS_WIN)
+#if defined(OS_WIN)
#define MAYBE_EscapeReverts DISABLED_EscapeReverts
#else
#define MAYBE_EscapeReverts EscapeReverts
diff --git a/ash/wm/user_activity_detector.cc b/ash/wm/user_activity_detector.cc
index 269b9efe86..21503f366e 100644
--- a/ash/wm/user_activity_detector.cc
+++ b/ash/wm/user_activity_detector.cc
@@ -6,7 +6,7 @@
#include "ash/wm/property_util.h"
#include "ash/wm/user_activity_observer.h"
-#include "ui/base/events/event.h"
+#include "ui/events/event.h"
namespace ash {
diff --git a/ash/wm/user_activity_detector.h b/ash/wm/user_activity_detector.h
index ca01ec1c92..1140c3d919 100644
--- a/ash/wm/user_activity_detector.h
+++ b/ash/wm/user_activity_detector.h
@@ -10,7 +10,7 @@
#include "base/compiler_specific.h"
#include "base/observer_list.h"
#include "base/time/time.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event_handler.h"
namespace ash {
diff --git a/ash/wm/user_activity_detector_unittest.cc b/ash/wm/user_activity_detector_unittest.cc
index 271d764870..89f6aee910 100644
--- a/ash/wm/user_activity_detector_unittest.cc
+++ b/ash/wm/user_activity_detector_unittest.cc
@@ -12,9 +12,9 @@
#include "base/time/time.h"
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_constants.h"
-#include "ui/base/keycodes/keyboard_codes.h"
+#include "ui/events/event.h"
+#include "ui/events/event_constants.h"
+#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/gfx/point.h"
namespace {
diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc
index 73deafd75c..ffbe00789a 100644
--- a/ash/wm/window_animations.cc
+++ b/ash/wm/window_animations.cc
@@ -60,7 +60,7 @@ const float kWindowAnimation_ShowOpacity = 1.f;
const float kWindowAnimation_MinimizeRotate = 0.f;
// Tween type when cross fading a workspace window.
-const ui::Tween::Type kCrossFadeTweenType = ui::Tween::EASE_IN_OUT;
+const gfx::Tween::Type kCrossFadeTweenType = gfx::Tween::EASE_IN_OUT;
// Scales for AshWindow above/below current workspace.
const float kLayerScaleAboveSize = 1.1f;
@@ -116,7 +116,7 @@ void AddLayerAnimationsForMinimize(aura::Window* window, bool show) {
rotation_about_pivot.release(), duration));
transition->set_tween_type(
- show ? ui::Tween::EASE_IN : ui::Tween::EASE_IN_OUT);
+ show ? gfx::Tween::EASE_IN : gfx::Tween::EASE_IN_OUT);
window->layer()->GetAnimator()->ScheduleAnimation(
new ui::LayerAnimationSequence(transition.release()));
@@ -318,7 +318,7 @@ class CrossFadeObserver : public ui::CompositorObserver,
// animating. Returns the duration of the fade.
base::TimeDelta CrossFadeImpl(aura::Window* window,
ui::Layer* old_layer,
- ui::Tween::Type tween_type) {
+ gfx::Tween::Type tween_type) {
const gfx::Rect old_bounds(old_layer->bounds());
const gfx::Rect new_bounds(window->bounds());
const bool old_on_top = (old_bounds.width() > new_bounds.width());
@@ -413,7 +413,7 @@ void CrossFadeToBounds(aura::Window* window, const gfx::Rect& new_bounds) {
else
old_layer->parent()->StackAbove(new_layer, old_layer);
- CrossFadeImpl(window, old_layer, ui::Tween::EASE_OUT);
+ CrossFadeImpl(window, old_layer, gfx::Tween::EASE_OUT);
}
void CrossFadeWindowBetweenWorkspaces(aura::Window* new_workspace,
@@ -473,7 +473,7 @@ bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, bool visible) {
std::vector<ui::LayerAnimationSequence*>
CreateBrightnessGrayscaleAnimationSequence(float target_value,
base::TimeDelta duration) {
- ui::Tween::Type animation_type = ui::Tween::EASE_OUT;
+ gfx::Tween::Type animation_type = gfx::Tween::EASE_OUT;
scoped_ptr<ui::LayerAnimationSequence> brightness_sequence(
new ui::LayerAnimationSequence());
scoped_ptr<ui::LayerAnimationSequence> grayscale_sequence(
diff --git a/ash/wm/window_animations_unittest.cc b/ash/wm/window_animations_unittest.cc
index d5680cc5bc..c2ea1f6365 100644
--- a/ash/wm/window_animations_unittest.cc
+++ b/ash/wm/window_animations_unittest.cc
@@ -10,10 +10,10 @@
#include "base/time/time.h"
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h"
-#include "ui/base/animation/animation_container_element.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animator.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
+#include "ui/gfx/animation/animation_container_element.h"
using aura::Window;
using ui::Layer;
@@ -57,8 +57,8 @@ TEST_F(WindowAnimationsTest, HideShowBrightnessGrayscaleAnimation) {
EXPECT_TRUE(window->layer()->visible());
// Stays shown.
- ui::AnimationContainerElement* element =
- static_cast<ui::AnimationContainerElement*>(
+ gfx::AnimationContainerElement* element =
+ static_cast<gfx::AnimationContainerElement*>(
window->layer()->GetAnimator());
element->Step(base::TimeTicks::Now() +
base::TimeDelta::FromSeconds(5));
@@ -106,9 +106,9 @@ TEST_F(WindowAnimationsTest, CrossFadeToBounds) {
EXPECT_EQ(gfx::Transform(), window->layer()->GetTargetTransform());
// Run the animations to completion.
- static_cast<ui::AnimationContainerElement*>(old_layer->GetAnimator())->Step(
+ static_cast<gfx::AnimationContainerElement*>(old_layer->GetAnimator())->Step(
base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1));
- static_cast<ui::AnimationContainerElement*>(window->layer()->GetAnimator())->
+ static_cast<gfx::AnimationContainerElement*>(window->layer()->GetAnimator())->
Step(base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1));
// Cross fade to a smaller size, as in a restore animation.
@@ -127,9 +127,9 @@ TEST_F(WindowAnimationsTest, CrossFadeToBounds) {
EXPECT_EQ(1.0f, window->layer()->GetTargetOpacity());
EXPECT_EQ(gfx::Transform(), window->layer()->GetTargetTransform());
- static_cast<ui::AnimationContainerElement*>(old_layer->GetAnimator())->Step(
+ static_cast<gfx::AnimationContainerElement*>(old_layer->GetAnimator())->Step(
base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1));
- static_cast<ui::AnimationContainerElement*>(window->layer()->GetAnimator())->
+ static_cast<gfx::AnimationContainerElement*>(window->layer()->GetAnimator())->
Step(base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1));
}
diff --git a/ash/wm/window_cycle_controller.cc b/ash/wm/window_cycle_controller.cc
index 413d0da958..703080ff37 100644
--- a/ash/wm/window_cycle_controller.cc
+++ b/ash/wm/window_cycle_controller.cc
@@ -14,8 +14,8 @@
#include "ash/wm/window_util.h"
#include "ash/wm/workspace_controller.h"
#include "ui/aura/root_window.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_handler.h"
+#include "ui/events/event.h"
+#include "ui/events/event_handler.h"
namespace ash {
diff --git a/ash/wm/window_cycle_controller_unittest.cc b/ash/wm/window_cycle_controller_unittest.cc
index 8e74543425..7cb4bbc11e 100644
--- a/ash/wm/window_cycle_controller_unittest.cc
+++ b/ash/wm/window_cycle_controller_unittest.cc
@@ -328,7 +328,7 @@ TEST_F(WindowCycleControllerTest, AlwaysOnTopMultipleRootWindows) {
WindowCycleController* controller =
Shell::GetInstance()->window_cycle_controller();
- Shell::GetInstance()->set_active_root_window(root_windows[0]);
+ Shell::GetInstance()->set_target_root_window(root_windows[0]);
// Create two windows in the primary root.
scoped_ptr<Window> window0(CreateTestWindowInShellWithId(0));
@@ -341,7 +341,7 @@ TEST_F(WindowCycleControllerTest, AlwaysOnTopMultipleRootWindows) {
EXPECT_EQ(root_windows[0], window1->GetRootWindow());
// And two on the secondary root.
- Shell::GetInstance()->set_active_root_window(root_windows[1]);
+ Shell::GetInstance()->set_target_root_window(root_windows[1]);
scoped_ptr<Window> window2(CreateTestWindowInShellWithId(2));
EXPECT_EQ(root_windows[1], window2->GetRootWindow());
@@ -353,7 +353,7 @@ TEST_F(WindowCycleControllerTest, AlwaysOnTopMultipleRootWindows) {
EXPECT_EQ(root_windows[1], window3->GetRootWindow());
// Move the active root window to the secondary.
- Shell::GetInstance()->set_active_root_window(root_windows[1]);
+ Shell::GetInstance()->set_target_root_window(root_windows[1]);
wm::ActivateWindow(window2.get());
diff --git a/ash/wm/window_manager_unittest.cc b/ash/wm/window_manager_unittest.cc
index 9351cc76b3..75307ae393 100644
--- a/ash/wm/window_manager_unittest.cc
+++ b/ash/wm/window_manager_unittest.cc
@@ -20,9 +20,9 @@
#include "ui/aura/test/test_window_delegate.h"
#include "ui/aura/test/test_windows.h"
#include "ui/base/cursor/cursor.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_utils.h"
#include "ui/base/hit_test.h"
+#include "ui/events/event.h"
+#include "ui/events/event_utils.h"
#include "ui/gfx/screen.h"
#include "ui/views/corewm/compound_event_filter.h"
#include "ui/views/corewm/corewm_switches.h"
@@ -570,7 +570,7 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
}
}
-#if defined(OS_MACOSX) || defined(OS_WIN)
+#if defined(OS_WIN)
#define MAYBE_TransformActivate DISABLED_TransformActivate
#else
#define MAYBE_TransformActivate TransformActivate
@@ -596,7 +596,7 @@ TEST_F(WindowManagerTest, MAYBE_TransformActivate) {
w1->Show();
gfx::Point miss_point(5, 5);
- transform.TransformPoint(miss_point);
+ transform.TransformPoint(&miss_point);
ui::MouseEvent mouseev1(ui::ET_MOUSE_PRESSED,
miss_point,
miss_point,
@@ -610,7 +610,7 @@ TEST_F(WindowManagerTest, MAYBE_TransformActivate) {
root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouseup);
gfx::Point hit_point(5, 15);
- transform.TransformPoint(hit_point);
+ transform.TransformPoint(&hit_point);
ui::MouseEvent mouseev2(ui::ET_MOUSE_PRESSED,
hit_point,
hit_point,
diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc
index 3f0f23422c..19028b848d 100644
--- a/ash/wm/window_util.cc
+++ b/ash/wm/window_util.cc
@@ -77,6 +77,8 @@ bool CanResizeWindow(const aura::Window* window) {
bool CanSnapWindow(aura::Window* window) {
if (!CanResizeWindow(window))
return false;
+ if (window->type() == aura::client::WINDOW_TYPE_PANEL)
+ return false;
// If a window has a maximum size defined, snapping may make it too big.
return window->delegate() ? window->delegate()->GetMaximumSize().IsEmpty() :
true;
diff --git a/ash/wm/workspace/auto_window_management.cc b/ash/wm/workspace/auto_window_management.cc
index 97cf2e8f16..fac0def4b2 100644
--- a/ash/wm/workspace/auto_window_management.cc
+++ b/ash/wm/workspace/auto_window_management.cc
@@ -5,6 +5,7 @@
#include "ash/wm/workspace/auto_window_management.h"
#include "ash/ash_switches.h"
+#include "ash/screen_ash.h"
#include "ash/shell.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/property_util.h"
@@ -45,33 +46,35 @@ bool WindowPositionCanBeManaged(const aura::Window* window) {
!settings->bounds_changed_by_user();
}
-// Get the work area for a given |window|.
-gfx::Rect GetWorkAreaForWindow(aura::Window* window) {
+// Get the work area for a given |window| in parent coordinates.
+gfx::Rect GetWorkAreaForWindowInParent(aura::Window* window) {
#if defined(OS_WIN)
// On Win 8, the host window can't be resized, so
// use window's bounds instead.
// TODO(oshima): Emulate host window resize on win8.
gfx::Rect work_area = gfx::Rect(window->parent()->bounds().size());
work_area.Inset(Shell::GetScreen()->GetDisplayMatching(
- work_area).GetWorkAreaInsets());
+ window->parent()->GetBoundsInScreen()).GetWorkAreaInsets());
return work_area;
#else
- return Shell::GetScreen()->GetDisplayNearestWindow(window).work_area();
+ return ScreenAsh::GetDisplayWorkAreaBoundsInParent(window);
#endif
}
-// Move the given |bounds| on the available |parent_width| to the
-// direction. If |move_right| is true, the rectangle gets moved to the right
-// corner, otherwise to the left one.
-bool MoveRectToOneSide(int parent_width, bool move_right, gfx::Rect* bounds) {
+// Move the given |bounds| on the available |work_area| in the direction
+// indicated by |move_right|. If |move_right| is true, the rectangle gets moved
+// to the right edge, otherwise to the left one.
+bool MoveRectToOneSide(const gfx::Rect& work_area,
+ bool move_right,
+ gfx::Rect* bounds) {
if (move_right) {
- if (parent_width > bounds->right()) {
- bounds->set_x(parent_width - bounds->width());
+ if (work_area.right() > bounds->right()) {
+ bounds->set_x(work_area.right() - bounds->width());
return true;
}
} else {
- if (0 < bounds->x()) {
- bounds->set_x(0);
+ if (work_area.x() < bounds->x()) {
+ bounds->set_x(work_area.x());
return true;
}
}
@@ -98,7 +101,7 @@ void SetBoundsAnimated(aura::Window* window, const gfx::Rect& bounds) {
// Move |window| into the center of the screen - or restore it to the previous
// position.
void AutoPlaceSingleWindow(aura::Window* window, bool animated) {
- gfx::Rect work_area = GetWorkAreaForWindow(window);
+ gfx::Rect work_area = GetWorkAreaForWindowInParent(window);
gfx::Rect bounds = window->bounds();
const gfx::Rect* user_defined_area =
ash::wm::GetPreAutoManageWindowBounds(window);
@@ -107,7 +110,7 @@ void AutoPlaceSingleWindow(aura::Window* window, bool animated) {
ash::wm::AdjustBoundsToEnsureMinimumWindowVisibility(work_area, &bounds);
} else {
// Center the window (only in x).
- bounds.set_x((work_area.width() - bounds.width()) / 2);
+ bounds.set_x(work_area.x() + (work_area.width() - bounds.width()) / 2);
}
if (animated)
@@ -204,9 +207,9 @@ void RearrangeVisibleWindowOnShow(aura::Window* added_window) {
}
gfx::Rect other_bounds = other_shown_window->bounds();
- gfx::Rect work_area = GetWorkAreaForWindow(added_window);
+ gfx::Rect work_area = GetWorkAreaForWindowInParent(added_window);
bool move_other_right =
- other_bounds.CenterPoint().x() > work_area.width() / 2;
+ other_bounds.CenterPoint().x() > work_area.x() + work_area.width() / 2;
// Push the other window to the size only if there are two windows left.
if (single_window) {
@@ -223,7 +226,7 @@ void RearrangeVisibleWindowOnShow(aura::Window* added_window) {
ash::wm::SetPreAutoManageWindowBounds(other_shown_window, other_bounds);
// Push away the other window after remembering its current position.
- if (MoveRectToOneSide(work_area.width(), move_other_right, &other_bounds))
+ if (MoveRectToOneSide(work_area, move_other_right, &other_bounds))
SetBoundsAnimated(other_shown_window, other_bounds);
}
}
@@ -234,7 +237,7 @@ void RearrangeVisibleWindowOnShow(aura::Window* added_window) {
gfx::Rect added_bounds = added_window->bounds();
if (!ash::wm::GetPreAutoManageWindowBounds(added_window))
ash::wm::SetPreAutoManageWindowBounds(added_window, added_bounds);
- if (MoveRectToOneSide(work_area.width(), !move_other_right, &added_bounds))
+ if (MoveRectToOneSide(work_area, !move_other_right, &added_bounds))
added_window->SetBounds(added_bounds);
}
diff --git a/ash/wm/workspace/desktop_background_fade_controller.cc b/ash/wm/workspace/desktop_background_fade_controller.cc
index 563d07bfe3..abbdf578c8 100644
--- a/ash/wm/workspace/desktop_background_fade_controller.cc
+++ b/ash/wm/workspace/desktop_background_fade_controller.cc
@@ -20,15 +20,15 @@ DesktopBackgroundFadeController::DesktopBackgroundFadeController(
base::TimeDelta duration,
Direction direction) {
SkColor start_color, target_color;
- ui::Tween::Type tween_type;
+ gfx::Tween::Type tween_type;
if (direction == FADE_OUT) {
start_color = SkColorSetARGB(0, 0, 0, 0);
target_color = SK_ColorBLACK;
- tween_type = ui::Tween::EASE_IN_OUT;
+ tween_type = gfx::Tween::EASE_IN_OUT;
} else {
start_color = SK_ColorBLACK;
target_color = SkColorSetARGB(0, 0, 0, 0);
- tween_type = ui::Tween::EASE_IN_OUT;
+ tween_type = gfx::Tween::EASE_IN_OUT;
}
window_controller_.reset(
diff --git a/ash/wm/workspace/multi_window_resize_controller.cc b/ash/wm/workspace/multi_window_resize_controller.cc
index c447b9ced8..597acbf88e 100644
--- a/ash/wm/workspace/multi_window_resize_controller.cc
+++ b/ash/wm/workspace/multi_window_resize_controller.cc
@@ -387,7 +387,7 @@ void MultiWindowResizeController::ShowNow() {
params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.parent = Shell::GetContainer(
- Shell::GetActiveRootWindow(),
+ Shell::GetTargetRootWindow(),
internal::kShellWindowId_AlwaysOnTopContainer);
params.can_activate = false;
ResizeView* view = new ResizeView(this, windows_.direction);
diff --git a/ash/wm/workspace/phantom_window_controller.cc b/ash/wm/workspace/phantom_window_controller.cc
index 67272c18a3..cd2865ede5 100644
--- a/ash/wm/workspace/phantom_window_controller.cc
+++ b/ash/wm/workspace/phantom_window_controller.cc
@@ -10,9 +10,9 @@
#include "third_party/skia/include/core/SkCanvas.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
-#include "ui/base/animation/slide_animation.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/gfx/animation/slide_animation.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/skia_util.h"
#include "ui/views/painter.h"
@@ -142,8 +142,8 @@ void PhantomWindowController::Show(const gfx::Rect& bounds_in_screen) {
if (!phantom_widget_start_ && start_root != target_root)
phantom_widget_start_ = CreatePhantomWidget(start_root, start_bounds_);
- animation_.reset(new ui::SlideAnimation(this));
- animation_->SetTweenType(ui::Tween::EASE_IN);
+ animation_.reset(new gfx::SlideAnimation(this));
+ animation_->SetTweenType(gfx::Tween::EASE_IN);
const int kAnimationDurationMS = 200;
animation_->SetSlideDuration(kAnimationDurationMS);
animation_->Show();
@@ -163,7 +163,7 @@ bool PhantomWindowController::IsShowing() const {
}
void PhantomWindowController::AnimationProgressed(
- const ui::Animation* animation) {
+ const gfx::Animation* animation) {
const gfx::Rect current_bounds =
animation->CurrentValueBetween(start_bounds_, bounds_in_screen_);
if (phantom_widget_start_)
diff --git a/ash/wm/workspace/phantom_window_controller.h b/ash/wm/workspace/phantom_window_controller.h
index 5cd40daa2c..4a9279256b 100644
--- a/ash/wm/workspace/phantom_window_controller.h
+++ b/ash/wm/workspace/phantom_window_controller.h
@@ -9,7 +9,7 @@
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
-#include "ui/base/animation/animation_delegate.h"
+#include "ui/gfx/animation/animation_delegate.h"
#include "ui/gfx/rect.h"
namespace aura {
@@ -17,7 +17,7 @@ class RootWindow;
class Window;
}
-namespace ui {
+namespace gfx {
class SlideAnimation;
}
@@ -30,7 +30,7 @@ namespace internal {
// PhantomWindowController is responsible for showing a phantom representation
// of a window. It's used used during dragging a window to show a snap location.
-class ASH_EXPORT PhantomWindowController : public ui::AnimationDelegate {
+class ASH_EXPORT PhantomWindowController : public gfx::AnimationDelegate {
public:
explicit PhantomWindowController(aura::Window* window);
virtual ~PhantomWindowController();
@@ -57,8 +57,8 @@ class ASH_EXPORT PhantomWindowController : public ui::AnimationDelegate {
phantom_below_window_ = phantom_below_window;
}
- // ui::AnimationDelegate overrides:
- virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
+ // gfx::AnimationDelegate overrides:
+ virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
private:
FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, PhantomWindowShow);
@@ -93,7 +93,7 @@ class ASH_EXPORT PhantomWindowController : public ui::AnimationDelegate {
views::Widget* phantom_widget_start_;
// Used to transition the bounds.
- scoped_ptr<ui::SlideAnimation> animation_;
+ scoped_ptr<gfx::SlideAnimation> animation_;
DISALLOW_COPY_AND_ASSIGN(PhantomWindowController);
};
diff --git a/ash/wm/workspace/snap_sizer.cc b/ash/wm/workspace/snap_sizer.cc
index 8447fd2b42..877f101084 100644
--- a/ash/wm/workspace/snap_sizer.cc
+++ b/ash/wm/workspace/snap_sizer.cc
@@ -78,11 +78,11 @@ int GetDefaultWidth(aura::Window* window) {
return std::max(width, GetMinWidth(window));
}
-// Create the list of possible widths for the current screen configuration:
-// Fill the |usable_width_| list with items from |kIdealWidth| which fit on
-// the screen and supplement it with the 'half of screen' size. Furthermore,
-// add an entry for 90% of the screen size if it is smaller than the biggest
-// value in the |kIdealWidth| list (to get a step between the values).
+// Creates the list of possible width for the current screen configuration:
+// Returns a list with items from |kIdealWidth| which fit on the screen and
+// supplement it with the 'half of screen' size. Furthermore, add an entry for
+// 90% of the screen size if it is smaller than the biggest value in the
+// |kIdealWidth| list (to get a step between the values).
std::vector<int> BuildIdealWidthList(aura::Window* window) {
if (ash::switches::UseAlternateFrameCaptionButtonStyle()) {
// Only the 'half of screen' width is supported when using the alternate
@@ -123,6 +123,25 @@ std::vector<int> BuildIdealWidthList(aura::Window* window) {
return ideal_width_list;
}
+// Changes |window|'s bounds to |snap_bounds| while preserving the restore
+// bounds.
+void SnapWindowToBounds(aura::Window* window, const gfx::Rect& snap_bounds) {
+ if (wm::IsWindowMaximized(window) || wm::IsWindowFullscreen(window)) {
+ // Before we can set the bounds we need to restore the window.
+ // Restoring the window will set the window to its restored bounds.
+ // To avoid an unnecessary bounds changes (which may have side effects)
+ // we set the restore bounds to the bounds we want, restore the window,
+ // then reset the restore bounds. This way no unnecessary bounds
+ // changes occurs and the original restore bounds is remembered.
+ gfx::Rect restore_bounds_in_screen = *GetRestoreBoundsInScreen(window);
+ SetRestoreBoundsInParent(window, snap_bounds);
+ wm::RestoreWindow(window);
+ SetRestoreBoundsInScreen(window, restore_bounds_in_screen);
+ } else {
+ window->SetBounds(snap_bounds);
+ }
+}
+
} // namespace
SnapSizer::SnapSizer(aura::Window* window,
@@ -133,6 +152,7 @@ SnapSizer::SnapSizer(aura::Window* window,
edge_(edge),
time_last_update_(base::TimeTicks::Now()),
size_index_(0),
+ end_of_sequence_(false),
resize_disabled_(false),
num_moves_since_adjust_(0),
last_adjust_x_(start.x()),
@@ -152,20 +172,11 @@ void SnapSizer::SnapWindow(aura::Window* window, SnapSizer::Edge edge) {
return;
internal::SnapSizer sizer(window, gfx::Point(), edge,
internal::SnapSizer::OTHER_INPUT);
- if (wm::IsWindowFullscreen(window) || wm::IsWindowMaximized(window)) {
- // Before we can set the bounds we need to restore the window.
- // Restoring the window will set the window to its restored bounds.
- // To avoid an unnecessary bounds changes (which may have side effects)
- // we set the restore bounds to the bounds we want, restore the window,
- // then reset the restore bounds. This way no unnecessary bounds
- // changes occurs and the original restore bounds is remembered.
- gfx::Rect restore = *GetRestoreBoundsInScreen(window);
- SetRestoreBoundsInParent(window, sizer.GetSnapBounds(window->bounds()));
- wm::RestoreWindow(window);
- SetRestoreBoundsInScreen(window, restore);
- } else {
- window->SetBounds(sizer.GetSnapBounds(window->bounds()));
- }
+ SnapWindowToBounds(window, sizer.GetSnapBounds(window->bounds()));
+}
+
+void SnapSizer::SnapWindowToTargetBounds() {
+ SnapWindowToBounds(window_, target_bounds());
}
void SnapSizer::Update(const gfx::Point& location) {
@@ -218,6 +229,7 @@ gfx::Rect SnapSizer::GetSnapBounds(const gfx::Rect& bounds) {
void SnapSizer::SelectDefaultSizeAndDisableResize() {
resize_disabled_ = true;
size_index_ = 0;
+ end_of_sequence_ = false;
target_bounds_ = GetTargetBounds();
}
@@ -260,6 +272,8 @@ int SnapSizer::CalculateIncrement(int x, int reference_x) const {
}
void SnapSizer::ChangeBounds(int x, int delta) {
+ end_of_sequence_ =
+ delta > 0 && size_index_ == static_cast<int>(usable_width_.size()) - 1;
int index = std::min(static_cast<int>(usable_width_.size()) - 1,
std::max(size_index_ + delta, 0));
if (index != size_index_) {
@@ -275,7 +289,7 @@ gfx::Rect SnapSizer::GetTargetBounds() const {
}
bool SnapSizer::AlongEdge(int x) const {
- gfx::Rect area(ScreenAsh::GetDisplayBoundsInParent(window_));
+ gfx::Rect area(ScreenAsh::GetDisplayWorkAreaBoundsInParent(window_));
return (x <= area.x()) || (x >= area.right() - 1);
}
diff --git a/ash/wm/workspace/snap_sizer.h b/ash/wm/workspace/snap_sizer.h
index bd5f719ae4..b241ef8404 100644
--- a/ash/wm/workspace/snap_sizer.h
+++ b/ash/wm/workspace/snap_sizer.h
@@ -46,6 +46,9 @@ class ASH_EXPORT SnapSizer {
// Snaps a window left or right.
static void SnapWindow(aura::Window* window, Edge edge);
+ // Snaps |window_| to the target bounds.
+ void SnapWindowToTargetBounds();
+
// Updates the target bounds based on a mouse move.
void Update(const gfx::Point& location);
@@ -63,6 +66,9 @@ class ASH_EXPORT SnapSizer {
// For unit test purposes this function is not private.
gfx::Rect GetTargetBoundsForSize(size_t size_index) const;
+ // Returns true when snapping sequence is at its last (docking) step.
+ bool end_of_sequence() const { return end_of_sequence_; }
+
private:
// Calculates the amount to increment by. This returns one of -1, 0 or 1 and
// is intended to by applied to |size_index_|. |x| is the current
@@ -96,6 +102,10 @@ class ASH_EXPORT SnapSizer {
// bounds should get.
int size_index_;
+ // Set to true when an attempt is made to increment |size_index_| past
+ // the size of |usable_width_|.
+ bool end_of_sequence_;
+
// If set, |size_index_| will get ignored and the single button default
// setting will be used instead.
bool resize_disabled_;
diff --git a/ash/wm/workspace/snap_sizer_unittest.cc b/ash/wm/workspace/snap_sizer_unittest.cc
index 8802242b80..ea27519a92 100644
--- a/ash/wm/workspace/snap_sizer_unittest.cc
+++ b/ash/wm/workspace/snap_sizer_unittest.cc
@@ -8,6 +8,8 @@
#include "ash/screen_ash.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
+#include "ash/wm/property_util.h"
+#include "ash/wm/window_settings.h"
#include "ash/wm/window_util.h"
#include "base/command_line.h"
#include "ui/aura/root_window.h"
@@ -169,14 +171,16 @@ TEST_F(SnapSizerTest, Default) {
// should snap to 1024.
UpdateDisplay("0+0-1280x800");
sizer.SelectDefaultSizeAndDisableResize();
- EXPECT_EQ(1024, sizer.target_bounds().width());
+ sizer.SnapWindowToTargetBounds();
+ EXPECT_EQ(1024, window->bounds().width());
// We should snap to a width of 50% of the work area it is the largest width
// the window can snap to.
UpdateDisplay("0+0-2560x1080");
work_area = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area();
sizer.SelectDefaultSizeAndDisableResize();
- EXPECT_EQ(work_area.width() / 2, sizer.target_bounds().width());
+ sizer.SnapWindowToTargetBounds();
+ EXPECT_EQ(work_area.width() / 2, window->bounds().width());
}
// Test that the window only snaps to 50% of the work area width when using the
@@ -219,9 +223,70 @@ TEST_F(SnapSizerTest, AlternateFrameCaptionButtonStyle) {
SnapSizer sizer(window.get(), gfx::Point(), SnapSizer::RIGHT_EDGE,
SnapSizer::OTHER_INPUT);
sizer.SelectDefaultSizeAndDisableResize();
- EXPECT_EQ(expected.ToString(),
- ScreenAsh::ConvertRectToScreen(window->parent(),
- sizer.target_bounds()).ToString());
+ sizer.SnapWindowToTargetBounds();
+ EXPECT_EQ(expected.ToString(), window->GetBoundsInScreen().ToString());
+}
+
+// Test that snapping left/right preserves the restore bounds.
+TEST_F(SnapSizerTest, RestoreBounds) {
+ scoped_ptr<aura::Window> window(
+ CreateTestWindowInShellWithBounds(gfx::Rect(100, 100, 100, 100)));
+ EXPECT_TRUE(wm::IsWindowNormal(window.get()));
+
+ // 1) Start with restored window with restore bounds set.
+ gfx::Rect restore_bounds = window->GetBoundsInScreen();
+ restore_bounds.set_width(restore_bounds.width() + 1);
+ SetRestoreBoundsInScreen(window.get(), restore_bounds);
+ SnapSizer::SnapWindow(window.get(), SnapSizer::LEFT_EDGE);
+ SnapSizer::SnapWindow(window.get(), SnapSizer::RIGHT_EDGE);
+ EXPECT_NE(restore_bounds.ToString(), window->GetBoundsInScreen().ToString());
+ EXPECT_EQ(restore_bounds.ToString(),
+ GetRestoreBoundsInScreen(window.get())->ToString());
+ wm::RestoreWindow(window.get());
+ EXPECT_EQ(restore_bounds.ToString(), window->GetBoundsInScreen().ToString());
+
+ // 2) Start with restored bounds set as a result of maximizing the window.
+ wm::MaximizeWindow(window.get());
+ gfx::Rect maximized_bounds = window->GetBoundsInScreen();
+ EXPECT_NE(maximized_bounds.ToString(), restore_bounds.ToString());
+ EXPECT_EQ(restore_bounds.ToString(),
+ GetRestoreBoundsInScreen(window.get())->ToString());
+
+ SnapSizer::SnapWindow(window.get(), SnapSizer::LEFT_EDGE);
+ EXPECT_NE(restore_bounds.ToString(), window->GetBoundsInScreen().ToString());
+ EXPECT_NE(maximized_bounds.ToString(),
+ window->GetBoundsInScreen().ToString());
+ EXPECT_EQ(restore_bounds.ToString(),
+ GetRestoreBoundsInScreen(window.get())->ToString());
+
+ wm::RestoreWindow(window.get());
+ EXPECT_EQ(restore_bounds.ToString(), window->GetBoundsInScreen().ToString());
+}
+
+// Test that maximizing an auto managed window, then snapping it puts the window
+// at the snapped bounds and not at the auto-managed (centered) bounds.
+TEST_F(SnapSizerTest, AutoManaged) {
+ scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0));
+ wm::GetWindowSettings(window.get())->set_window_position_managed(true);
+ window->Hide();
+ window->SetBounds(gfx::Rect(100, 100, 100, 100));
+ window->Show();
+
+ wm::MaximizeWindow(window.get());
+ SnapSizer::SnapWindow(window.get(), SnapSizer::RIGHT_EDGE);
+
+ const gfx::Rect kWorkAreaBounds =
+ ash::Shell::GetScreen()->GetPrimaryDisplay().work_area();
+ gfx::Rect expected_snapped_bounds(
+ kWorkAreaBounds.right() - window->bounds().width(),
+ kWorkAreaBounds.y(),
+ window->bounds().width(), // No expectation for the width.
+ kWorkAreaBounds.height());
+ EXPECT_EQ(expected_snapped_bounds.ToString(),
+ window->GetBoundsInScreen().ToString());
+
+ // The window should still be auto managed despite being right maximized.
+ EXPECT_TRUE(wm::GetWindowSettings(window.get())->window_position_managed());
}
} // namespace ash
diff --git a/ash/wm/workspace/workspace_event_handler.cc b/ash/wm/workspace/workspace_event_handler.cc
index b46d3deff8..870a925c03 100644
--- a/ash/wm/workspace/workspace_event_handler.cc
+++ b/ash/wm/workspace/workspace_event_handler.cc
@@ -15,10 +15,10 @@
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
-#include "ui/base/events/event.h"
-#include "ui/base/events/event_utils.h"
#include "ui/base/hit_test.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/events/event.h"
+#include "ui/events/event_utils.h"
#include "ui/gfx/screen.h"
namespace ash {
diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc
index 258fd86821..d1219ad235 100644
--- a/ash/wm/workspace/workspace_layout_manager.cc
+++ b/ash/wm/workspace/workspace_layout_manager.cc
@@ -21,8 +21,8 @@
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
-#include "ui/base/events/event.h"
#include "ui/base/ui_base_types.h"
+#include "ui/events/event.h"
#include "ui/views/corewm/window_util.h"
using aura::Window;
@@ -178,7 +178,7 @@ void WorkspaceLayoutManager::OnWindowPropertyChanged(Window* window,
SetRestoreBoundsInScreen(window, window->GetBoundsInScreen());
}
- UpdateBoundsFromShowState(window);
+ UpdateBoundsFromShowState(window, old_state);
ShowStateChanged(window, old_state);
// Set the restore rectangle to the previously set restore rectangle.
@@ -280,7 +280,9 @@ void WorkspaceLayoutManager::UpdateDesktopVisibility() {
FramePainter::UpdateSoloWindowHeader(window_->GetRootWindow());
}
-void WorkspaceLayoutManager::UpdateBoundsFromShowState(Window* window) {
+void WorkspaceLayoutManager::UpdateBoundsFromShowState(
+ Window* window,
+ ui::WindowShowState last_show_state) {
// See comment in SetMaximizedOrFullscreenBounds() as to why we use parent in
// these calculation.
switch (window->GetProperty(aura::client::kShowStateKey)) {
@@ -308,30 +310,42 @@ void WorkspaceLayoutManager::UpdateBoundsFromShowState(Window* window) {
bounds_in_parent.SetRect(0, 0, 0, 0);
}
if (!bounds_in_parent.IsEmpty()) {
- CrossFadeToBounds(
- window,
- BaseLayoutManager::BoundsWithScreenEdgeVisible(
- window->parent()->parent(),
- bounds_in_parent));
+ gfx::Rect new_bounds = BaseLayoutManager::BoundsWithScreenEdgeVisible(
+ window->parent()->parent(),
+ bounds_in_parent);
+ if (last_show_state == ui::SHOW_STATE_MINIMIZED)
+ SetChildBoundsDirect(window, new_bounds);
+ else
+ CrossFadeToBounds(window, new_bounds);
}
ClearRestoreBounds(window);
break;
}
- case ui::SHOW_STATE_MAXIMIZED:
+ case ui::SHOW_STATE_MAXIMIZED: {
MoveToDisplayForRestore(window);
- CrossFadeToBounds(window, ScreenAsh::GetMaximizedWindowBoundsInParent(
- window->parent()->parent()));
+ gfx::Rect new_bounds = ScreenAsh::GetMaximizedWindowBoundsInParent(
+ window->parent()->parent());
+ // If the window is restored from minimized state, do not make the cross
+ // fade animation and set the child bounds directly. The restoring
+ // animation will be done by ash/wm/window_animations.cc.
+ if (last_show_state == ui::SHOW_STATE_MINIMIZED)
+ SetChildBoundsDirect(window, new_bounds);
+ else
+ CrossFadeToBounds(window, new_bounds);
break;
+ }
case ui::SHOW_STATE_FULLSCREEN: {
MoveToDisplayForRestore(window);
gfx::Rect new_bounds = ScreenAsh::GetDisplayBoundsInParent(
window->parent()->parent());
- if (window->GetProperty(kAnimateToFullscreenKey))
+ if (window->GetProperty(kAnimateToFullscreenKey) &&
+ last_show_state != ui::SHOW_STATE_MINIMIZED) {
CrossFadeToBounds(window, new_bounds);
- else
+ } else {
SetChildBoundsDirect(window, new_bounds);
+ }
break;
}
diff --git a/ash/wm/workspace/workspace_layout_manager.h b/ash/wm/workspace/workspace_layout_manager.h
index b0d5fa9177..a9241a6300 100644
--- a/ash/wm/workspace/workspace_layout_manager.h
+++ b/ash/wm/workspace/workspace_layout_manager.h
@@ -74,8 +74,10 @@ class ASH_EXPORT WorkspaceLayoutManager : public BaseLayoutManager {
void UpdateDesktopVisibility();
- // Updates the bounds of the window from a show state change.
- void UpdateBoundsFromShowState(aura::Window* window);
+ // Updates the bounds of the window for a show state change from
+ // |last_show_state|.
+ void UpdateBoundsFromShowState(aura::Window* window,
+ ui::WindowShowState last_show_state);
// If |window| is maximized or fullscreen the bounds of the window are set and
// true is returned. Does nothing otherwise.
diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc
index f68e64d2bf..999224958a 100644
--- a/ash/wm/workspace/workspace_window_resizer.cc
+++ b/ash/wm/workspace/workspace_window_resizer.cc
@@ -10,12 +10,14 @@
#include <vector>
#include "ash/ash_switches.h"
+#include "ash/display/display_controller.h"
#include "ash/root_window_controller.h"
#include "ash/screen_ash.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/coordinate_conversion.h"
#include "ash/wm/default_window_resizer.h"
+#include "ash/wm/dock/docked_window_layout_manager.h"
#include "ash/wm/dock/docked_window_resizer.h"
#include "ash/wm/drag_window_resizer.h"
#include "ash/wm/panels/panel_window_resizer.h"
@@ -25,6 +27,7 @@
#include "ash/wm/workspace/phantom_window_controller.h"
#include "ash/wm/workspace/snap_sizer.h"
#include "base/command_line.h"
+#include "base/memory/weak_ptr.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/client/window_types.h"
@@ -386,20 +389,38 @@ void WorkspaceWindowResizer::Drag(const gfx::Point& location_in_parent,
gfx::Point location_in_screen = location_in_parent;
wm::ConvertPointToScreen(window()->parent(), &location_in_screen);
- const bool in_original_root =
- wm::GetRootWindowAt(location_in_screen) == window()->GetRootWindow();
+
+ aura::RootWindow* root = NULL;
+ gfx::Display display =
+ ScreenAsh::FindDisplayContainingPoint(location_in_screen);
+ // Track the last screen that the pointer was on to keep the snap phantom
+ // window there.
+ if (display.is_valid()) {
+ root = Shell::GetInstance()->display_controller()->
+ GetRootWindowForDisplayId(display.id());
+ }
+ if (!attached_windows_.empty())
+ LayoutAttachedWindows(&bounds);
+ if (bounds != window()->bounds()) {
+ // SetBounds needs to be called to update the layout which affects where the
+ // phantom window is drawn. Keep track if the window was destroyed during
+ // the drag and quit early if so.
+ base::WeakPtr<WorkspaceWindowResizer> resizer(
+ weak_ptr_factory_.GetWeakPtr());
+ window()->SetBounds(bounds);
+ if (!resizer)
+ return;
+ }
+ const bool in_original_root = !root || root == window()->GetRootWindow();
// Hide a phantom window for snapping if the cursor is in another root window.
- if (in_original_root && wm::CanResizeWindow(window())) {
+ if (in_original_root) {
UpdateSnapPhantomWindow(location_in_parent, bounds);
} else {
snap_type_ = SNAP_NONE;
snap_phantom_window_controller_.reset();
+ snap_sizer_.reset();
+ UpdateDockedState(false);
}
-
- if (!attached_windows_.empty())
- LayoutAttachedWindows(&bounds);
- if (bounds != window()->bounds())
- window()->SetBounds(bounds);
}
void WorkspaceWindowResizer::CompleteDrag(int event_flags) {
@@ -416,7 +437,7 @@ void WorkspaceWindowResizer::CompleteDrag(int event_flags) {
if (wm::IsWindowNormal(window()) &&
(window()->type() != aura::client::WINDOW_TYPE_PANEL ||
!wm::GetWindowSettings(window())->panel_attached()) &&
- (snap_type_ == SNAP_LEFT_EDGE || snap_type_ == SNAP_RIGHT_EDGE)) {
+ (snap_type_ == SNAP_LEFT || snap_type_ == SNAP_RIGHT)) {
if (!GetRestoreBoundsInScreen(window())) {
gfx::Rect initial_bounds = ScreenAsh::ConvertRectToScreen(
window()->parent(), details_.initial_bounds_in_parent);
@@ -424,8 +445,11 @@ void WorkspaceWindowResizer::CompleteDrag(int event_flags) {
initial_bounds :
details_.restore_bounds);
}
- window()->SetBounds(snap_sizer_->target_bounds());
- return;
+ DCHECK(snap_sizer_);
+ if (wm::CanResizeWindow(window()) &&
+ !dock_layout_->is_dragged_window_docked()) {
+ snap_sizer_->SnapWindowToTargetBounds();
+ }
}
}
@@ -478,12 +502,18 @@ WorkspaceWindowResizer::WorkspaceWindowResizer(
total_initial_size_(0),
snap_type_(SNAP_NONE),
num_mouse_moves_since_bounds_change_(0),
- magnetism_window_(NULL) {
+ magnetism_window_(NULL),
+ weak_ptr_factory_(this) {
DCHECK(details_.is_resizable);
Shell* shell = Shell::GetInstance();
shell->cursor_manager()->LockCursor();
+ aura::Window* dock_container = Shell::GetContainer(
+ window()->GetRootWindow(), kShellWindowId_DockedContainer);
+ dock_layout_ = static_cast<DockedWindowLayoutManager*>(
+ dock_container->layout_manager());
+
// Only support attaching to the right/bottom.
DCHECK(attached_windows_.empty() ||
(details.window_component == HTRIGHT ||
@@ -858,25 +888,19 @@ void WorkspaceWindowResizer::UpdateSnapPhantomWindow(const gfx::Point& location,
if (!did_move_or_resize_ || details_.window_component != HTCAPTION)
return;
- if (!wm::CanSnapWindow(window()))
- return;
-
- if (window()->type() == aura::client::WINDOW_TYPE_PANEL &&
- wm::GetWindowSettings(window())->panel_attached()) {
- return;
- }
-
SnapType last_type = snap_type_;
snap_type_ = GetSnapType(location);
if (snap_type_ == SNAP_NONE || snap_type_ != last_type) {
snap_phantom_window_controller_.reset();
snap_sizer_.reset();
+ UpdateDockedState(false);
if (snap_type_ == SNAP_NONE)
return;
}
+ SnapSizer::Edge edge = (snap_type_ == SNAP_LEFT) ?
+ SnapSizer::LEFT_EDGE : SnapSizer::RIGHT_EDGE;
+
if (!snap_sizer_) {
- SnapSizer::Edge edge = (snap_type_ == SNAP_LEFT_EDGE) ?
- SnapSizer::LEFT_EDGE : SnapSizer::RIGHT_EDGE;
snap_sizer_.reset(new SnapSizer(window(),
location,
edge,
@@ -884,12 +908,37 @@ void WorkspaceWindowResizer::UpdateSnapPhantomWindow(const gfx::Point& location,
} else {
snap_sizer_->Update(location);
}
+
+ const bool can_dock = dock_layout_->CanDockWindow(window(), snap_type_);
+ if (!wm::CanSnapWindow(window()) && !can_dock)
+ return;
+
+ // Update phantom window with snapped or docked guide bounds.
+ // Windows that cannot be snapped or are less wide than kMaxDockWidth can get
+ // docked without going through a snapping sequence.
+ gfx::Rect phantom_bounds;
+ if (!can_dock ||
+ window()->bounds().width() > DockedWindowLayoutManager::kMaxDockWidth)
+ phantom_bounds = snap_sizer_->target_bounds();
+ const bool is_docked = can_dock &&
+ (phantom_bounds.IsEmpty() || snap_sizer_->end_of_sequence());
+ UpdateDockedState(is_docked);
+ if (is_docked) {
+ phantom_bounds = ScreenAsh::ConvertRectFromScreen(
+ window()->parent(), dock_layout_->dragged_bounds());
+ }
+
+ if (phantom_bounds.IsEmpty()) {
+ snap_phantom_window_controller_.reset();
+ return;
+ }
+
if (!snap_phantom_window_controller_) {
snap_phantom_window_controller_.reset(
new PhantomWindowController(window()));
}
snap_phantom_window_controller_->Show(ScreenAsh::ConvertRectToScreen(
- window()->parent(), snap_sizer_->target_bounds()));
+ window()->parent(), phantom_bounds));
}
void WorkspaceWindowResizer::RestackWindows() {
@@ -923,17 +972,28 @@ void WorkspaceWindowResizer::RestackWindows() {
}
}
-WorkspaceWindowResizer::SnapType WorkspaceWindowResizer::GetSnapType(
+SnapType WorkspaceWindowResizer::GetSnapType(
const gfx::Point& location) const {
// TODO: this likely only wants total display area, not the area of a single
// display.
- gfx::Rect area(ScreenAsh::GetDisplayBoundsInParent(window()));
+ gfx::Rect area(ScreenAsh::GetDisplayWorkAreaBoundsInParent(window()));
if (location.x() <= area.x())
- return SNAP_LEFT_EDGE;
+ return SNAP_LEFT;
if (location.x() >= area.right() - 1)
- return SNAP_RIGHT_EDGE;
+ return SNAP_RIGHT;
return SNAP_NONE;
}
+void WorkspaceWindowResizer::UpdateDockedState(bool is_docked) {
+ if (is_docked &&
+ dock_layout_->GetAlignmentOfWindow(window()) != DOCKED_ALIGNMENT_NONE) {
+ if (!dock_layout_->is_dragged_window_docked())
+ dock_layout_->DockDraggedWindow(window());
+ } else {
+ if (dock_layout_->is_dragged_window_docked())
+ dock_layout_->UndockDraggedWindow();
+ }
+}
+
} // namespace internal
} // namespace ash
diff --git a/ash/wm/workspace/workspace_window_resizer.h b/ash/wm/workspace/workspace_window_resizer.h
index 76176b1a2b..d678e12b5f 100644
--- a/ash/wm/workspace/workspace_window_resizer.h
+++ b/ash/wm/workspace/workspace_window_resizer.h
@@ -9,14 +9,17 @@
#include "ash/wm/window_resizer.h"
#include "ash/wm/workspace/magnetism_matcher.h"
+#include "ash/wm/workspace/snap_types.h"
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "ui/aura/window_tracker.h"
namespace ash {
namespace internal {
+class DockedWindowLayoutManager;
class PhantomWindowController;
class SnapSizer;
class WindowSize;
@@ -71,16 +74,6 @@ class ASH_EXPORT WorkspaceWindowResizer : public WindowResizer {
FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, PhantomSnapMaxSize);
FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, PhantomWindowShow);
- // Type of snapping.
- enum SnapType {
- // Snap to the left/right edge of the screen.
- SNAP_LEFT_EDGE,
- SNAP_RIGHT_EDGE,
-
- // No snap position.
- SNAP_NONE
- };
-
// Returns the final bounds to place the window at. This differs from
// the current when snapping.
gfx::Rect GetFinalBounds(const gfx::Rect& bounds) const;
@@ -164,6 +157,10 @@ class ASH_EXPORT WorkspaceWindowResizer : public WindowResizer {
// snapping should be used.
SnapType GetSnapType(const gfx::Point& location) const;
+ // Dock when a window is at its last step in snapping sequence, undock
+ // otherwise.
+ void UpdateDockedState(bool is_docked);
+
aura::Window* window() const { return details_.window; }
const Details details_;
@@ -211,6 +208,13 @@ class ASH_EXPORT WorkspaceWindowResizer : public WindowResizer {
// should attach.
MatchedEdge magnetism_edge_;
+ // Dock container window layout manager.
+ DockedWindowLayoutManager* dock_layout_;
+
+ // Used to determine if this has been deleted during a drag such as when a tab
+ // gets dragged into another browser window.
+ base::WeakPtrFactory<WorkspaceWindowResizer> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer);
};
diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc
index ecbce9b0b2..5f096d070c 100644
--- a/ash/wm/workspace/workspace_window_resizer_unittest.cc
+++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc
@@ -31,9 +31,10 @@
#include "ui/gfx/screen.h"
#include "ui/views/widget/widget.h"
-namespace ui {
+namespace gfx {
// Class to provide access to SlideAnimation internals for testing.
+// TODO: this should be next to SlideAnimation, not here.
class SlideAnimation::TestApi {
public:
explicit TestApi(SlideAnimation* animation) : animation_(animation) {}
@@ -202,8 +203,8 @@ class WorkspaceWindowResizerTest : public test::AshTestBase {
}
// Simulate running the animation.
- void RunAnimationTillComplete(ui::SlideAnimation* animation) {
- ui::SlideAnimation::TestApi test_api(animation);
+ void RunAnimationTillComplete(gfx::SlideAnimation* animation) {
+ gfx::SlideAnimation::TestApi test_api(animation);
test_api.RunTillComplete();
}
@@ -1843,14 +1844,14 @@ TEST_F(WorkspaceWindowResizerTest, PhantomWindowShow) {
EXPECT_EQ(root_windows[0], window_->GetRootWindow());
scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
- window_.get(), gfx::Point(), HTCAPTION,
+ window_.get(), gfx::Point(0,0), HTCAPTION,
aura::client::WINDOW_MOVE_SOURCE_MOUSE, empty_windows()));
ASSERT_TRUE(resizer.get());
EXPECT_FALSE(resizer->snap_phantom_window_controller_.get());
// The pointer is on the edge but not shared. The snap phantom window
// controller should be non-NULL.
- resizer->Drag(CalculateDragPoint(*resizer, 499, 0), 0);
+ resizer->Drag(CalculateDragPoint(*resizer, -1, 0), 0);
EXPECT_TRUE(resizer->snap_phantom_window_controller_.get());
PhantomWindowController* phantom_controller(
resizer->snap_phantom_window_controller_.get());
diff --git a/ash/wm/workspace_controller.cc b/ash/wm/workspace_controller.cc
index 64e69e2942..8e63d3412c 100644
--- a/ash/wm/workspace_controller.cc
+++ b/ash/wm/workspace_controller.cc
@@ -116,7 +116,7 @@ void WorkspaceController::DoInitialAnimation() {
ui::LayerAnimationElement::VISIBILITY,
-1);
- settings.SetTweenType(ui::Tween::EASE_OUT);
+ settings.SetTweenType(gfx::Tween::EASE_OUT);
settings.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS));
viewport_->layer()->SetTransform(gfx::Transform());
diff --git a/ash/wm/workspace_controller_unittest.cc b/ash/wm/workspace_controller_unittest.cc
index 39b1906673..92a4739b2f 100644
--- a/ash/wm/workspace_controller_unittest.cc
+++ b/ash/wm/workspace_controller_unittest.cc
@@ -809,7 +809,7 @@ TEST_F(WorkspaceControllerTest, BasicAutoPlacingOnShowHide) {
window3->Hide();
window3->SetBounds(gfx::Rect(32, 48, 256, 512));
window3->Show();
- // |window1| should be flush right and |window3| flush left.
+ // |window1| should be flush left and |window3| flush right.
EXPECT_EQ("0,32 640x320", window1->bounds().ToString());
EXPECT_EQ(base::IntToString(
desktop_area.width() - window3->bounds().width()) +