diff options
author | Torne (Richard Coles) <torne@google.com> | 2013-05-13 16:52:09 +0100 |
---|---|---|
committer | Torne (Richard Coles) <torne@google.com> | 2013-05-13 16:52:09 +0100 |
commit | b2df76ea8fec9e32f6f3718986dba0d95315b29c (patch) | |
tree | 0182623e854b794f7307829abf4be16435a0193a /ash | |
parent | 121d6d4bf5931d9b1dbc0b9a262f6c609440f6c7 (diff) | |
download | chromium_org-b2df76ea8fec9e32f6f3718986dba0d95315b29c.tar.gz |
Merge from Chromium at DEPS revision r199464
This commit was generated by merge_to_master.py.
Change-Id: Ic3d1f97a4fb4edd1e6ed66a70b5040da1622b5a9
Diffstat (limited to 'ash')
87 files changed, 571 insertions, 383 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index f7a9ecba67..2c6ca356f5 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -111,7 +111,7 @@ bool HandleAccessibleFocusCycle(bool reverse) { if (!focus_manager) return false; views::View* view = focus_manager->GetFocusedView(); - if (view->GetClassName() == views::WebView::kViewClassName) + if (!strcmp(view->GetClassName(), views::WebView::kViewClassName)) return false; focus_manager->AdvanceFocus(reverse); @@ -700,18 +700,14 @@ bool AcceleratorController::PerformAction(int action, break; case SHOW_SYSTEM_TRAY_BUBBLE: { internal::RootWindowController* controller = - Shell::IsLauncherPerDisplayEnabled() ? - internal::RootWindowController::ForActiveRootWindow() : - Shell::GetPrimaryRootWindowController(); + internal::RootWindowController::ForActiveRootWindow(); if (!controller->GetSystemTray()->HasSystemBubble()) controller->GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW); break; } case SHOW_MESSAGE_CENTER_BUBBLE: { internal::RootWindowController* controller = - Shell::IsLauncherPerDisplayEnabled() ? - internal::RootWindowController::ForActiveRootWindow() : - Shell::GetPrimaryRootWindowController(); + internal::RootWindowController::ForActiveRootWindow(); internal::StatusAreaWidget* status_area_widget = controller->shelf()->status_area_widget(); if (status_area_widget) { diff --git a/ash/ash.gyp b/ash/ash.gyp index 533ff26780..14ab3670e5 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -171,6 +171,7 @@ 'shelf/background_animator.h', 'shelf/shelf_layout_manager.cc', 'shelf/shelf_layout_manager.h', + 'shelf/shelf_layout_manager_observer.h', 'shelf/shelf_types.h', 'shelf/shelf_widget.cc', 'shelf/shelf_widget.h', diff --git a/ash/ash_root_window_transformer_unittest.cc b/ash/ash_root_window_transformer_unittest.cc index 88b97ad413..5bca069972 100644 --- a/ash/ash_root_window_transformer_unittest.cc +++ b/ash/ash_root_window_transformer_unittest.cc @@ -203,7 +203,7 @@ TEST_F(AshRootWindowTransformerTest, MAYBE_RotateAndMagnify) { ScreenAsh::GetSecondaryDisplay().bounds().ToString()); generator2.MoveMouseToInHost(172, 219); EXPECT_EQ("95,80", event_handler.GetLocationAndReset()); - EXPECT_EQ("169,175", + EXPECT_EQ("145,200", aura::Env::GetInstance()->last_mouse_location().ToString()); EXPECT_EQ(gfx::Display::ROTATE_90, GetStoredRotation(display1.id())); EXPECT_EQ(gfx::Display::ROTATE_270, GetStoredRotation(display2_id)); diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd index ff576ed32c..b4b7177d37 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd @@ -377,6 +377,9 @@ Press Shift + Alt to switch. to open a webpage (article on help center) containing explanation about accessibility feature."> Learn more... </message> + <message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SETTINGS" desc="The label of the item 'Settings...' used in the accessibility menu of the system tray to open an accessibility setting page."> + Settings... + </message> <message name="IDS_ASH_STATUS_TRAY_BATTERY_FULL" desc="The label in the tray dialog to indicate that the battery is full."> Battery full </message> diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc index 516fa60649..72cfd9dd94 100644 --- a/ash/ash_switches.cc +++ b/ash/ash_switches.cc @@ -48,9 +48,6 @@ const char kAshDisableBootAnimation2[] = "ash-disable-boot-animation2"; const char kAshDisableDisplayChangeLimiter[] = "ash-disable-display-change-limiter"; -// Disables creating a launcher per display. -const char kAshDisableLauncherPerDisplay[] = "ash-disable-launcher-per-display"; - // Disable the new cras audio handler. const char kAshDisableNewAudioHandler[] = "ash-disable-new-audio-handler"; @@ -141,11 +138,15 @@ const char kAuraLegacyPowerButton[] = "aura-legacy-power-button"; // Force Ash to open its root window on the desktop, even on Windows 8 where // it would normally end up in metro. const char kForceAshToDesktop[] = "ash-force-desktop"; + #endif +// Allow items to be dragged from the app launcher list into the launcher. +const char kAshDragAndDropAppListToLauncher[] = + "ash-drag-and-drop-applist-to-launcher"; + // Enables a mode which enforces all browser & application windows to be created // in maximized mode. const char kForcedMaximizeMode[] = "forced-maximize-mode"; - } // namespace switches } // namespace ash diff --git a/ash/ash_switches.h b/ash/ash_switches.h index 003cd35e5f..c195c3e0aa 100644 --- a/ash/ash_switches.h +++ b/ash/ash_switches.h @@ -28,13 +28,13 @@ ASH_EXPORT extern const char kAshDisableAutoWindowPlacement[]; ASH_EXPORT extern const char kAshDisableBootAnimation2[]; ASH_EXPORT extern const char kAshDisableDisplayChangeLimiter[]; ASH_EXPORT extern const char kAshDisableImmersiveFullscreen[]; -ASH_EXPORT extern const char kAshDisableLauncherPerDisplay[]; ASH_EXPORT extern const char kAshDisableNewAudioHandler[]; ASH_EXPORT extern const char kAshDisableNewLockAnimations[]; ASH_EXPORT extern const char kAshDisableNewNetworkStatusArea[]; ASH_EXPORT extern const char kAshDisablePerAppLauncher[]; ASH_EXPORT extern const char kAshDisableUIScaling[]; ASH_EXPORT extern const char kAshDisableDisplayRotation[]; +ASH_EXPORT extern const char kAshDragAndDropAppListToLauncher[]; ASH_EXPORT extern const char kAshEnableAudioDeviceMenu[]; ASH_EXPORT extern const char kAshEnableAdvancedGestures[]; ASH_EXPORT extern const char kAshEnableBrightnessControl[]; diff --git a/ash/display/display_controller_unittest.cc b/ash/display/display_controller_unittest.cc index 8ac928db3a..57d6c4642c 100644 --- a/ash/display/display_controller_unittest.cc +++ b/ash/display/display_controller_unittest.cc @@ -279,15 +279,11 @@ TEST_F(DisplayControllerTest, BoundsUpdated) { EXPECT_EQ(1, observer.CountAndReset()); // two resizes EXPECT_EQ("0,0 400x400", GetPrimaryDisplay().bounds().ToString()); EXPECT_EQ("0,400 200x200", GetSecondaryDisplay().bounds().ToString()); - if (!ash::Shell::IsLauncherPerDisplayEnabled()) - EXPECT_EQ("5,405 190x190", GetSecondaryDisplay().work_area().ToString()); UpdateDisplay("400x400,300x300"); EXPECT_EQ(1, observer.CountAndReset()); EXPECT_EQ("0,0 400x400", GetPrimaryDisplay().bounds().ToString()); EXPECT_EQ("0,400 300x300", GetSecondaryDisplay().bounds().ToString()); - if (!ash::Shell::IsLauncherPerDisplayEnabled()) - EXPECT_EQ("5,405 290x290", GetSecondaryDisplay().work_area().ToString()); UpdateDisplay("400x400"); EXPECT_EQ(1, observer.CountAndReset()); @@ -412,10 +408,7 @@ TEST_F(DisplayControllerTest, MAYBE_SwapPrimary) { EXPECT_EQ("0,0 200x200", primary_display.bounds().ToString()); EXPECT_EQ("0,0 200x152", primary_display.work_area().ToString()); EXPECT_EQ("200,0 300x300", secondary_display.bounds().ToString()); - if (ash::Shell::IsLauncherPerDisplayEnabled()) - EXPECT_EQ("200,0 300x252", secondary_display.work_area().ToString()); - else - EXPECT_EQ("200,0 300x300", secondary_display.work_area().ToString()); + EXPECT_EQ("200,0 300x252", secondary_display.work_area().ToString()); EXPECT_EQ("right, 50", display_controller->GetCurrentDisplayLayout().ToString()); @@ -450,10 +443,7 @@ TEST_F(DisplayControllerTest, MAYBE_SwapPrimary) { EXPECT_EQ("0,0 300x252", swapped_primary.work_area().ToString()); EXPECT_EQ("-200,-50 200x200", swapped_secondary.bounds().ToString()); - if (ash::Shell::IsLauncherPerDisplayEnabled()) - EXPECT_EQ("-200,-50 200x152", swapped_secondary.work_area().ToString()); - else - EXPECT_EQ("-200,-50 200x200", swapped_secondary.work_area().ToString()); + EXPECT_EQ("-200,-50 200x152", swapped_secondary.work_area().ToString()); aura::WindowTracker tracker; tracker.Add(primary_root); @@ -601,7 +591,15 @@ TEST_F(DisplayControllerTest, MAYBE_SwapPrimaryById) { EXPECT_TRUE(primary_root->Contains(launcher_window)); } -TEST_F(DisplayControllerTest, CursorDeviceScaleFactorSwapPrimary) { +#if defined(OS_WIN) +// Flaky failures on Win8 due to window activation messages. crbug.com/239539 +#define MAYBE_CursorDeviceScaleFactorSwapPrimary \ + DISABLED_CursorDeviceScaleFactorSwapPrimary +#else +#define MAYBE_CursorDeviceScaleFactorSwapPrimary \ + CursorDeviceScaleFactorSwapPrimary +#endif +TEST_F(DisplayControllerTest, MAYBE_CursorDeviceScaleFactorSwapPrimary) { DisplayController* display_controller = Shell::GetInstance()->display_controller(); diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc index 6fe5debaed..cfe6458013 100644 --- a/ash/display/display_manager_unittest.cc +++ b/ash/display/display_manager_unittest.cc @@ -592,7 +592,15 @@ TEST_F(DisplayManagerTest, EnsurePointerInDisplays) { EXPECT_EQ("150,140", env->last_mouse_location().ToString()); } -TEST_F(DisplayManagerTest, EnsurePointerInDisplays_2ndOnLeft) { +#if defined(OS_WIN) +// Flaky failures on Win8 due to window activation messages. crbug.com/239539 +#define MAYBE_EnsurePointerInDisplays_2ndOnLeft \ + DISABLED_EnsurePointerInDisplays_2ndOnLeft +#else +#define MAYBE_EnsurePointerInDisplays_2ndOnLeft \ + EnsurePointerInDisplays_2ndOnLeft +#endif +TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays_2ndOnLeft) { // Set the 2nd display on the left. DisplayController* display_controller = Shell::GetInstance()->display_controller(); diff --git a/ash/focus_cycler_unittest.cc b/ash/focus_cycler_unittest.cc index 5854f8ddcd..aebede49b0 100644 --- a/ash/focus_cycler_unittest.cc +++ b/ash/focus_cycler_unittest.cc @@ -46,8 +46,9 @@ class PanedWidgetDelegate : public views::WidgetDelegate { } // views::WidgetDelegate. - virtual void GetAccessiblePanes(std::vector<views::View*>* panes) { - std::copy(accessible_panes_.begin(), accessible_panes_.end(), + virtual void GetAccessiblePanes(std::vector<views::View*>* panes) OVERRIDE { + std::copy(accessible_panes_.begin(), + accessible_panes_.end(), std::back_inserter(*panes)); } virtual views::Widget* GetWidget() OVERRIDE { diff --git a/ash/launcher/launcher_button.cc b/ash/launcher/launcher_button.cc index 78fc815784..1acee585e2 100644 --- a/ash/launcher/launcher_button.cc +++ b/ash/launcher/launcher_button.cc @@ -300,7 +300,7 @@ void LauncherButton::AddState(State state) { base::TimeDelta::FromMilliseconds(kHopUpMS)); } state_ |= state; - UpdateState(); + Layout(); if (state & STATE_ATTENTION) bar_->ShowAttention(true); } @@ -316,7 +316,7 @@ void LauncherButton::ClearState(State state) { base::TimeDelta::FromMilliseconds(kHopDownMS)); } state_ &= ~state; - UpdateState(); + Layout(); if (state & STATE_ATTENTION) bar_->ShowAttention(false); } diff --git a/ash/launcher/launcher_button_host.h b/ash/launcher/launcher_button_host.h index ecb76a3220..c867a68cd6 100644 --- a/ash/launcher/launcher_button_host.h +++ b/ash/launcher/launcher_button_host.h @@ -25,6 +25,7 @@ class ASH_EXPORT LauncherButtonHost { public: enum Pointer { NONE, + DRAG_AND_DROP, MOUSE, TOUCH, }; diff --git a/ash/launcher/launcher_delegate.h b/ash/launcher/launcher_delegate.h index 45109e86fd..0bd8ec6629 100644 --- a/ash/launcher/launcher_delegate.h +++ b/ash/launcher/launcher_delegate.h @@ -106,6 +106,18 @@ class ASH_EXPORT LauncherDelegate { // True if the running launcher is the per application launcher. virtual bool IsPerAppLauncher() = 0; + + // Get the launcher ID from an application ID. + virtual LauncherID GetLauncherIDForAppID(const std::string& app_id) = 0; + + // Pins an app with |app_id| to launcher. A running instance will get pinned. + // In case there is no running instance a new launcher item is created and + // pinned. + virtual void PinAppWithID(const std::string& app_id) = 0; + + // Unpins any app item(s) whose id is |app_id|. The new launcher will collect + // all items under one item, the old launcher might have multiple items. + virtual void UnpinAppsWithID(const std::string& app_id) = 0; }; } // namespace ash diff --git a/ash/launcher/launcher_tooltip_manager.h b/ash/launcher/launcher_tooltip_manager.h index a880713cc7..b4cd20b804 100644 --- a/ash/launcher/launcher_tooltip_manager.h +++ b/ash/launcher/launcher_tooltip_manager.h @@ -6,7 +6,7 @@ #define ASH_LAUNCHER_LAUNCHER_TOOLTIP_MANAGER_H_ #include "ash/ash_export.h" -#include "ash/shelf/shelf_layout_manager.h" +#include "ash/shelf/shelf_layout_manager_observer.h" #include "ash/shelf/shelf_types.h" #include "base/basictypes.h" #include "base/string16.h" @@ -32,11 +32,12 @@ class LauncherViewTest; namespace internal { class LauncherView; +class ShelfLayoutManager; // LauncherTooltipManager manages the tooltip balloon poping up on launcher // items. class ASH_EXPORT LauncherTooltipManager : public ui::EventHandler, - public ShelfLayoutManager::Observer { + public ShelfLayoutManagerObserver { public: LauncherTooltipManager(ShelfLayoutManager* shelf_layout_manager, LauncherView* launcher_view); @@ -79,7 +80,7 @@ protected: virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; virtual void OnCancelMode(ui::CancelModeEvent* event) OVERRIDE; - // ShelfLayoutManager::Observer overrides: + // ShelfLayoutManagerObserver overrides: virtual void WillDeleteShelf() OVERRIDE; virtual void WillChangeVisibilityState( ShelfVisibilityState new_state) OVERRIDE; diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc index 32e20ec1f9..e7eb39cae4 100644 --- a/ash/launcher/launcher_view.cc +++ b/ash/launcher/launcher_view.cc @@ -22,6 +22,7 @@ #include "ash/shelf/shelf_widget.h" #include "ash/shell_delegate.h" #include "base/auto_reset.h" +#include "base/command_line.h" #include "base/memory/scoped_ptr.h" #include "grit/ash_resources.h" #include "grit/ash_strings.h" @@ -377,7 +378,9 @@ LauncherView::LauncherView(LauncherModel* model, cancelling_drag_model_changed_(false), last_hidden_index_(0), closing_event_time_(base::TimeDelta()), - got_deleted_(NULL) { + got_deleted_(NULL), + drag_and_drop_item_created_(false), + drag_and_drop_launcher_id_(0) { DCHECK(model_); bounds_animator_.reset(new views::BoundsAnimator(this)); bounds_animator_->AddObserver(this); @@ -523,6 +526,83 @@ View* LauncherView::GetFocusTraversableParentView() { return this; } +bool LauncherView::StartDrag(const std::string& app_id, + const gfx::Point& location_in_screen_coordinates) { + // Bail if an operation is already going on - or the cursor is not inside. + // This could happen if mouse / touch operations overlap. + if (drag_and_drop_launcher_id_ || + !GetBoundsInScreen().Contains(location_in_screen_coordinates)) + return false; + + // If the AppsGridView (which was dispatching this event) was opened by our + // button, LauncherView dragging operations are locked and we have to unlock. + CancelDrag(-1); + drag_and_drop_item_created_ = false; + drag_and_drop_app_id_ = app_id; + drag_and_drop_launcher_id_ = + delegate_->GetLauncherIDForAppID(drag_and_drop_app_id_); + + if (!drag_and_drop_launcher_id_) { + delegate_->PinAppWithID(app_id); + drag_and_drop_launcher_id_ = + delegate_->GetLauncherIDForAppID(drag_and_drop_app_id_); + if (!drag_and_drop_launcher_id_) + return false; + drag_and_drop_item_created_ = true; + } + views::View* drag_and_drop_view = view_model_->view_at( + model_->ItemIndexByID(drag_and_drop_launcher_id_)); + DCHECK(drag_and_drop_view); + + // Since there is already an icon presented, we hide this one for now. + drag_and_drop_view->SetVisible(false); + // First we have to center the mouse cursor over the item. + gfx::Point pt = drag_and_drop_view->GetBoundsInScreen().CenterPoint(); + views::View::ConvertPointFromScreen(drag_and_drop_view, &pt); + ui::MouseEvent event(ui::ET_MOUSE_PRESSED, + pt, location_in_screen_coordinates, 0); + PointerPressedOnButton( + drag_and_drop_view, LauncherButtonHost::DRAG_AND_DROP, event); + + // Drag the item where it really belongs. + Drag(location_in_screen_coordinates); + return true; +} + +bool LauncherView::Drag(const gfx::Point& location_in_screen_coordinates) { + if (!drag_and_drop_launcher_id_ || + !GetBoundsInScreen().Contains(location_in_screen_coordinates)) + return false; + + gfx::Point pt = location_in_screen_coordinates; + views::View* drag_and_drop_view = view_model_->view_at( + model_->ItemIndexByID(drag_and_drop_launcher_id_)); + views::View::ConvertPointFromScreen(drag_and_drop_view, &pt); + + ui::MouseEvent event(ui::ET_MOUSE_DRAGGED, pt, gfx::Point(), 0); + PointerDraggedOnButton( + drag_and_drop_view, LauncherButtonHost::DRAG_AND_DROP, event); + return true; +} + +void LauncherView::EndDrag(bool cancel) { + if (!drag_and_drop_launcher_id_) + return; + + views::View* drag_and_drop_view = view_model_->view_at( + model_->ItemIndexByID(drag_and_drop_launcher_id_)); + PointerReleasedOnButton( + drag_and_drop_view, LauncherButtonHost::DRAG_AND_DROP, cancel); + + if (drag_and_drop_item_created_ && cancel) + delegate_->UnpinAppsWithID(drag_and_drop_app_id_); + + if (drag_and_drop_view) + drag_and_drop_view->SetVisible(true); + + drag_and_drop_launcher_id_ = 0; +} + void LauncherView::LayoutToIdealBounds() { IdealBounds ideal_bounds; CalculateIdealBounds(&ideal_bounds); @@ -1173,8 +1253,6 @@ void LauncherView::LauncherItemChanged(int model_index, break; } case TYPE_BROWSER_SHORTCUT: - if (!Shell::IsLauncherPerDisplayEnabled()) - break; // Fallthrough for the new Launcher since it needs to show the activation // change as well. case TYPE_APP_SHORTCUT: @@ -1340,31 +1418,37 @@ void LauncherView::ButtonPressed(views::Button* sender, ui::ScopedAnimationDurationScaleMode::SLOW_DURATION)); } - // Collect usage statistics before we decide what to do with the click. - switch (model_->items()[view_index].type) { - case TYPE_APP_SHORTCUT: - case TYPE_WINDOWED_APP: - case TYPE_PLATFORM_APP: - Shell::GetInstance()->delegate()->RecordUserMetricsAction( - UMA_LAUNCHER_CLICK_ON_APP); - // Fallthrough - case TYPE_TABBED: - case TYPE_APP_PANEL: - delegate_->ItemSelected(model_->items()[view_index], event); - break; + // Collect usage statistics before we decide what to do with the click. + switch (model_->items()[view_index].type) { + case TYPE_APP_SHORTCUT: + case TYPE_WINDOWED_APP: + case TYPE_PLATFORM_APP: + Shell::GetInstance()->delegate()->RecordUserMetricsAction( + UMA_LAUNCHER_CLICK_ON_APP); + // Fallthrough + case TYPE_TABBED: + case TYPE_APP_PANEL: + delegate_->ItemSelected(model_->items()[view_index], event); + break; - case TYPE_APP_LIST: - Shell::GetInstance()->delegate()->RecordUserMetricsAction( - UMA_LAUNCHER_CLICK_ON_APPLIST_BUTTON); - Shell::GetInstance()->ToggleAppList(GetWidget()->GetNativeView()); - break; + case TYPE_APP_LIST: + Shell::GetInstance()->delegate()->RecordUserMetricsAction( + UMA_LAUNCHER_CLICK_ON_APPLIST_BUTTON); + Shell::GetInstance()->ToggleAppList(GetWidget()->GetNativeView()); + // By setting us as DnD recipient, the app list knows that we can + // handle items. + // TODO(skuhne): Invert the flag + if (CommandLine::ForCurrentProcess()->HasSwitch( + ash::switches::kAshDragAndDropAppListToLauncher)) + Shell::GetInstance()->SetDragAndDropHostOfCurrentAppList(this); + break; - case TYPE_BROWSER_SHORTCUT: - // Click on browser icon is counted in app clicks. - Shell::GetInstance()->delegate()->RecordUserMetricsAction( - UMA_LAUNCHER_CLICK_ON_APP); - delegate_->OnBrowserShortcutClicked(event.flags()); - break; + case TYPE_BROWSER_SHORTCUT: + // Click on browser icon is counted in app clicks. + Shell::GetInstance()->delegate()->RecordUserMetricsAction( + UMA_LAUNCHER_CLICK_ON_APP); + delegate_->OnBrowserShortcutClicked(event.flags()); + break; } } diff --git a/ash/launcher/launcher_view.h b/ash/launcher/launcher_view.h index 3b1f0f36b1..b7b8c93841 100644 --- a/ash/launcher/launcher_view.h +++ b/ash/launcher/launcher_view.h @@ -12,6 +12,7 @@ #include "ash/launcher/launcher_model_observer.h" #include "ash/wm/gestures/shelf_gesture_handler.h" #include "base/observer_list.h" +#include "ui/app_list/views/app_list_drag_and_drop_host.h" #include "ui/views/animation/bounds_animator_observer.h" #include "ui/views/context_menu_controller.h" #include "ui/views/controls/button/button.h" @@ -50,7 +51,8 @@ class ASH_EXPORT LauncherView : public views::View, public LauncherButtonHost, public views::ContextMenuController, public views::FocusTraversable, - public views::BoundsAnimatorObserver { + public views::BoundsAnimatorObserver, + public app_list::ApplicationDragAndDropHost { public: LauncherView(LauncherModel* model, LauncherDelegate* delegate, @@ -97,6 +99,13 @@ class ASH_EXPORT LauncherView : public views::View, virtual FocusTraversable* GetFocusTraversableParent() OVERRIDE; virtual View* GetFocusTraversableParentView() OVERRIDE; + // Overridden from app_list::ApplicationDragAndDropHost: + virtual bool StartDrag( + const std::string& app_id, + const gfx::Point& location_in_screen_coordinates) OVERRIDE; + virtual bool Drag(const gfx::Point& location_in_screen_coordinates) OVERRIDE; + virtual void EndDrag(bool cancel) OVERRIDE; + private: friend class ash::test::LauncherViewTestAPI; @@ -320,6 +329,17 @@ class ASH_EXPORT LauncherView : public views::View, // element will be set to false. bool* got_deleted_; + // True if a drag and drop operation created the item in the launcher and it + // needs to be deleted again if the operation gets cancelled. + bool drag_and_drop_item_created_; + + // The launcher item which is currently used for a drag and a drop operation + // or 0 otherwise. + LauncherID drag_and_drop_launcher_id_; + + // The application ID of the application which we drag and drop. + std::string drag_and_drop_app_id_; + DISALLOW_COPY_AND_ASSIGN(LauncherView); }; diff --git a/ash/launcher/launcher_view_unittest.cc b/ash/launcher/launcher_view_unittest.cc index d1e2e768c1..8edcc51fd8 100644 --- a/ash/launcher/launcher_view_unittest.cc +++ b/ash/launcher/launcher_view_unittest.cc @@ -377,18 +377,6 @@ class LauncherViewTest : public AshTestBase { DISALLOW_COPY_AND_ASSIGN(LauncherViewTest); }; -// Checks that the icon positions do not shift with a state change. -TEST_F(LauncherViewTest, NoStateChangeIconMovement) { - LauncherID last_added = AddAppShortcut(); - internal::LauncherButton* button = GetButtonByID(last_added); - EXPECT_EQ(button->state(), ash::internal::LauncherButton::STATE_NORMAL); - gfx::Rect old_bounds = button->GetIconBounds(); - - button->AddState(ash::internal::LauncherButton::STATE_HOVERED); - gfx::Rect hovered_bounds = button->GetIconBounds(); - EXPECT_EQ(old_bounds.ToString(), hovered_bounds.ToString()); -} - // Adds browser button until overflow and verifies that the last added browser // button is hidden. TEST_F(LauncherViewTest, AddBrowserUntilOverflow) { diff --git a/ash/magnifier/magnification_controller.cc b/ash/magnifier/magnification_controller.cc index 55785c74e3..ec0a7bcdfc 100644 --- a/ash/magnifier/magnification_controller.cc +++ b/ash/magnifier/magnification_controller.cc @@ -44,9 +44,9 @@ const float kScrollScaleChangeFactor = 0.05f; const int kPanningMergin = 100; void MoveCursorTo(aura::RootWindow* root_window, - const gfx::Point root_location) { + const gfx::Point& root_location) { gfx::Point3F host_location_3f(root_location); - root_window->layer()->transform().TransformPoint(host_location_3f); + root_window->GetRootTransform().TransformPoint(host_location_3f); root_window->MoveCursorToHostLocation( gfx::ToCeiledPoint(host_location_3f.AsPointF())); } diff --git a/ash/magnifier/magnification_controller_unittest.cc b/ash/magnifier/magnification_controller_unittest.cc index 5611b980cb..31f2be0766 100644 --- a/ash/magnifier/magnification_controller_unittest.cc +++ b/ash/magnifier/magnification_controller_unittest.cc @@ -53,12 +53,6 @@ class MagnificationControllerTest: public test::AshTestBase { return Shell::GetPrimaryRootWindow(); } - - void MoveCursorWithEvent(gfx::Point point) { - aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); - generator.MoveMouseTo(point.x(), point.y()); - } - std::string GetHostMouseLocation() { gfx::Point point; GetRootWindow()->QueryMouseLocationForTest(&point); @@ -178,26 +172,29 @@ TEST_F(MagnificationControllerTest, MoveWindow) { } TEST_F(MagnificationControllerTest, PointOfInterest) { - MoveCursorWithEvent(gfx::Point(0, 0)); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); + + generator.MoveMouseToInHost(gfx::Point(0, 0)); EXPECT_EQ("0,0", CurrentPointOfInterest()); - MoveCursorWithEvent(gfx::Point(799, 599)); + generator.MoveMouseToInHost(gfx::Point(799, 599)); EXPECT_EQ("799,599", CurrentPointOfInterest()); - MoveCursorWithEvent(gfx::Point(400, 300)); + generator.MoveMouseToInHost(gfx::Point(400, 300)); EXPECT_EQ("400,300", CurrentPointOfInterest()); GetMagnificationController()->SetEnabled(true); EXPECT_EQ("400,300", CurrentPointOfInterest()); - MoveCursorWithEvent(gfx::Point(500, 400)); + generator.MoveMouseToInHost(gfx::Point(500, 400)); EXPECT_EQ("450,350", CurrentPointOfInterest()); } TEST_F(MagnificationControllerTest, PanWindow2xLeftToRight) { const aura::Env* env = aura::Env::GetInstance(); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); - MoveCursorWithEvent(gfx::Point(0, 0)); + generator.MoveMouseToInHost(gfx::Point(0, 0)); EXPECT_EQ(1.f, GetMagnificationController()->GetScale()); EXPECT_EQ("0,0 800x600", GetViewport().ToString()); EXPECT_EQ("0,0", env->last_mouse_location().ToString()); @@ -207,100 +204,101 @@ TEST_F(MagnificationControllerTest, PanWindow2xLeftToRight) { EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); GetMagnificationController()->MoveWindow(0, 0, false); - MoveCursorWithEvent(gfx::Point(0, 0)); + generator.MoveMouseToInHost(gfx::Point(0, 0)); EXPECT_EQ("0,0", env->last_mouse_location().ToString()); EXPECT_EQ("0,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(300, 150)); + generator.MoveMouseToInHost(gfx::Point(300, 150)); EXPECT_EQ("150,75", env->last_mouse_location().ToString()); EXPECT_EQ("0,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(700, 150)); + generator.MoveMouseToInHost(gfx::Point(700, 150)); EXPECT_EQ("350,75", env->last_mouse_location().ToString()); EXPECT_EQ("0,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(701, 150)); + generator.MoveMouseToInHost(gfx::Point(701, 150)); EXPECT_EQ("350,75", env->last_mouse_location().ToString()); EXPECT_EQ("0,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(702, 150)); + generator.MoveMouseToInHost(gfx::Point(702, 150)); EXPECT_EQ("351,75", env->last_mouse_location().ToString()); EXPECT_EQ("1,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(703, 150)); + generator.MoveMouseToInHost(gfx::Point(703, 150)); EXPECT_EQ("352,75", env->last_mouse_location().ToString()); EXPECT_EQ("2,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(704, 150)); + generator.MoveMouseToInHost(gfx::Point(704, 150)); EXPECT_EQ("354,75", env->last_mouse_location().ToString()); EXPECT_EQ("4,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(712, 150)); + generator.MoveMouseToInHost(gfx::Point(712, 150)); EXPECT_EQ("360,75", env->last_mouse_location().ToString()); EXPECT_EQ("10,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(600, 150)); + generator.MoveMouseToInHost(gfx::Point(600, 150)); EXPECT_EQ("310,75", env->last_mouse_location().ToString()); EXPECT_EQ("10,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(720, 150)); + generator.MoveMouseToInHost(gfx::Point(720, 150)); EXPECT_EQ("370,75", env->last_mouse_location().ToString()); EXPECT_EQ("20,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(780, 150)); + generator.MoveMouseToInHost(gfx::Point(780, 150)); EXPECT_EQ("410,75", env->last_mouse_location().ToString()); EXPECT_EQ("410,75", CurrentPointOfInterest()); EXPECT_EQ("60,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(799, 150)); + generator.MoveMouseToInHost(gfx::Point(799, 150)); EXPECT_EQ("459,75", env->last_mouse_location().ToString()); EXPECT_EQ("109,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(702, 150)); + generator.MoveMouseToInHost(gfx::Point(702, 150)); EXPECT_EQ("460,75", env->last_mouse_location().ToString()); EXPECT_EQ("110,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(780, 150)); + generator.MoveMouseToInHost(gfx::Point(780, 150)); EXPECT_EQ("500,75", env->last_mouse_location().ToString()); EXPECT_EQ("150,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(780, 150)); + generator.MoveMouseToInHost(gfx::Point(780, 150)); EXPECT_EQ("540,75", env->last_mouse_location().ToString()); EXPECT_EQ("190,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(780, 150)); + generator.MoveMouseToInHost(gfx::Point(780, 150)); EXPECT_EQ("580,75", env->last_mouse_location().ToString()); EXPECT_EQ("230,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(780, 150)); + generator.MoveMouseToInHost(gfx::Point(780, 150)); EXPECT_EQ("620,75", env->last_mouse_location().ToString()); EXPECT_EQ("270,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(780, 150)); + generator.MoveMouseToInHost(gfx::Point(780, 150)); EXPECT_EQ("660,75", env->last_mouse_location().ToString()); EXPECT_EQ("310,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(780, 150)); + generator.MoveMouseToInHost(gfx::Point(780, 150)); EXPECT_EQ("700,75", env->last_mouse_location().ToString()); EXPECT_EQ("350,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(780, 150)); + generator.MoveMouseToInHost(gfx::Point(780, 150)); EXPECT_EQ("740,75", env->last_mouse_location().ToString()); EXPECT_EQ("390,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(780, 150)); + generator.MoveMouseToInHost(gfx::Point(780, 150)); EXPECT_EQ("780,75", env->last_mouse_location().ToString()); EXPECT_EQ("400,0 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(799, 150)); + generator.MoveMouseToInHost(gfx::Point(799, 150)); EXPECT_EQ("799,75", env->last_mouse_location().ToString()); EXPECT_EQ("400,0 400x300", GetViewport().ToString()); } TEST_F(MagnificationControllerTest, PanWindow2xRightToLeft) { const aura::Env* env = aura::Env::GetInstance(); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); - MoveCursorWithEvent(gfx::Point(799, 300)); + generator.MoveMouseToInHost(gfx::Point(799, 300)); EXPECT_EQ(1.f, GetMagnificationController()->GetScale()); EXPECT_EQ("0,0 800x600", GetViewport().ToString()); EXPECT_EQ("799,300", env->last_mouse_location().ToString()); @@ -308,51 +306,52 @@ TEST_F(MagnificationControllerTest, PanWindow2xRightToLeft) { // Enables magnifier and confirm the viewport is at center. GetMagnificationController()->SetEnabled(true); - MoveCursorWithEvent(gfx::Point(799, 300)); + generator.MoveMouseToInHost(gfx::Point(799, 300)); EXPECT_EQ("798,300", env->last_mouse_location().ToString()); EXPECT_EQ("400,150 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(0, 300)); + generator.MoveMouseToInHost(gfx::Point(0, 300)); EXPECT_EQ("400,300", env->last_mouse_location().ToString()); EXPECT_EQ("350,150 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(0, 300)); + generator.MoveMouseToInHost(gfx::Point(0, 300)); EXPECT_EQ("350,300", env->last_mouse_location().ToString()); EXPECT_EQ("300,150 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(0, 300)); + generator.MoveMouseToInHost(gfx::Point(0, 300)); EXPECT_EQ("300,300", env->last_mouse_location().ToString()); EXPECT_EQ("250,150 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(0, 300)); + generator.MoveMouseToInHost(gfx::Point(0, 300)); EXPECT_EQ("250,300", env->last_mouse_location().ToString()); EXPECT_EQ("200,150 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(0, 300)); + generator.MoveMouseToInHost(gfx::Point(0, 300)); EXPECT_EQ("200,300", env->last_mouse_location().ToString()); EXPECT_EQ("150,150 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(0, 300)); + generator.MoveMouseToInHost(gfx::Point(0, 300)); EXPECT_EQ("150,300", env->last_mouse_location().ToString()); EXPECT_EQ("100,150 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(0, 300)); + generator.MoveMouseToInHost(gfx::Point(0, 300)); EXPECT_EQ("100,300", env->last_mouse_location().ToString()); EXPECT_EQ("50,150 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(0, 300)); + generator.MoveMouseToInHost(gfx::Point(0, 300)); EXPECT_EQ("50,300", env->last_mouse_location().ToString()); EXPECT_EQ("0,150 400x300", GetViewport().ToString()); - MoveCursorWithEvent(gfx::Point(0, 300)); + generator.MoveMouseToInHost(gfx::Point(0, 300)); EXPECT_EQ("0,300", env->last_mouse_location().ToString()); EXPECT_EQ("0,150 400x300", GetViewport().ToString()); } TEST_F(MagnificationControllerTest, PanWindowToRight) { const aura::Env* env = aura::Env::GetInstance(); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); - MoveCursorWithEvent(gfx::Point(400, 300)); + generator.MoveMouseToInHost(gfx::Point(400, 300)); EXPECT_EQ(1.f, GetMagnificationController()->GetScale()); EXPECT_EQ("0,0 800x600", GetViewport().ToString()); EXPECT_EQ("400,300", env->last_mouse_location().ToString()); @@ -366,38 +365,39 @@ TEST_F(MagnificationControllerTest, PanWindowToRight) { scale *= kMagnificationScaleFactor; GetMagnificationController()->SetScale(scale, false); EXPECT_FLOAT_EQ(2.3784142, GetMagnificationController()->GetScale()); - MoveCursorWithEvent(gfx::Point(400, 300)); + generator.MoveMouseToInHost(gfx::Point(400, 300)); EXPECT_EQ("400,300", env->last_mouse_location().ToString()); - MoveCursorWithEvent(gfx::Point(799, 300)); + generator.MoveMouseToInHost(gfx::Point(799, 300)); EXPECT_EQ("566,299", env->last_mouse_location().ToString()); EXPECT_EQ("705,300", GetHostMouseLocation()); scale *= kMagnificationScaleFactor; GetMagnificationController()->SetScale(scale, false); EXPECT_FLOAT_EQ(2.8284268, GetMagnificationController()->GetScale()); - MoveCursorWithEvent(gfx::Point(799, 300)); + generator.MoveMouseToInHost(gfx::Point(799, 300)); EXPECT_EQ("599,299", env->last_mouse_location().ToString()); EXPECT_EQ("702,300", GetHostMouseLocation()); scale *= kMagnificationScaleFactor; GetMagnificationController()->SetScale(scale, false); EXPECT_FLOAT_EQ(3.3635852, GetMagnificationController()->GetScale()); - MoveCursorWithEvent(gfx::Point(799, 300)); + generator.MoveMouseToInHost(gfx::Point(799, 300)); EXPECT_EQ("627,298", env->last_mouse_location().ToString()); EXPECT_EQ("707,300", GetHostMouseLocation()); scale *= kMagnificationScaleFactor; GetMagnificationController()->SetScale(scale, false); EXPECT_FLOAT_EQ(4.f, GetMagnificationController()->GetScale()); - MoveCursorWithEvent(gfx::Point(799, 300)); + generator.MoveMouseToInHost(gfx::Point(799, 300)); EXPECT_EQ("649,298", env->last_mouse_location().ToString()); EXPECT_EQ("704,300", GetHostMouseLocation()); } TEST_F(MagnificationControllerTest, PanWindowToLeft) { const aura::Env* env = aura::Env::GetInstance(); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); - MoveCursorWithEvent(gfx::Point(400, 300)); + generator.MoveMouseToInHost(gfx::Point(400, 300)); EXPECT_EQ(1.f, GetMagnificationController()->GetScale()); EXPECT_EQ("0,0 800x600", GetViewport().ToString()); EXPECT_EQ("400,300", env->last_mouse_location().ToString()); @@ -411,30 +411,30 @@ TEST_F(MagnificationControllerTest, PanWindowToLeft) { scale *= kMagnificationScaleFactor; GetMagnificationController()->SetScale(scale, false); EXPECT_FLOAT_EQ(2.3784142, GetMagnificationController()->GetScale()); - MoveCursorWithEvent(gfx::Point(400, 300)); + generator.MoveMouseToInHost(gfx::Point(400, 300)); EXPECT_EQ("400,300", env->last_mouse_location().ToString()); - MoveCursorWithEvent(gfx::Point(0, 300)); + generator.MoveMouseToInHost(gfx::Point(0, 300)); EXPECT_EQ("231,299", env->last_mouse_location().ToString()); EXPECT_EQ("100,300", GetHostMouseLocation()); scale *= kMagnificationScaleFactor; GetMagnificationController()->SetScale(scale, false); EXPECT_FLOAT_EQ(2.8284268, GetMagnificationController()->GetScale()); - MoveCursorWithEvent(gfx::Point(0, 300)); + generator.MoveMouseToInHost(gfx::Point(0, 300)); EXPECT_EQ("195,299", env->last_mouse_location().ToString()); EXPECT_EQ("99,300", GetHostMouseLocation()); scale *= kMagnificationScaleFactor; GetMagnificationController()->SetScale(scale, false); EXPECT_FLOAT_EQ(3.3635852, GetMagnificationController()->GetScale()); - MoveCursorWithEvent(gfx::Point(0, 300)); + generator.MoveMouseToInHost(gfx::Point(0, 300)); EXPECT_EQ("165,298", env->last_mouse_location().ToString()); EXPECT_EQ("98,300", GetHostMouseLocation()); scale *= kMagnificationScaleFactor; GetMagnificationController()->SetScale(scale, false); EXPECT_FLOAT_EQ(4.f, GetMagnificationController()->GetScale()); - MoveCursorWithEvent(gfx::Point(0, 300)); + generator.MoveMouseToInHost(gfx::Point(0, 300)); EXPECT_EQ("140,298", env->last_mouse_location().ToString()); EXPECT_EQ("100,300", GetHostMouseLocation()); } diff --git a/ash/resources/default_200_percent/common/window_close_fullscreen_hover.png b/ash/resources/default_200_percent/common/window_close_fullscreen_hover.png Binary files differindex 820050820f..cb8e4d870e 100644 --- a/ash/resources/default_200_percent/common/window_close_fullscreen_hover.png +++ b/ash/resources/default_200_percent/common/window_close_fullscreen_hover.png diff --git a/ash/resources/default_200_percent/common/window_close_fullscreen_normal.png b/ash/resources/default_200_percent/common/window_close_fullscreen_normal.png Binary files differindex af1148baa5..c9044cb4e8 100644 --- a/ash/resources/default_200_percent/common/window_close_fullscreen_normal.png +++ b/ash/resources/default_200_percent/common/window_close_fullscreen_normal.png diff --git a/ash/resources/default_200_percent/common/window_close_fullscreen_pressed.png b/ash/resources/default_200_percent/common/window_close_fullscreen_pressed.png Binary files differindex 9a66982eff..3e67704724 100644 --- a/ash/resources/default_200_percent/common/window_close_fullscreen_pressed.png +++ b/ash/resources/default_200_percent/common/window_close_fullscreen_pressed.png diff --git a/ash/resources/default_200_percent/common/window_close_short_black_hover.png b/ash/resources/default_200_percent/common/window_close_short_black_hover.png Binary files differindex f8cf312c50..729c27e0aa 100644 --- a/ash/resources/default_200_percent/common/window_close_short_black_hover.png +++ b/ash/resources/default_200_percent/common/window_close_short_black_hover.png diff --git a/ash/resources/default_200_percent/common/window_close_short_black_normal.png b/ash/resources/default_200_percent/common/window_close_short_black_normal.png Binary files differindex 09c2ca3664..8bf1d10d6b 100644 --- a/ash/resources/default_200_percent/common/window_close_short_black_normal.png +++ b/ash/resources/default_200_percent/common/window_close_short_black_normal.png diff --git a/ash/resources/default_200_percent/common/window_close_short_black_pressed.png b/ash/resources/default_200_percent/common/window_close_short_black_pressed.png Binary files differindex 9becd7f648..e546f96d26 100644 --- a/ash/resources/default_200_percent/common/window_close_short_black_pressed.png +++ b/ash/resources/default_200_percent/common/window_close_short_black_pressed.png diff --git a/ash/resources/default_200_percent/common/window_close_short_hover.png b/ash/resources/default_200_percent/common/window_close_short_hover.png Binary files differindex 0e186be222..97ebfa2d20 100644 --- a/ash/resources/default_200_percent/common/window_close_short_hover.png +++ b/ash/resources/default_200_percent/common/window_close_short_hover.png diff --git a/ash/resources/default_200_percent/common/window_close_short_normal.png b/ash/resources/default_200_percent/common/window_close_short_normal.png Binary files differindex af1148baa5..7446d08f52 100644 --- a/ash/resources/default_200_percent/common/window_close_short_normal.png +++ b/ash/resources/default_200_percent/common/window_close_short_normal.png diff --git a/ash/resources/default_200_percent/common/window_close_short_pressed.png b/ash/resources/default_200_percent/common/window_close_short_pressed.png Binary files differindex 133a1ec153..d3b7bc913b 100644 --- a/ash/resources/default_200_percent/common/window_close_short_pressed.png +++ b/ash/resources/default_200_percent/common/window_close_short_pressed.png diff --git a/ash/resources/default_200_percent/common/window_close_tall_hover.png b/ash/resources/default_200_percent/common/window_close_tall_hover.png Binary files differindex 9daccdef89..09b42ee622 100644 --- a/ash/resources/default_200_percent/common/window_close_tall_hover.png +++ b/ash/resources/default_200_percent/common/window_close_tall_hover.png diff --git a/ash/resources/default_200_percent/common/window_close_tall_normal.png b/ash/resources/default_200_percent/common/window_close_tall_normal.png Binary files differindex f1a7441942..66ae6d36e7 100644 --- a/ash/resources/default_200_percent/common/window_close_tall_normal.png +++ b/ash/resources/default_200_percent/common/window_close_tall_normal.png diff --git a/ash/resources/default_200_percent/common/window_close_tall_pressed.png b/ash/resources/default_200_percent/common/window_close_tall_pressed.png Binary files differindex 97fb4ca449..ad5dcfca86 100644 --- a/ash/resources/default_200_percent/common/window_close_tall_pressed.png +++ b/ash/resources/default_200_percent/common/window_close_tall_pressed.png diff --git a/ash/resources/default_200_percent/common/window_size_fullscreen_hover.png b/ash/resources/default_200_percent/common/window_size_fullscreen_hover.png Binary files differindex 708cfebd0a..6506664269 100644 --- a/ash/resources/default_200_percent/common/window_size_fullscreen_hover.png +++ b/ash/resources/default_200_percent/common/window_size_fullscreen_hover.png diff --git a/ash/resources/default_200_percent/common/window_size_fullscreen_normal.png b/ash/resources/default_200_percent/common/window_size_fullscreen_normal.png Binary files differindex d374e7af59..0a26553306 100644 --- a/ash/resources/default_200_percent/common/window_size_fullscreen_normal.png +++ b/ash/resources/default_200_percent/common/window_size_fullscreen_normal.png diff --git a/ash/resources/default_200_percent/common/window_size_fullscreen_pressed.png b/ash/resources/default_200_percent/common/window_size_fullscreen_pressed.png Binary files differindex fdd4be0443..275afccbe9 100644 --- a/ash/resources/default_200_percent/common/window_size_fullscreen_pressed.png +++ b/ash/resources/default_200_percent/common/window_size_fullscreen_pressed.png diff --git a/ash/resources/default_200_percent/common/window_size_short_black_hover.png b/ash/resources/default_200_percent/common/window_size_short_black_hover.png Binary files differindex b90f7058f5..b358e4ff0f 100644 --- a/ash/resources/default_200_percent/common/window_size_short_black_hover.png +++ b/ash/resources/default_200_percent/common/window_size_short_black_hover.png diff --git a/ash/resources/default_200_percent/common/window_size_short_black_normal.png b/ash/resources/default_200_percent/common/window_size_short_black_normal.png Binary files differindex 918b8e2061..f1924aab73 100644 --- a/ash/resources/default_200_percent/common/window_size_short_black_normal.png +++ b/ash/resources/default_200_percent/common/window_size_short_black_normal.png diff --git a/ash/resources/default_200_percent/common/window_size_short_black_pressed.png b/ash/resources/default_200_percent/common/window_size_short_black_pressed.png Binary files differindex 5a11ae46f9..2cf18b1596 100644 --- a/ash/resources/default_200_percent/common/window_size_short_black_pressed.png +++ b/ash/resources/default_200_percent/common/window_size_short_black_pressed.png diff --git a/ash/resources/default_200_percent/common/window_size_short_hover.png b/ash/resources/default_200_percent/common/window_size_short_hover.png Binary files differindex 52153455a3..e3db7db166 100644 --- a/ash/resources/default_200_percent/common/window_size_short_hover.png +++ b/ash/resources/default_200_percent/common/window_size_short_hover.png diff --git a/ash/resources/default_200_percent/common/window_size_short_normal.png b/ash/resources/default_200_percent/common/window_size_short_normal.png Binary files differindex 00ce4ee465..1b1e68d592 100644 --- a/ash/resources/default_200_percent/common/window_size_short_normal.png +++ b/ash/resources/default_200_percent/common/window_size_short_normal.png diff --git a/ash/resources/default_200_percent/common/window_size_short_pressed.png b/ash/resources/default_200_percent/common/window_size_short_pressed.png Binary files differindex b9441963b4..ce66d512f2 100644 --- a/ash/resources/default_200_percent/common/window_size_short_pressed.png +++ b/ash/resources/default_200_percent/common/window_size_short_pressed.png diff --git a/ash/resources/default_200_percent/common/window_size_tall_hover.png b/ash/resources/default_200_percent/common/window_size_tall_hover.png Binary files differindex 548f2577b9..3583f453dd 100644 --- a/ash/resources/default_200_percent/common/window_size_tall_hover.png +++ b/ash/resources/default_200_percent/common/window_size_tall_hover.png diff --git a/ash/resources/default_200_percent/common/window_size_tall_normal.png b/ash/resources/default_200_percent/common/window_size_tall_normal.png Binary files differindex 187234b789..4eedfc8887 100644 --- a/ash/resources/default_200_percent/common/window_size_tall_normal.png +++ b/ash/resources/default_200_percent/common/window_size_tall_normal.png diff --git a/ash/resources/default_200_percent/common/window_size_tall_pressed.png b/ash/resources/default_200_percent/common/window_size_tall_pressed.png Binary files differindex aca7d01f58..82b46412e5 100644 --- a/ash/resources/default_200_percent/common/window_size_tall_pressed.png +++ b/ash/resources/default_200_percent/common/window_size_tall_pressed.png diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index 81117d93ab..6d0355e5dc 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc @@ -183,10 +183,7 @@ RootWindowController::~RootWindowController() { // static RootWindowController* RootWindowController::ForLauncher(aura::Window* window) { - if (Shell::IsLauncherPerDisplayEnabled()) - return GetRootWindowController(window->GetRootWindow()); - else - return Shell::GetPrimaryRootWindowController(); + return GetRootWindowController(window->GetRootWindow()); } // static @@ -275,17 +272,15 @@ void RootWindowController::InitForPrimaryDisplay() { shelf_.reset(new ash::ShelfWidget( shelf_container, status_container, workspace_controller())); - if (Shell::IsLauncherPerDisplayEnabled() || - root_window_ == Shell::GetPrimaryRootWindow()) { - // Create Panel layout manager - aura::Window* panel_container = GetContainer( - internal::kShellWindowId_PanelContainer); - panel_layout_manager_ = - new internal::PanelLayoutManager(panel_container); - panel_container_handler_.reset( - new ToplevelWindowEventHandler(panel_container)); - panel_container->SetLayoutManager(panel_layout_manager_); - } + // Create Panel layout manager + aura::Window* panel_container = GetContainer( + internal::kShellWindowId_PanelContainer); + panel_layout_manager_ = + new internal::PanelLayoutManager(panel_container); + panel_container_handler_.reset( + new ToplevelWindowEventHandler(panel_container)); + panel_container->SetLayoutManager(panel_layout_manager_); + if (Shell::GetInstance()->session_state_delegate()->HasActiveUser()) shelf_->CreateLauncher(); @@ -416,11 +411,9 @@ SystemTray* RootWindowController::GetSystemTray() { void RootWindowController::ShowContextMenu( const gfx::Point& location_in_screen) { - aura::RootWindow* target = Shell::IsLauncherPerDisplayEnabled() ? - root_window() : Shell::GetPrimaryRootWindow(); DCHECK(Shell::GetInstance()->delegate()); scoped_ptr<ui::MenuModel> menu_model( - Shell::GetInstance()->delegate()->CreateContextMenu(target)); + Shell::GetInstance()->delegate()->CreateContextMenu(root_window())); if (!menu_model) return; diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc index 55b3ed26b2..b33e01262a 100644 --- a/ash/root_window_controller_unittest.cc +++ b/ash/root_window_controller_unittest.cc @@ -144,15 +144,9 @@ TEST_F(RootWindowControllerTest, MAYBE_MoveWindows_Basic) { views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100)); maximized->Maximize(); EXPECT_EQ(root_windows[1], maximized->GetNativeView()->GetRootWindow()); - if (Shell::IsLauncherPerDisplayEnabled()) { - EXPECT_EQ("600,0 500x452", maximized->GetWindowBoundsInScreen().ToString()); - EXPECT_EQ("0,0 500x452", - maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); - } else { - EXPECT_EQ("600,0 500x500", maximized->GetWindowBoundsInScreen().ToString()); - EXPECT_EQ("0,0 500x500", - maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); - } + EXPECT_EQ("600,0 500x452", maximized->GetWindowBoundsInScreen().ToString()); + EXPECT_EQ("0,0 500x452", + maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); views::Widget* minimized = CreateTestWidget(gfx::Rect(800, 10, 100, 100)); minimized->Minimize(); diff --git a/ash/screen_ash_unittest.cc b/ash/screen_ash_unittest.cc index 7ef789b8ab..71d608fb34 100644 --- a/ash/screen_ash_unittest.cc +++ b/ash/screen_ash_unittest.cc @@ -38,15 +38,9 @@ TEST_F(ScreenAshTest, Bounds) { EXPECT_EQ("0,0 600x597", ScreenAsh::GetMaximizedWindowBoundsInParent( primary->GetNativeView()).ToString()); - if (Shell::IsLauncherPerDisplayEnabled()) { - EXPECT_EQ("0,0 500x452", - ScreenAsh::GetMaximizedWindowBoundsInParent( - secondary->GetNativeView()).ToString()); - } else { - EXPECT_EQ("0,0 500x500", - ScreenAsh::GetMaximizedWindowBoundsInParent( - secondary->GetNativeView()).ToString()); - } + EXPECT_EQ("0,0 500x452", + ScreenAsh::GetMaximizedWindowBoundsInParent( + secondary->GetNativeView()).ToString()); // Display bounds EXPECT_EQ("0,0 600x600", @@ -60,15 +54,9 @@ TEST_F(ScreenAshTest, Bounds) { EXPECT_EQ("0,0 600x597", ScreenAsh::GetDisplayWorkAreaBoundsInParent( primary->GetNativeView()).ToString()); - if (Shell::IsLauncherPerDisplayEnabled()) { - EXPECT_EQ("0,0 500x452", - ScreenAsh::GetDisplayWorkAreaBoundsInParent( - secondary->GetNativeView()).ToString()); - } else { - EXPECT_EQ("0,0 500x500", - ScreenAsh::GetDisplayWorkAreaBoundsInParent( - secondary->GetNativeView()).ToString()); - } + EXPECT_EQ("0,0 500x452", + ScreenAsh::GetDisplayWorkAreaBoundsInParent( + secondary->GetNativeView()).ToString()); } // Test verifies a stable handling of secondary screen widget changes diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc index 4cb6af1681..5eb491a8ed 100644 --- a/ash/shelf/shelf_layout_manager.cc +++ b/ash/shelf/shelf_layout_manager.cc @@ -13,6 +13,7 @@ #include "ash/root_window_controller.h" #include "ash/screen_ash.h" #include "ash/session_state_delegate.h" +#include "ash/shelf/shelf_layout_manager_observer.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" @@ -181,7 +182,7 @@ ShelfLayoutManager::~ShelfLayoutManager() { if (update_shelf_observer_) update_shelf_observer_->Detach(); - FOR_EACH_OBSERVER(Observer, observers_, WillDeleteShelf()); + FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, WillDeleteShelf()); Shell::GetInstance()->RemoveShellObserver(this); aura::client::GetActivationClient(root_window_)->RemoveObserver(this); } @@ -191,9 +192,9 @@ void ShelfLayoutManager::SetAutoHideBehavior(ShelfAutoHideBehavior behavior) { return; auto_hide_behavior_ = behavior; UpdateVisibilityState(); - FOR_EACH_OBSERVER(Observer, observers_, + FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, OnAutoHideStateChanged(state_.auto_hide_state)); - FOR_EACH_OBSERVER(Observer, observers_, + FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, OnAutoHideBehaviorChanged(auto_hide_behavior_)); } @@ -325,7 +326,7 @@ void ShelfLayoutManager::UpdateAutoHideState() { if (auto_hide_state == SHELF_AUTO_HIDE_HIDDEN) { // Hides happen immediately. SetState(state_.visibility_state); - FOR_EACH_OBSERVER(Observer, observers_, + FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, OnAutoHideStateChanged(auto_hide_state)); } else { auto_hide_timer_.Stop(); @@ -333,8 +334,9 @@ void ShelfLayoutManager::UpdateAutoHideState() { FROM_HERE, base::TimeDelta::FromMilliseconds(kAutoHideDelayMS), this, &ShelfLayoutManager::UpdateAutoHideStateNow); - FOR_EACH_OBSERVER(Observer, observers_, OnAutoHideStateChanged( - CalculateAutoHideState(state_.visibility_state))); + FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, + OnAutoHideStateChanged( + CalculateAutoHideState(state_.visibility_state))); } } else { auto_hide_timer_.Stop(); @@ -346,11 +348,11 @@ void ShelfLayoutManager::SetWindowOverlapsShelf(bool value) { UpdateShelfBackground(BackgroundAnimator::CHANGE_ANIMATE); } -void ShelfLayoutManager::AddObserver(Observer* observer) { +void ShelfLayoutManager::AddObserver(ShelfLayoutManagerObserver* observer) { observers_.AddObserver(observer); } -void ShelfLayoutManager::RemoveObserver(Observer* observer) { +void ShelfLayoutManager::RemoveObserver(ShelfLayoutManagerObserver* observer) { observers_.RemoveObserver(observer); } @@ -549,7 +551,7 @@ void ShelfLayoutManager::SetState(ShelfVisibilityState visibility_state) { if (state_.Equals(state)) return; // Nothing changed. - FOR_EACH_OBSERVER(Observer, observers_, + FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, WillChangeVisibilityState(visibility_state)); if (state.visibility_state == SHELF_AUTO_HIDE) { diff --git a/ash/shelf/shelf_layout_manager.h b/ash/shelf/shelf_layout_manager.h index ea86f15a48..d074e65b47 100644 --- a/ash/shelf/shelf_layout_manager.h +++ b/ash/shelf/shelf_layout_manager.h @@ -33,6 +33,7 @@ class GestureEvent; namespace ash { class ScreenAsh; +class ShelfLayoutManagerObserver; class ShelfWidget; namespace internal { @@ -54,24 +55,6 @@ class ASH_EXPORT ShelfLayoutManager : public keyboard::KeyboardControllerObserver { public: - // TODO(rharrison): Move this observer out of ash::internal:: - // namespace. Tracked in crosbug.com/223936 - class ASH_EXPORT Observer { - public: - // Called when the target ShelfLayoutManager will be deleted. - virtual void WillDeleteShelf() {} - - // Called when the visibility change is scheduled. - virtual void WillChangeVisibilityState(ShelfVisibilityState new_state) {} - - // Called when the auto hide state is changed. - virtual void OnAutoHideStateChanged(ShelfAutoHideState new_state) {} - - // Called when the auto hide behavior is changed. - virtual void OnAutoHideBehaviorChanged( - ShelfAutoHideBehavior new_behavior) {} - }; - // We reserve a small area on the edge of the workspace area to ensure that // the resize handle at the edge of the window can be hit. static const int kWorkspaceAreaVisibleInset; @@ -140,8 +123,8 @@ class ASH_EXPORT ShelfLayoutManager : void SetWindowOverlapsShelf(bool value); bool window_overlaps_shelf() const { return window_overlaps_shelf_; } - void AddObserver(Observer* observer); - void RemoveObserver(Observer* observer); + void AddObserver(ShelfLayoutManagerObserver* observer); + void RemoveObserver(ShelfLayoutManagerObserver* observer); // Gesture dragging related functions: void StartGestureDrag(const ui::GestureEvent& gesture); @@ -327,7 +310,7 @@ class ASH_EXPORT ShelfLayoutManager : // trigger showing the launcher. scoped_ptr<AutoHideEventFilter> event_filter_; - ObserverList<Observer> observers_; + ObserverList<ShelfLayoutManagerObserver> observers_; // The shelf reacts to gesture-drags, and can be set to auto-hide for certain // gestures. Some shelf behaviour (e.g. visibility state, background color diff --git a/ash/shelf/shelf_layout_manager_observer.h b/ash/shelf/shelf_layout_manager_observer.h new file mode 100644 index 0000000000..120238b6eb --- /dev/null +++ b/ash/shelf/shelf_layout_manager_observer.h @@ -0,0 +1,32 @@ +// 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_SHELF_SHELF_LAYOUT_MANAGER_OBSERVER_H_ +#define ASH_SHELF_SHELF_LAYOUT_MANAGER_OBSERVER_H_ + +#include "ash/ash_export.h" +#include "ash/shelf/shelf_types.h" + +namespace ash { + +class ASH_EXPORT ShelfLayoutManagerObserver { + public: + virtual ~ShelfLayoutManagerObserver() {} + + // Called when the target ShelfLayoutManager will be deleted. + virtual void WillDeleteShelf() {} + + // Called when the visibility change is scheduled. + virtual void WillChangeVisibilityState(ShelfVisibilityState new_state) {} + + // Called when the auto hide state is changed. + virtual void OnAutoHideStateChanged(ShelfAutoHideState new_state) {} + + // Called when the auto hide behavior is changed. + virtual void OnAutoHideBehaviorChanged(ShelfAutoHideBehavior new_behavior) {} +}; + +} // namespace ash + +#endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_OBSERVER_H_ diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc index 10cf1d0420..4cf3a602ce 100644 --- a/ash/shelf/shelf_layout_manager_unittest.cc +++ b/ash/shelf/shelf_layout_manager_unittest.cc @@ -14,6 +14,7 @@ #include "ash/root_window_controller.h" #include "ash/screen_ash.h" #include "ash/session_state_delegate.h" +#include "ash/shelf/shelf_layout_manager_observer.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" @@ -143,7 +144,7 @@ class ShelfDragCallback { DISALLOW_COPY_AND_ASSIGN(ShelfDragCallback); }; -class ShelfLayoutObserverTest : public ShelfLayoutManager::Observer { +class ShelfLayoutObserverTest : public ShelfLayoutManagerObserver { public: ShelfLayoutObserverTest() : changed_auto_hide_state_(false) { diff --git a/ash/shelf/shelf_widget_unittest.cc b/ash/shelf/shelf_widget_unittest.cc index c0d61195b8..4f2aaa37c9 100644 --- a/ash/shelf/shelf_widget_unittest.cc +++ b/ash/shelf/shelf_widget_unittest.cc @@ -104,25 +104,23 @@ TEST_F(ShelfWidgetTest, TestAlignment) { SHELF_ALIGNMENT_LEFT, "48,0 252x300"); } - if (Shell::IsLauncherPerDisplayEnabled()) { - { - SCOPED_TRACE("Secondary Bottom"); - TestLauncherAlignment(root_windows[1], - SHELF_ALIGNMENT_BOTTOM, - "300,0 500x452"); - } - { - SCOPED_TRACE("Secondary Right"); - TestLauncherAlignment(root_windows[1], - SHELF_ALIGNMENT_RIGHT, - "300,0 452x500"); - } - { - SCOPED_TRACE("Secondary Left"); - TestLauncherAlignment(root_windows[1], - SHELF_ALIGNMENT_LEFT, - "348,0 452x500"); - } + { + SCOPED_TRACE("Secondary Bottom"); + TestLauncherAlignment(root_windows[1], + SHELF_ALIGNMENT_BOTTOM, + "300,0 500x452"); + } + { + SCOPED_TRACE("Secondary Right"); + TestLauncherAlignment(root_windows[1], + SHELF_ALIGNMENT_RIGHT, + "300,0 452x500"); + } + { + SCOPED_TRACE("Secondary Left"); + TestLauncherAlignment(root_windows[1], + SHELF_ALIGNMENT_LEFT, + "348,0 452x500"); } } diff --git a/ash/shell.cc b/ash/shell.cc index 4be78a2374..9112130ab3 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -414,12 +414,6 @@ std::vector<aura::Window*> Shell::GetContainersFromAllRootWindows( } // static -bool Shell::IsLauncherPerDisplayEnabled() { - CommandLine* command_line = CommandLine::ForCurrentProcess(); - return !command_line->HasSwitch(switches::kAshDisableLauncherPerDisplay); -} - -// static bool Shell::IsForcedMaximizeMode() { CommandLine* command_line = CommandLine::ForCurrentProcess(); return command_line->HasSwitch(switches::kForcedMaximizeMode); @@ -650,6 +644,13 @@ void Shell::ToggleAppList(aura::Window* window) { app_list_controller_->SetVisible(!app_list_controller_->IsVisible(), window); } +void Shell::SetDragAndDropHostOfCurrentAppList( + app_list::ApplicationDragAndDropHost* drag_and_drop_host) { + if (app_list_controller_.get()) + app_list_controller_->SetDragAndDropHostOfCurrentAppList( + drag_and_drop_host); +} + bool Shell::GetAppListTargetVisibility() const { return app_list_controller_.get() && app_list_controller_->GetTargetVisibility(); @@ -725,25 +726,17 @@ void Shell::OnLockStateChanged(bool locked) { } void Shell::CreateLauncher() { - if (IsLauncherPerDisplayEnabled()) { - RootWindowControllerList controllers = GetAllRootWindowControllers(); - for (RootWindowControllerList::iterator iter = controllers.begin(); - iter != controllers.end(); ++iter) - (*iter)->shelf()->CreateLauncher(); - } else { - GetPrimaryRootWindowController()->shelf()->CreateLauncher(); - } + RootWindowControllerList controllers = GetAllRootWindowControllers(); + for (RootWindowControllerList::iterator iter = controllers.begin(); + iter != controllers.end(); ++iter) + (*iter)->shelf()->CreateLauncher(); } void Shell::ShowLauncher() { - if (IsLauncherPerDisplayEnabled()) { - RootWindowControllerList controllers = GetAllRootWindowControllers(); - for (RootWindowControllerList::iterator iter = controllers.begin(); - iter != controllers.end(); ++iter) - (*iter)->ShowLauncher(); - } else { - GetPrimaryRootWindowController()->ShowLauncher(); - } + RootWindowControllerList controllers = GetAllRootWindowControllers(); + for (RootWindowControllerList::iterator iter = controllers.begin(); + iter != controllers.end(); ++iter) + (*iter)->ShowLauncher(); } void Shell::AddShellObserver(ShellObserver* observer) { @@ -856,8 +849,7 @@ void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) { // screen. controller->CreateSystemBackground(false); InitRootWindowController(controller); - if (IsLauncherPerDisplayEnabled()) - controller->InitForPrimaryDisplay(); + controller->InitForPrimaryDisplay(); controller->root_window_layout()->OnWindowResized(); desktop_background_controller_->OnRootWindowAdded(root); high_contrast_controller_->OnRootWindowAdded(root); diff --git a/ash/shell.h b/ash/shell.h index b8a0ce9b1d..0415be4e43 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -26,6 +26,9 @@ class CommandLine; +namespace app_list { +class ApplicationDragAndDropHost; +} namespace aura { class EventFilter; class RootWindow; @@ -197,9 +200,6 @@ class ASH_EXPORT Shell int container_id, aura::RootWindow* priority_root); - // True if "launcher per display" feature is enabled. - static bool IsLauncherPerDisplayEnabled(); - // True if an experimental maximize mode is enabled which forces browser and // application windows to be maximized only. static bool IsForcedMaximizeMode(); @@ -217,6 +217,11 @@ class ASH_EXPORT Shell // will be used. void ToggleAppList(aura::Window* anchor); + // If |drag_and_drop_host| is not NULL it will be called upon drag and drop + // operations outside the application list. + void SetDragAndDropHostOfCurrentAppList( + app_list::ApplicationDragAndDropHost* drag_and_drop_host); + // Returns app list target visibility. bool GetAppListTargetVisibility() const; diff --git a/ash/shell/content_client/shell_main_delegate.h b/ash/shell/content_client/shell_main_delegate.h index a491d4651a..2ac0051454 100644 --- a/ash/shell/content_client/shell_main_delegate.h +++ b/ash/shell/content_client/shell_main_delegate.h @@ -7,8 +7,8 @@ #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" -#include "content/shell/shell_content_client.h" #include "content/public/app/content_main_delegate.h" +#include "content/shell/common/shell_content_client.h" namespace content { class ShellContentRendererClient; diff --git a/ash/shell/launcher_delegate_impl.cc b/ash/shell/launcher_delegate_impl.cc index b38dee37cf..601adaccbf 100644 --- a/ash/shell/launcher_delegate_impl.cc +++ b/ash/shell/launcher_delegate_impl.cc @@ -80,5 +80,16 @@ bool LauncherDelegateImpl::IsPerAppLauncher() { return false; } +LauncherID LauncherDelegateImpl::GetLauncherIDForAppID( + const std::string& app_id) { + return 0; +} + +void LauncherDelegateImpl::PinAppWithID(const std::string& app_id) { +} + +void LauncherDelegateImpl::UnpinAppsWithID(const std::string& app_id) { +} + } // namespace shell } // namespace ash diff --git a/ash/shell/launcher_delegate_impl.h b/ash/shell/launcher_delegate_impl.h index e57b5b481c..26b1dfd0a5 100644 --- a/ash/shell/launcher_delegate_impl.h +++ b/ash/shell/launcher_delegate_impl.h @@ -42,6 +42,9 @@ class LauncherDelegateImpl : public ash::LauncherDelegate { virtual void OnLauncherCreated(Launcher* launcher) OVERRIDE; virtual void OnLauncherDestroyed(Launcher* launcher) OVERRIDE; virtual bool IsPerAppLauncher() OVERRIDE; + virtual LauncherID GetLauncherIDForAppID(const std::string& app_id) OVERRIDE; + virtual void PinAppWithID(const std::string& app_id) OVERRIDE; + virtual void UnpinAppsWithID(const std::string& app_id) OVERRIDE; private: // Used to update Launcher. Owned by main. diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc index c5b133299c..a3092873b9 100644 --- a/ash/shell/shell_delegate_impl.cc +++ b/ash/shell/shell_delegate_impl.cc @@ -40,9 +40,6 @@ class DummyKeyboardControllerProxy : public keyboard::KeyboardControllerProxy { return Shell::GetInstance()->input_method_filter()->input_method(); } - virtual void OnKeyboardBoundsChanged(const gfx::Rect& new_bounds) OVERRIDE { - } - DISALLOW_COPY_AND_ASSIGN(DummyKeyboardControllerProxy); }; diff --git a/ash/system/chromeos/audio/tray_audio.cc b/ash/system/chromeos/audio/tray_audio.cc index 246b082f54..102bb29ea3 100644 --- a/ash/system/chromeos/audio/tray_audio.cc +++ b/ash/system/chromeos/audio/tray_audio.cc @@ -596,6 +596,12 @@ void TrayAudio::OnOutputMuteChanged() { } } +void TrayAudio::OnInputGainChanged() { +} + +void TrayAudio::OnInputMuteChanged() { +} + void TrayAudio::OnAudioNodesChanged() { Update(); } @@ -609,10 +615,14 @@ void TrayAudio::OnActiveInputNodeChanged() { } void TrayAudio::Update() { + if (tray_view()) + tray_view()->SetVisible(GetInitialVisibility()); if (audio_detail_) audio_detail_->Update(); - if (volume_view_) + if (volume_view_) { + volume_view_->SetVolumeLevel(GetVolumeLevel()); volume_view_->Update(); + } } } // namespace internal diff --git a/ash/system/chromeos/audio/tray_audio.h b/ash/system/chromeos/audio/tray_audio.h index af8f7a9954..da0821909b 100644 --- a/ash/system/chromeos/audio/tray_audio.h +++ b/ash/system/chromeos/audio/tray_audio.h @@ -43,6 +43,8 @@ class TrayAudio : public TrayImageItem, // Overridden from chromeos::CrasAudioHandler::AudioObserver. virtual void OnOutputVolumeChanged() OVERRIDE; virtual void OnOutputMuteChanged() OVERRIDE; + virtual void OnInputGainChanged() OVERRIDE; + virtual void OnInputMuteChanged() OVERRIDE; virtual void OnAudioNodesChanged() OVERRIDE; virtual void OnActiveOutputNodeChanged() OVERRIDE; virtual void OnActiveInputNodeChanged() OVERRIDE; diff --git a/ash/system/chromeos/network/tray_network.cc b/ash/system/chromeos/network/tray_network.cc index eabb74d430..b5731ad3f5 100644 --- a/ash/system/chromeos/network/tray_network.cc +++ b/ash/system/chromeos/network/tray_network.cc @@ -131,7 +131,9 @@ class NetworkTrayView : public TrayItemView, network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this); } - std::string GetClassName() const { return "NetworkTrayView"; } + virtual const char* GetClassName() const OVERRIDE { + return "NetworkTrayView"; + } void Update(const NetworkIconInfo& info) { if (UseNewNetworkHandlers()) diff --git a/ash/system/power/tray_power.cc b/ash/system/power/tray_power.cc index f7c6a33088..4d27337f41 100644 --- a/ash/system/power/tray_power.cc +++ b/ash/system/power/tray_power.cc @@ -391,7 +391,7 @@ void TrayPower::OnPowerStatusChanged(const PowerSupplyStatus& status) { bool TrayPower::UpdateNotificationState(const PowerSupplyStatus& status) { if (!status.battery_is_present || status.is_calculating_battery_time || - status.line_power_on) { + status.battery_state != PowerSupplyStatus::DISCHARGING) { notification_state_ = NOTIFICATION_NONE; return false; } diff --git a/ash/system/status_area_widget_delegate.cc b/ash/system/status_area_widget_delegate.cc index f4a7b5ab79..92a8c71730 100644 --- a/ash/system/status_area_widget_delegate.cc +++ b/ash/system/status_area_widget_delegate.cc @@ -83,25 +83,38 @@ void StatusAreaWidgetDelegate::UpdateLayout() { views::ColumnSet* columns = layout->AddColumnSet(0); if (alignment_ == SHELF_ALIGNMENT_BOTTOM || alignment_ == SHELF_ALIGNMENT_TOP) { + bool is_first_visible_child = true; for (int c = 0; c < child_count(); ++c) { - if (c != 0) + views::View* child = child_at(c); + if (!child->visible()) + continue; + if (!is_first_visible_child) columns->AddPaddingColumn(0, kTraySpacing); + is_first_visible_child = false; columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 0, /* resize percent */ views::GridLayout::USE_PREF, 0, 0); } layout->StartRow(0, 0); - for (int c = child_count() - 1; c >= 0; --c) - layout->AddView(child_at(c)); + for (int c = child_count() - 1; c >= 0; --c) { + views::View* child = child_at(c); + if (child->visible()) + layout->AddView(child); + } } else { columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, 0, /* resize percent */ views::GridLayout::USE_PREF, 0, 0); + bool is_first_visible_child = true; for (int c = child_count() - 1; c >= 0; --c) { - if (c != child_count() - 1) + views::View* child = child_at(c); + if (!child->visible()) + continue; + if (!is_first_visible_child) layout->AddPaddingRow(0, kTraySpacing); + is_first_visible_child = false; layout->StartRow(0, 0); - layout->AddView(child_at(c)); + layout->AddView(child); } } Layout(); @@ -113,6 +126,10 @@ void StatusAreaWidgetDelegate::ChildPreferredSizeChanged(View* child) { UpdateWidgetSize(); } +void StatusAreaWidgetDelegate::ChildVisibilityChanged(View* child) { + UpdateLayout(); +} + void StatusAreaWidgetDelegate::UpdateWidgetSize() { if (GetWidget()) GetWidget()->SetSize(GetPreferredSize()); diff --git a/ash/system/status_area_widget_delegate.h b/ash/system/status_area_widget_delegate.h index eaa7253524..751c31bece 100644 --- a/ash/system/status_area_widget_delegate.h +++ b/ash/system/status_area_widget_delegate.h @@ -50,7 +50,8 @@ class ASH_EXPORT StatusAreaWidgetDelegate : public views::AccessiblePaneView, protected: // Overridden from views::View: - virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; + virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; + virtual void ChildVisibilityChanged(views::View* child) OVERRIDE; private: void UpdateWidgetSize(); diff --git a/ash/system/tray/system_tray_delegate.h b/ash/system/tray/system_tray_delegate.h index e5f25ec2dd..6f8860526c 100644 --- a/ash/system/tray/system_tray_delegate.h +++ b/ash/system/tray/system_tray_delegate.h @@ -193,6 +193,9 @@ class SystemTrayDelegate { // Show accessilibity help. virtual void ShowAccessibilityHelp() = 0; + // Show the settings related to accessilibity. + virtual void ShowAccessibilitySettings() = 0; + // Shows more information about public account mode. virtual void ShowPublicAccountInfo() = 0; diff --git a/ash/system/tray/test_system_tray_delegate.cc b/ash/system/tray/test_system_tray_delegate.cc index a832732c3a..89fc09724b 100644 --- a/ash/system/tray/test_system_tray_delegate.cc +++ b/ash/system/tray/test_system_tray_delegate.cc @@ -173,6 +173,9 @@ void TestSystemTrayDelegate::ShowHelp() { void TestSystemTrayDelegate::ShowAccessibilityHelp() { } +void TestSystemTrayDelegate::ShowAccessibilitySettings() { +} + void TestSystemTrayDelegate::ShowPublicAccountInfo() { } diff --git a/ash/system/tray/test_system_tray_delegate.h b/ash/system/tray/test_system_tray_delegate.h index 58c98252b5..516e4248b6 100644 --- a/ash/system/tray/test_system_tray_delegate.h +++ b/ash/system/tray/test_system_tray_delegate.h @@ -51,6 +51,7 @@ class TestSystemTrayDelegate : public SystemTrayDelegate { virtual void ShowIMESettings() OVERRIDE; virtual void ShowHelp() OVERRIDE; virtual void ShowAccessibilityHelp() OVERRIDE; + virtual void ShowAccessibilitySettings() OVERRIDE; virtual void ShowPublicAccountInfo() OVERRIDE; virtual void ShowEnterpriseInfo() OVERRIDE; virtual void ShowLocallyManagedUserInfo() OVERRIDE; diff --git a/ash/system/tray_accessibility.cc b/ash/system/tray_accessibility.cc index 44fdc8eb20..b4f182376b 100644 --- a/ash/system/tray_accessibility.cc +++ b/ash/system/tray_accessibility.cc @@ -108,6 +108,7 @@ AccessibilityDetailedView::AccessibilityDetailedView( high_contrast_view_(NULL), screen_magnifier_view_(NULL), help_view_(NULL), + settings_view_(NULL), spoken_feedback_enabled_(false), high_contrast_enabled_(false), screen_magnifier_enabled_(false), @@ -172,8 +173,12 @@ void AccessibilityDetailedView::AppendHelpEntries() { bottom_row->AddChildView(help); help_view_ = help; - // TODO(yoshiki): Add "Customize accessibility" button when the customize is - // available. crbug.com/158281 + TrayPopupLabelButton* settings = new TrayPopupLabelButton( + this, + bundle.GetLocalizedString( + IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SETTINGS)); + bottom_row->AddChildView(settings); + settings_view_ = settings; AddChildView(bottom_row); } @@ -207,6 +212,8 @@ void AccessibilityDetailedView::ButtonPressed(views::Button* sender, Shell::GetInstance()->system_tray_delegate(); if (sender == help_view_) tray_delegate->ShowAccessibilityHelp(); + else if (sender == settings_view_) + tray_delegate->ShowAccessibilitySettings(); } } // namespace tray diff --git a/ash/system/tray_accessibility.h b/ash/system/tray_accessibility.h index cd2d729af1..e23f4b9e2d 100644 --- a/ash/system/tray_accessibility.h +++ b/ash/system/tray_accessibility.h @@ -74,6 +74,7 @@ class AccessibilityDetailedView : public TrayDetailsView, views::View* high_contrast_view_; views::View* screen_magnifier_view_;; views::View* help_view_; + views::View* settings_view_; bool spoken_feedback_enabled_; bool high_contrast_enabled_; diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc index fe54d9ad41..1e64e1202e 100644 --- a/ash/system/user/tray_user.cc +++ b/ash/system/user/tray_user.cc @@ -63,6 +63,7 @@ const int kUserDetailsVerticalPadding = 5; const int kUserCardVerticalPadding = 10; const int kProfileRoundedCornerRadius = 2; const int kUserIconSize = 27; +const int kUserLabelToIconPadding = 5; // The invisible word joiner character, used as a marker to indicate the start // and end of the user's display name in the public account user card's text. @@ -574,6 +575,7 @@ void UserView::AddUserCard(SystemTrayItem* owner, TrayUser::TrayUser(SystemTray* system_tray) : SystemTrayItem(system_tray), user_(NULL), + layout_view_(NULL), avatar_(NULL), label_(NULL) { Shell::GetInstance()->system_tray_notifier()->AddUserObserver(this); @@ -584,19 +586,13 @@ TrayUser::~TrayUser() { } views::View* TrayUser::CreateTrayView(user::LoginStatus status) { - CHECK(avatar_ == NULL); - CHECK(label_ == NULL); - if (status == user::LOGGED_IN_GUEST) { - label_ = new views::Label; - ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); - label_->SetText(bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_GUEST_LABEL)); - SetupLabelForTray(label_); - } else { - avatar_ = new tray::RoundedImageView(kProfileRoundedCornerRadius); - } + CHECK(layout_view_ == NULL); + layout_view_ = new views::View(); + layout_view_->SetLayoutManager( + new views::BoxLayout(views::BoxLayout::kHorizontal, + 0, 0, kUserLabelToIconPadding)); UpdateAfterLoginStatusChange(status); - return avatar_ ? static_cast<views::View*>(avatar_) - : static_cast<views::View*>(label_); + return layout_view_; } views::View* TrayUser::CreateDefaultView(user::LoginStatus status) { @@ -613,6 +609,7 @@ views::View* TrayUser::CreateDetailedView(user::LoginStatus status) { } void TrayUser::DestroyTrayView() { + layout_view_ = NULL; avatar_ = NULL; label_ = NULL; } @@ -625,53 +622,93 @@ void TrayUser::DestroyDetailedView() { } void TrayUser::UpdateAfterLoginStatusChange(user::LoginStatus status) { + CHECK(layout_view_); + bool need_label = false; + bool need_avatar = false; switch (status) { case user::LOGGED_IN_LOCKED: case user::LOGGED_IN_USER: case user::LOGGED_IN_OWNER: case user::LOGGED_IN_PUBLIC: + need_avatar = true; + break; case user::LOGGED_IN_LOCALLY_MANAGED: - avatar_->SetImage( - ash::Shell::GetInstance()->system_tray_delegate()->GetUserImage(), - gfx::Size(kUserIconSize, kUserIconSize)); - avatar_->SetVisible(true); + need_avatar = true; + need_label = true; break; - case user::LOGGED_IN_GUEST: - label_->SetVisible(true); + need_label = true; break; - case user::LOGGED_IN_RETAIL_MODE: case user::LOGGED_IN_KIOSK_APP: case user::LOGGED_IN_NONE: - avatar_->SetVisible(false); break; } + + if ((need_avatar != (avatar_ != NULL)) || + (need_label != (label_ != NULL))) { + layout_view_->RemoveAllChildViews(true); + if (need_label) { + label_ = new views::Label; + SetupLabelForTray(label_); + layout_view_->AddChildView(label_); + } else { + label_ = NULL; + } + if (need_avatar) { + avatar_ = new tray::RoundedImageView(kProfileRoundedCornerRadius); + layout_view_->AddChildView(avatar_); + } else { + avatar_ = NULL; + } + } + + ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); + if (status == user::LOGGED_IN_LOCALLY_MANAGED) { + label_->SetText( + bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_LOCALLY_MANAGED_LABEL)); + } else if (status == user::LOGGED_IN_GUEST) { + label_->SetText(bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_GUEST_LABEL)); + } + + if (avatar_) { + avatar_->SetImage( + ash::Shell::GetInstance()->system_tray_delegate()->GetUserImage(), + gfx::Size(kUserIconSize, kUserIconSize)); + } } void TrayUser::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { - if (avatar_) { - if (alignment == SHELF_ALIGNMENT_BOTTOM || - alignment == SHELF_ALIGNMENT_TOP) { + CHECK(layout_view_); + if (alignment == SHELF_ALIGNMENT_BOTTOM || + alignment == SHELF_ALIGNMENT_TOP) { + if (avatar_) { avatar_->set_border(views::Border::CreateEmptyBorder( 0, kTrayImageItemHorizontalPaddingBottomAlignment + 2, 0, kTrayImageItemHorizontalPaddingBottomAlignment)); - } else { - SetTrayImageItemBorder(avatar_, alignment); + } - } else { - if (alignment == SHELF_ALIGNMENT_BOTTOM || - alignment == SHELF_ALIGNMENT_TOP) { + if (label_) { label_->set_border(views::Border::CreateEmptyBorder( 0, kTrayLabelItemHorizontalPaddingBottomAlignment, 0, kTrayLabelItemHorizontalPaddingBottomAlignment)); - } else { + } + layout_view_->SetLayoutManager( + new views::BoxLayout(views::BoxLayout::kHorizontal, + 0, 0, kUserLabelToIconPadding)); + } else { + if (avatar_) + SetTrayImageItemBorder(avatar_, alignment); + if (label_) { label_->set_border(views::Border::CreateEmptyBorder( kTrayLabelItemVerticalPaddingVeriticalAlignment, kTrayLabelItemHorizontalPaddingBottomAlignment, kTrayLabelItemVerticalPaddingVeriticalAlignment, kTrayLabelItemHorizontalPaddingBottomAlignment)); } + layout_view_->SetLayoutManager( + new views::BoxLayout(views::BoxLayout::kVertical, + 0, 0, kUserLabelToIconPadding)); } } diff --git a/ash/system/user/tray_user.h b/ash/system/user/tray_user.h index b38705e916..340ab2df98 100644 --- a/ash/system/user/tray_user.h +++ b/ash/system/user/tray_user.h @@ -44,6 +44,9 @@ class TrayUser : public SystemTrayItem, virtual void OnUserUpdate() OVERRIDE; tray::UserView* user_; + + // View that contains label and/or avatar. + views::View* layout_view_; tray::RoundedImageView* avatar_; views::Label* label_; diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc index 2207ba9bda..9c108220bd 100644 --- a/ash/system/web_notification/web_notification_tray.cc +++ b/ash/system/web_notification/web_notification_tray.cc @@ -236,7 +236,6 @@ bool WebNotificationTray::ShowMessageCenter() { message_center_bubble->SetMaxHeight(max_height); message_center_bubble_.reset( new internal::WebNotificationBubbleWrapper(this, message_center_bubble)); - SetBubbleVisible(true); status_area_widget()->SetHideSystemNotifications(true); GetShelfLayoutManager()->UpdateAutoHideState(); @@ -249,7 +248,6 @@ void WebNotificationTray::HideMessageCenter() { return; message_center_bubble_.reset(); should_block_shelf_auto_hide_ = false; - SetBubbleVisible(false); show_message_center_on_unlock_ = false; status_area_widget()->SetHideSystemNotifications(false); GetShelfLayoutManager()->UpdateAutoHideState(); diff --git a/ash/test/test_launcher_delegate.cc b/ash/test/test_launcher_delegate.cc index 16422e3f73..3a4fccd4e0 100644 --- a/ash/test/test_launcher_delegate.cc +++ b/ash/test/test_launcher_delegate.cc @@ -131,5 +131,16 @@ bool TestLauncherDelegate::IsPerAppLauncher() { return true; } +LauncherID TestLauncherDelegate::GetLauncherIDForAppID( + const std::string& app_id) { + return 0; +} + +void TestLauncherDelegate::PinAppWithID(const std::string& app_id) { +} + +void TestLauncherDelegate::UnpinAppsWithID(const std::string& app_id) { +} + } // namespace test } // namespace ash diff --git a/ash/test/test_launcher_delegate.h b/ash/test/test_launcher_delegate.h index b86b1e10a7..65dc634e9e 100644 --- a/ash/test/test_launcher_delegate.h +++ b/ash/test/test_launcher_delegate.h @@ -51,6 +51,9 @@ class TestLauncherDelegate : public LauncherDelegate, virtual void OnLauncherCreated(Launcher* launcher) OVERRIDE; virtual void OnLauncherDestroyed(Launcher* launcher) OVERRIDE; virtual bool IsPerAppLauncher() OVERRIDE; + virtual LauncherID GetLauncherIDForAppID(const std::string& app_id) OVERRIDE; + virtual void PinAppWithID(const std::string& app_id) OVERRIDE; + virtual void UnpinAppsWithID(const std::string& app_id) OVERRIDE; private: typedef std::map<aura::Window*, ash::LauncherID> WindowToID; diff --git a/ash/wm/app_list_controller.cc b/ash/wm/app_list_controller.cc index 7fcf76c9f1..02afc69c7b 100644 --- a/ash/wm/app_list_controller.cc +++ b/ash/wm/app_list_controller.cc @@ -139,6 +139,12 @@ aura::Window* AppListController::GetWindow() { return is_visible_ && view_ ? view_->GetWidget()->GetNativeWindow() : NULL; } +void AppListController::SetDragAndDropHostOfCurrentAppList( + app_list::ApplicationDragAndDropHost* drag_and_drop_host) { + if (view_ && is_visible_) + view_->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host); +} + //////////////////////////////////////////////////////////////////////////////// // AppListController, private: diff --git a/ash/wm/app_list_controller.h b/ash/wm/app_list_controller.h index d2408d8bac..6f05d6a97d 100644 --- a/ash/wm/app_list_controller.h +++ b/ash/wm/app_list_controller.h @@ -19,6 +19,7 @@ #include "ui/views/widget/widget_observer.h" namespace app_list { +class ApplicationDragAndDropHost; class AppListView; class PaginationModel; } @@ -61,6 +62,11 @@ class AppListController : public ui::EventHandler, // Returns app list window or NULL if it is not visible. aura::Window* GetWindow(); + // If |drag_and_drop_host| is not NULL it will be called upon drag and drop + // operations outside the application list. + void SetDragAndDropHostOfCurrentAppList( + app_list::ApplicationDragAndDropHost* drag_and_drop_host); + private: // Sets the app list view and attempts to show it. void SetView(app_list::AppListView* view); diff --git a/ash/wm/ash_activation_controller.cc b/ash/wm/ash_activation_controller.cc index f8c338a178..2c0237494e 100644 --- a/ash/wm/ash_activation_controller.cc +++ b/ash/wm/ash_activation_controller.cc @@ -96,9 +96,7 @@ aura::Window* AshActivationController::PrepareToActivateLauncher() { if (!Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled()) return NULL; ShelfWidget* shelf = GetRootWindowController( - Shell::IsLauncherPerDisplayEnabled() ? - Shell::GetActiveRootWindow() : - Shell::GetPrimaryRootWindow())->shelf(); + Shell::GetActiveRootWindow())->shelf(); // Launcher's window may be already destroyed in shutting down process. if (!shelf) return NULL; diff --git a/ash/wm/ash_native_cursor_manager_unittest.cc b/ash/wm/ash_native_cursor_manager_unittest.cc index c8f6b8ed0d..878da71672 100644 --- a/ash/wm/ash_native_cursor_manager_unittest.cc +++ b/ash/wm/ash_native_cursor_manager_unittest.cc @@ -14,6 +14,10 @@ #include "ui/aura/window.h" #include "ui/gfx/screen.h" +#if defined(OS_WIN) +#include "base/win/windows_version.h" +#endif + using views::corewm::CursorManager; namespace ash { @@ -118,60 +122,27 @@ TEST_F(AshNativeCursorManagerTest, SetDeviceScaleFactorAndRotation) { EXPECT_EQ(gfx::Display::ROTATE_270, test_api.GetDisplay().rotation()); } -// Disabled for Windows. See crbug.com/112222. -// Disabled for ChromeOS. See crbug.com/237659 -// Verifies that RootWindow generates a mouse event located outside of a window -// when mouse events are disabled. -TEST_F(AshNativeCursorManagerTest, DISABLED_DisabledMouseEventsLocation) { - scoped_ptr<MouseEventLocationDelegate> delegate( - new MouseEventLocationDelegate()); - const int kWindowWidth = 123; - const int kWindowHeight = 45; - gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); - scoped_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate( - delegate.get(), 1, bounds, Shell::GetInstance()->GetPrimaryRootWindow())); - - CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager(); - cursor_manager->EnableMouseEvents(); - // Send a mouse event to window. - gfx::Point point(101, 201); - gfx::Point local_point; - ui::MouseEvent event(ui::ET_MOUSE_MOVED, point, point, 0); - aura::RootWindow* root_window = window->GetRootWindow(); - root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&event); - - // Location was in window. - local_point = delegate->GetMouseEventLocationAndReset(); - aura::Window::ConvertPointToTarget(window.get(), root_window, &local_point); - EXPECT_TRUE(window->bounds().Contains(local_point)); - - // Location is now out of window. - cursor_manager->DisableMouseEvents(); - RunAllPendingInMessageLoop(); - local_point = delegate->GetMouseEventLocationAndReset(); - aura::Window::ConvertPointToTarget(window.get(), root_window, &local_point); - EXPECT_FALSE(window->bounds().Contains(local_point)); - EXPECT_FALSE(window->bounds().Contains( - gfx::Screen::GetScreenFor(window.get())->GetCursorScreenPoint())); - - // Location is back in window. - cursor_manager->EnableMouseEvents(); - RunAllPendingInMessageLoop(); - local_point = delegate->GetMouseEventLocationAndReset(); - aura::Window::ConvertPointToTarget(window.get(), root_window, &local_point); - EXPECT_TRUE(window->bounds().Contains(local_point)); -} - -#if defined(OS_WIN) -// Disable on Win because RootWindow::MoveCursorTo is not implemented. -#define MAYBE_DisabledQueryMouseLocation DISABLED_DisabledQueryMouseLocation -#else -#define MAYBE_DisabledQueryMouseLocation DisabledQueryMouseLocation -#endif // defined(OS_WIN) - -TEST_F(AshNativeCursorManagerTest, MAYBE_DisabledQueryMouseLocation) { +TEST_F(AshNativeCursorManagerTest, DisabledQueryMouseLocation) { aura::RootWindow* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); +#if defined(OS_WIN) + if (base::win::GetVersion() < base::win::VERSION_WIN8) + return; + // On Windows 8 the ASH environment has two processes, the viewer process + // which runs in Windows 8 mode and the browser process. The initialization + // happens when the viewer process connects to the browser channel and sends + // the initial IPC message. + RunAllPendingInMessageLoop(); +#endif root_window->MoveCursorTo(gfx::Point(10, 10)); +#if defined(OS_WIN) + // The MoveCursor operation on Windows 8 is implemented in the viewer process + // which is notified by an IPC message to perform the MoveCursor operation. + // We need to ensure that the IPC is delivered to the viewer process and it + // the ACK is sent back from the viewer indicating that the operation + // completed. + Sleep(100); + RunAllPendingInMessageLoop(); +#endif gfx::Point mouse_location; EXPECT_TRUE(root_window->QueryMouseLocationForTest(&mouse_location)); EXPECT_EQ("10,10", mouse_location.ToString()); diff --git a/ash/wm/base_layout_manager.cc b/ash/wm/base_layout_manager.cc index d5bb54fa66..89e99d9371 100644 --- a/ash/wm/base_layout_manager.cc +++ b/ash/wm/base_layout_manager.cc @@ -89,8 +89,8 @@ void BaseLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child, if (visible && wm::IsWindowMinimized(child)) { // Attempting to show a minimized window. Unminimize it. child->SetProperty(aura::client::kShowStateKey, - child->GetProperty(internal::kRestoreShowStateKey)); - child->ClearProperty(internal::kRestoreShowStateKey); + child->GetProperty(aura::client::kRestoreShowStateKey)); + child->ClearProperty(aura::client::kRestoreShowStateKey); } } @@ -171,7 +171,7 @@ void BaseLayoutManager::ShowStateChanged(aura::Window* window, ui::WindowShowState last_show_state) { if (wm::IsWindowMinimized(window)) { // Save the previous show state so that we can correctly restore it. - window->SetProperty(internal::kRestoreShowStateKey, last_show_state); + window->SetProperty(aura::client::kRestoreShowStateKey, last_show_state); views::corewm::SetWindowVisibilityAnimationType( window, WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE); diff --git a/ash/wm/custom_frame_view_ash.cc b/ash/wm/custom_frame_view_ash.cc index 72c62ee9e7..45cea61a1d 100644 --- a/ash/wm/custom_frame_view_ash.cc +++ b/ash/wm/custom_frame_view_ash.cc @@ -37,7 +37,7 @@ const gfx::Font& GetTitleFont() { namespace ash { // static -const char CustomFrameViewAsh::kViewClassName[] = "ash/wm/CustomFrameViewAsh"; +const char CustomFrameViewAsh::kViewClassName[] = "CustomFrameViewAsh"; //////////////////////////////////////////////////////////////////////////////// // CustomFrameViewAsh, public: @@ -150,7 +150,7 @@ void CustomFrameViewAsh::OnPaint(gfx::Canvas* canvas) { canvas->Restore(); } -std::string CustomFrameViewAsh::GetClassName() const { +const char* CustomFrameViewAsh::GetClassName() const { return kViewClassName; } diff --git a/ash/wm/custom_frame_view_ash.h b/ash/wm/custom_frame_view_ash.h index 5c3f0c3971..b6ccf7fbc9 100644 --- a/ash/wm/custom_frame_view_ash.h +++ b/ash/wm/custom_frame_view_ash.h @@ -68,7 +68,7 @@ class ASH_EXPORT CustomFrameViewAsh : public views::NonClientFrameView, // views::View overrides: virtual gfx::Size GetPreferredSize() OVERRIDE; virtual void Layout() OVERRIDE; - virtual std::string GetClassName() const OVERRIDE; + virtual const char* GetClassName() const OVERRIDE; virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; virtual gfx::Size GetMinimumSize() OVERRIDE; virtual gfx::Size GetMaximumSize() OVERRIDE; diff --git a/ash/wm/panels/panel_layout_manager.cc b/ash/wm/panels/panel_layout_manager.cc index d28b77ccb3..c4ccd11a3d 100644 --- a/ash/wm/panels/panel_layout_manager.cc +++ b/ash/wm/panels/panel_layout_manager.cc @@ -9,6 +9,7 @@ #include "ash/launcher/launcher.h" #include "ash/screen_ash.h" +#include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_types.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" @@ -463,7 +464,7 @@ void PanelLayoutManager::OnWindowActivated(aura::Window* gained_active, } //////////////////////////////////////////////////////////////////////////////// -// PanelLayoutManager, ShelfLayoutManager::Observer implementation: +// PanelLayoutManager, ShelfLayoutManagerObserver implementation: void PanelLayoutManager::WillChangeVisibilityState( ShelfVisibilityState new_state) { diff --git a/ash/wm/panels/panel_layout_manager.h b/ash/wm/panels/panel_layout_manager.h index 7407bd9839..fd0bc5c29a 100644 --- a/ash/wm/panels/panel_layout_manager.h +++ b/ash/wm/panels/panel_layout_manager.h @@ -9,7 +9,7 @@ #include "ash/ash_export.h" #include "ash/launcher/launcher_icon_observer.h" -#include "ash/shelf/shelf_layout_manager.h" +#include "ash/shelf/shelf_layout_manager_observer.h" #include "ash/shell_observer.h" #include "base/basictypes.h" #include "base/compiler_specific.h" @@ -38,6 +38,7 @@ class Launcher; namespace internal { class PanelCalloutWidget; +class ShelfLayoutManager; // PanelLayoutManager is responsible for organizing panels within the // workspace. It is associated with a specific container window (i.e. @@ -55,7 +56,7 @@ class ASH_EXPORT PanelLayoutManager public aura::WindowObserver, public aura::client::ActivationChangeObserver, public keyboard::KeyboardControllerObserver, - public ShelfLayoutManager::Observer { + public ShelfLayoutManagerObserver { public: explicit PanelLayoutManager(aura::Window* panel_container); virtual ~PanelLayoutManager(); @@ -98,7 +99,7 @@ class ASH_EXPORT PanelLayoutManager virtual void OnWindowActivated(aura::Window* gained_active, aura::Window* lost_active) OVERRIDE; - // Overridden from ShelfLayoutManager::Observer + // Overridden from ShelfLayoutManagerObserver virtual void WillChangeVisibilityState( ShelfVisibilityState new_state) OVERRIDE; diff --git a/ash/wm/panels/panel_window_resizer_unittest.cc b/ash/wm/panels/panel_window_resizer_unittest.cc index 9039de294e..ed28b763da 100644 --- a/ash/wm/panels/panel_window_resizer_unittest.cc +++ b/ash/wm/panels/panel_window_resizer_unittest.cc @@ -35,6 +35,7 @@ class PanelWindowResizerTest : public test::AshTestBase { virtual void SetUp() OVERRIDE { AshTestBase::SetUp(); + UpdateDisplay("600x400"); test::ShellTestApi test_api(Shell::GetInstance()); model_ = test_api.launcher_model(); } @@ -263,7 +264,7 @@ TEST_F(PanelWindowResizerTest, MAYBE_PanelDetachReattachMultipleDisplays) { } TEST_F(PanelWindowResizerTest, MAYBE_DetachThenDragAcrossDisplays) { - UpdateDisplay("400x400,400x400"); + UpdateDisplay("600x400,600x400"); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); scoped_ptr<aura::Window> window( CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); @@ -291,7 +292,7 @@ TEST_F(PanelWindowResizerTest, MAYBE_DetachThenDragAcrossDisplays) { } TEST_F(PanelWindowResizerTest, MAYBE_DetachAcrossDisplays) { - UpdateDisplay("400x400,400x400"); + UpdateDisplay("600x400,600x400"); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); scoped_ptr<aura::Window> window( CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); @@ -309,7 +310,7 @@ TEST_F(PanelWindowResizerTest, MAYBE_DetachAcrossDisplays) { } TEST_F(PanelWindowResizerTest, MAYBE_DetachThenAttachToSecondDisplay) { - UpdateDisplay("400x400,400x600"); + UpdateDisplay("600x400,600x600"); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); scoped_ptr<aura::Window> window( CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); @@ -339,7 +340,7 @@ TEST_F(PanelWindowResizerTest, MAYBE_DetachThenAttachToSecondDisplay) { } TEST_F(PanelWindowResizerTest, MAYBE_AttachToSecondDisplay) { - UpdateDisplay("400x400,400x600"); + UpdateDisplay("600x400,600x600"); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); scoped_ptr<aura::Window> window( CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); diff --git a/ash/wm/system_modal_container_layout_manager.cc b/ash/wm/system_modal_container_layout_manager.cc index d35aaa6a27..59de4b4554 100644 --- a/ash/wm/system_modal_container_layout_manager.cc +++ b/ash/wm/system_modal_container_layout_manager.cc @@ -11,18 +11,17 @@ #include "ash/wm/window_animations.h" #include "ash/wm/window_util.h" #include "base/bind.h" -#include "base/command_line.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/capture_client.h" #include "ui/aura/root_window.h" -#include "ui/views/corewm/compound_event_filter.h" #include "ui/aura/window.h" #include "ui/base/events/event.h" -#include "ui/base/ui_base_switches.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/gfx/screen.h" +#include "ui/views/corewm/compound_event_filter.h" #include "ui/views/view.h" #include "ui/views/widget/widget.h" @@ -164,8 +163,7 @@ void SystemModalContainerLayoutManager::CreateModalBackground() { "SystemModalContainerLayoutManager.ModalBackground"); views::View* contents_view = new views::View(); contents_view->set_background(views::Background::CreateSolidBackground( - CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableNewDialogStyle) ? SK_ColorWHITE : SK_ColorBLACK)); + switches::IsNewDialogStyleEnabled() ? SK_ColorWHITE : SK_ColorBLACK)); modal_background_->SetContentsView(contents_view); modal_background_->GetNativeView()->layer()->SetOpacity(0.0f); } diff --git a/ash/wm/window_properties.cc b/ash/wm/window_properties.cc index 21f205aff7..64d55a7760 100644 --- a/ash/wm/window_properties.cc +++ b/ash/wm/window_properties.cc @@ -26,8 +26,6 @@ DEFINE_WINDOW_PROPERTY_KEY(bool, kFullscreenUsesMinimalChromeKey, false); DEFINE_WINDOW_PROPERTY_KEY(bool, kIgnoreSoloWindowFramePainterPolicy, false); DEFINE_WINDOW_PROPERTY_KEY(bool, kIgnoredByShelfKey, false); DEFINE_WINDOW_PROPERTY_KEY(bool, kPanelAttachedKey, true); -DEFINE_WINDOW_PROPERTY_KEY( - ui::WindowShowState, kRestoreShowStateKey, ui::SHOW_STATE_DEFAULT); DEFINE_WINDOW_PROPERTY_KEY(RootWindowController*, kRootWindowControllerKey, NULL); DEFINE_WINDOW_PROPERTY_KEY(bool, kSoloWindowHeaderKey, false); diff --git a/ash/wm/window_properties.h b/ash/wm/window_properties.h index 7847b62b04..ae30435202 100644 --- a/ash/wm/window_properties.h +++ b/ash/wm/window_properties.h @@ -57,10 +57,6 @@ extern const aura::WindowProperty<bool>* const // True if this window is an attached panel. ASH_EXPORT extern const aura::WindowProperty<bool>* const kPanelAttachedKey; -// Used to remember the show state before the window was minimized. -extern const aura::WindowProperty<ui::WindowShowState>* const - kRestoreShowStateKey; - extern const aura::WindowProperty<RootWindowController*>* const kRootWindowControllerKey; diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc index 65ed116b24..e4e6c841e0 100644 --- a/ash/wm/workspace/workspace_layout_manager.cc +++ b/ash/wm/workspace/workspace_layout_manager.cc @@ -126,8 +126,8 @@ void WorkspaceLayoutManager::OnChildWindowVisibilityChanged(Window* child, if (visible && wm::IsWindowMinimized(child)) { // Attempting to show a minimized window. Unminimize it. child->SetProperty(aura::client::kShowStateKey, - child->GetProperty(internal::kRestoreShowStateKey)); - child->ClearProperty(internal::kRestoreShowStateKey); + child->GetProperty(aura::client::kRestoreShowStateKey)); + child->ClearProperty(aura::client::kRestoreShowStateKey); } workspace_manager()->OnWorkspaceChildWindowVisibilityChanged(workspace_, child); @@ -257,7 +257,7 @@ void WorkspaceLayoutManager::ShowStateChanged( if (wm::IsWindowMinimized(window)) { DCHECK(!cloned_layer); // Save the previous show state so that we can correctly restore it. - window->SetProperty(internal::kRestoreShowStateKey, last_show_state); + window->SetProperty(aura::client::kRestoreShowStateKey, last_show_state); views::corewm::SetWindowVisibilityAnimationType( window, WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE); workspace_manager()->OnWorkspaceWindowShowStateChanged( diff --git a/ash/wm/workspace/workspace_manager.cc b/ash/wm/workspace/workspace_manager.cc index 69413feed2..b4d42260ee 100644 --- a/ash/wm/workspace/workspace_manager.cc +++ b/ash/wm/workspace/workspace_manager.cc @@ -160,7 +160,7 @@ bool WorkspaceManager::IsMaximizedState(ui::WindowShowState state) { // static bool WorkspaceManager::WillRestoreMaximized(Window* window) { return wm::IsWindowMinimized(window) && - IsMaximizedState(window->GetProperty(internal::kRestoreShowStateKey)); + IsMaximizedState(window->GetProperty(aura::client::kRestoreShowStateKey)); } WorkspaceWindowState WorkspaceManager::GetWindowState() const { |