diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-06 20:20:33 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-06 20:20:33 +0000 |
commit | 6da4ffab43cdc0143fff609692e4238529b16e02 (patch) | |
tree | f3715357d30ebc1f0b5840c62b295f89cd718f7f /ash/shelf | |
parent | 006f475cbc01a5e51f4bfcede9a87b732709ae62 (diff) | |
download | chromium_src-6da4ffab43cdc0143fff609692e4238529b16e02.zip chromium_src-6da4ffab43cdc0143fff609692e4238529b16e02.tar.gz chromium_src-6da4ffab43cdc0143fff609692e4238529b16e02.tar.bz2 |
ash: Rename LauncherButtonHost to ShelfButtonHost.
- move launcher_button_host.h from launcher/ to shelf/
- rename to shelf_button_host.h
BUG=248353
TEST=None, no functional changes
R=harrym@chromium.org,jamescook@chromium.org
Review URL: https://codereview.chromium.org/57453002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233337 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/shelf')
-rw-r--r-- | ash/shelf/alternate_app_list_button.cc | 18 | ||||
-rw-r--r-- | ash/shelf/alternate_app_list_button.h | 14 | ||||
-rw-r--r-- | ash/shelf/app_list_button.cc | 12 | ||||
-rw-r--r-- | ash/shelf/app_list_button.h | 9 | ||||
-rw-r--r-- | ash/shelf/shelf_button_host.h | 67 | ||||
-rw-r--r-- | ash/shelf/shelf_view.cc | 6 | ||||
-rw-r--r-- | ash/shelf/shelf_view.h | 20 | ||||
-rw-r--r-- | ash/shelf/shelf_view_unittest.cc | 90 |
8 files changed, 148 insertions, 88 deletions
diff --git a/ash/shelf/alternate_app_list_button.cc b/ash/shelf/alternate_app_list_button.cc index 092578cd..4ce2834 100644 --- a/ash/shelf/alternate_app_list_button.cc +++ b/ash/shelf/alternate_app_list_button.cc @@ -5,8 +5,8 @@ #include "ash/shelf/alternate_app_list_button.h" #include "ash/ash_switches.h" -#include "ash/launcher/launcher_button_host.h" #include "ash/launcher/launcher_types.h" +#include "ash/shelf/shelf_button_host.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" @@ -31,7 +31,7 @@ const int AlternateAppListButton::kImageBoundsSize = 7; AlternateAppListButton::AlternateAppListButton(views::ButtonListener* listener, - LauncherButtonHost* host, + ShelfButtonHost* host, ShelfWidget* shelf_widget) : views::ImageButton(listener), host_(host), @@ -46,23 +46,23 @@ AlternateAppListButton::~AlternateAppListButton() { bool AlternateAppListButton::OnMousePressed(const ui::MouseEvent& event) { ImageButton::OnMousePressed(event); - host_->PointerPressedOnButton(this, LauncherButtonHost::MOUSE, event); + host_->PointerPressedOnButton(this, ShelfButtonHost::MOUSE, event); return true; } void AlternateAppListButton::OnMouseReleased(const ui::MouseEvent& event) { ImageButton::OnMouseReleased(event); - host_->PointerReleasedOnButton(this, LauncherButtonHost::MOUSE, false); + host_->PointerReleasedOnButton(this, ShelfButtonHost::MOUSE, false); } void AlternateAppListButton::OnMouseCaptureLost() { - host_->PointerReleasedOnButton(this, LauncherButtonHost::MOUSE, true); + host_->PointerReleasedOnButton(this, ShelfButtonHost::MOUSE, true); ImageButton::OnMouseCaptureLost(); } bool AlternateAppListButton::OnMouseDragged(const ui::MouseEvent& event) { ImageButton::OnMouseDragged(event); - host_->PointerDraggedOnButton(this, LauncherButtonHost::MOUSE, event); + host_->PointerDraggedOnButton(this, ShelfButtonHost::MOUSE, event); return true; } @@ -84,16 +84,16 @@ void AlternateAppListButton::OnMouseExited(const ui::MouseEvent& event) { void AlternateAppListButton::OnGestureEvent(ui::GestureEvent* event) { switch (event->type()) { case ui::ET_GESTURE_SCROLL_BEGIN: - host_->PointerPressedOnButton(this, LauncherButtonHost::TOUCH, *event); + host_->PointerPressedOnButton(this, ShelfButtonHost::TOUCH, *event); event->SetHandled(); return; case ui::ET_GESTURE_SCROLL_UPDATE: - host_->PointerDraggedOnButton(this, LauncherButtonHost::TOUCH, *event); + host_->PointerDraggedOnButton(this, ShelfButtonHost::TOUCH, *event); event->SetHandled(); return; case ui::ET_GESTURE_SCROLL_END: case ui::ET_SCROLL_FLING_START: - host_->PointerReleasedOnButton(this, LauncherButtonHost::TOUCH, false); + host_->PointerReleasedOnButton(this, ShelfButtonHost::TOUCH, false); event->SetHandled(); return; default: diff --git a/ash/shelf/alternate_app_list_button.h b/ash/shelf/alternate_app_list_button.h index 397b552..1166e04 100644 --- a/ash/shelf/alternate_app_list_button.h +++ b/ash/shelf/alternate_app_list_button.h @@ -13,19 +13,19 @@ class ShelfWidget; namespace internal { -class LauncherButtonHost; +class ShelfButtonHost; -// Button used for the AppList icon on the launcher. -// This class is an alternate implementation to -// ash::internal::AppListButton for the purposes of testing an -// alternate shelf layout (see ash_switches: UseAlternateShelfLayout). +// Button used for the AppList icon on the shelf. +// This class is an alternate implementation to ash::internal::AppListButton +// for the purposes of testing an alternate shelf layout +// (see ash_switches: UseAlternateShelfLayout). class AlternateAppListButton : public views::ImageButton { public: // Bounds size (inset) required for the app icon image (in pixels). static const int kImageBoundsSize; AlternateAppListButton(views::ButtonListener* listener, - LauncherButtonHost* host, + ShelfButtonHost* host, ShelfWidget* shelf_widget); virtual ~AlternateAppListButton(); @@ -45,7 +45,7 @@ class AlternateAppListButton : public views::ImageButton { virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; private: - LauncherButtonHost* host_; + ShelfButtonHost* host_; // Reference to the shelf widget containing this button, owned by the // root window controller. ShelfWidget* shelf_widget_; diff --git a/ash/shelf/app_list_button.cc b/ash/shelf/app_list_button.cc index 80a9b8d..a9612bf 100644 --- a/ash/shelf/app_list_button.cc +++ b/ash/shelf/app_list_button.cc @@ -6,8 +6,8 @@ #include <vector> -#include "ash/launcher/launcher_button_host.h" #include "ash/launcher/launcher_types.h" +#include "ash/shelf/shelf_button_host.h" #include "grit/ash_resources.h" #include "grit/ash_strings.h" #include "ui/base/accessibility/accessible_view_state.h" @@ -25,7 +25,7 @@ const int kAnimationDurationInMs = 600; const float kAnimationOpacity[] = { 1.0f, 0.4f, 1.0f }; AppListButton::AppListButton(views::ButtonListener* listener, - LauncherButtonHost* host) + ShelfButtonHost* host) : views::ImageButton(listener), host_(host) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); @@ -86,23 +86,23 @@ void AppListButton::StopLoadingAnimation() { bool AppListButton::OnMousePressed(const ui::MouseEvent& event) { ImageButton::OnMousePressed(event); - host_->PointerPressedOnButton(this, LauncherButtonHost::MOUSE, event); + host_->PointerPressedOnButton(this, ShelfButtonHost::MOUSE, event); return true; } void AppListButton::OnMouseReleased(const ui::MouseEvent& event) { ImageButton::OnMouseReleased(event); - host_->PointerReleasedOnButton(this, LauncherButtonHost::MOUSE, false); + host_->PointerReleasedOnButton(this, ShelfButtonHost::MOUSE, false); } void AppListButton::OnMouseCaptureLost() { - host_->PointerReleasedOnButton(this, LauncherButtonHost::MOUSE, true); + host_->PointerReleasedOnButton(this, ShelfButtonHost::MOUSE, true); ImageButton::OnMouseCaptureLost(); } bool AppListButton::OnMouseDragged(const ui::MouseEvent& event) { ImageButton::OnMouseDragged(event); - host_->PointerDraggedOnButton(this, LauncherButtonHost::MOUSE, event); + host_->PointerDraggedOnButton(this, ShelfButtonHost::MOUSE, event); return true; } diff --git a/ash/shelf/app_list_button.h b/ash/shelf/app_list_button.h index a8c8e70..9b013de 100644 --- a/ash/shelf/app_list_button.h +++ b/ash/shelf/app_list_button.h @@ -10,13 +10,12 @@ namespace ash { namespace internal { -class LauncherButtonHost; +class ShelfButtonHost; -// Button used for the AppList icon on the launcher. +// Button used for the AppList icon on the shelf. class AppListButton : public views::ImageButton { public: - AppListButton(views::ButtonListener* listener, - LauncherButtonHost* host); + AppListButton(views::ButtonListener* listener, ShelfButtonHost* host); virtual ~AppListButton(); void StartLoadingAnimation(); @@ -34,7 +33,7 @@ class AppListButton : public views::ImageButton { virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; private: - LauncherButtonHost* host_; + ShelfButtonHost* host_; DISALLOW_COPY_AND_ASSIGN(AppListButton); }; diff --git a/ash/shelf/shelf_button_host.h b/ash/shelf/shelf_button_host.h new file mode 100644 index 0000000..d3b3fa2 --- /dev/null +++ b/ash/shelf/shelf_button_host.h @@ -0,0 +1,67 @@ +// 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_BUTTON_HOST_H_ +#define ASH_SHELF_SHELF_BUTTON_HOST_H_ + +#include "ash/ash_export.h" +#include "base/strings/string16.h" + +namespace ui { +class LocatedEvent; +} + +namespace views { +class View; +} + +namespace ash { +namespace internal { + +// The shelf buttons communicate back to the host by way of this interface. +// This interface is used to enable reordering the items on the shelf. +class ASH_EXPORT ShelfButtonHost { + public: + enum Pointer { + NONE, + DRAG_AND_DROP, + MOUSE, + TOUCH, + }; + + // Invoked when a pointer device is pressed on a view. + virtual void PointerPressedOnButton(views::View* view, + Pointer pointer, + const ui::LocatedEvent& event) = 0; + + // Invoked when a pointer device is dragged over a view. + virtual void PointerDraggedOnButton(views::View* view, + Pointer pointer, + const ui::LocatedEvent& event) = 0; + + // Invoked either if a pointer device is released or mouse capture canceled. + virtual void PointerReleasedOnButton(views::View* view, + Pointer pointer, + bool canceled) = 0; + + // Invoked when the mouse moves on the item. + virtual void MouseMovedOverButton(views::View* view) = 0; + + // Invoked when the mouse enters the item. + virtual void MouseEnteredButton(views::View* view) = 0; + + // Invoked when the mouse exits the item. + virtual void MouseExitedButton(views::View* view) = 0; + + // Invoked to get the accessible name of the item. + virtual base::string16 GetAccessibleName(const views::View* view) = 0; + + protected: + virtual ~ShelfButtonHost() {} +}; + +} // namespace internal +} // namespace ash + +#endif // ASH_SHELF_SHELF_BUTTON_HOST_H_ diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc index 86ddc6c..aa65b39 100644 --- a/ash/shelf/shelf_view.cc +++ b/ash/shelf/shelf_view.cc @@ -633,7 +633,7 @@ bool ShelfView::StartDrag(const std::string& app_id, ui::MouseEvent event(ui::ET_MOUSE_PRESSED, pt, location_in_screen_coordinates, 0); PointerPressedOnButton( - drag_and_drop_view, LauncherButtonHost::DRAG_AND_DROP, event); + drag_and_drop_view, ShelfButtonHost::DRAG_AND_DROP, event); // Drag the item where it really belongs. Drag(location_in_screen_coordinates); @@ -652,7 +652,7 @@ bool ShelfView::Drag(const gfx::Point& location_in_screen_coordinates) { ui::MouseEvent event(ui::ET_MOUSE_DRAGGED, pt, gfx::Point(), 0); PointerDraggedOnButton( - drag_and_drop_view, LauncherButtonHost::DRAG_AND_DROP, event); + drag_and_drop_view, ShelfButtonHost::DRAG_AND_DROP, event); return true; } @@ -663,7 +663,7 @@ void ShelfView::EndDrag(bool cancel) { 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); + drag_and_drop_view, ShelfButtonHost::DRAG_AND_DROP, cancel); // Either destroy the temporarily created item - or - make the item visible. if (drag_and_drop_item_pinned_ && cancel) diff --git a/ash/shelf/shelf_view.h b/ash/shelf/shelf_view.h index 58e5fde..22e0152 100644 --- a/ash/shelf/shelf_view.h +++ b/ash/shelf/shelf_view.h @@ -8,8 +8,8 @@ #include <utility> #include <vector> -#include "ash/launcher/launcher_button_host.h" #include "ash/launcher/launcher_model_observer.h" +#include "ash/shelf/shelf_button_host.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" @@ -50,7 +50,7 @@ class ShelfTooltipManager; class ASH_EXPORT ShelfView : public views::View, public LauncherModelObserver, public views::ButtonListener, - public LauncherButtonHost, + public ShelfButtonHost, public views::ContextMenuController, public views::FocusTraversable, public views::BoundsAnimatorObserver, @@ -245,15 +245,13 @@ class ASH_EXPORT ShelfView : public views::View, virtual void LauncherItemMoved(int start_index, int target_index) OVERRIDE; virtual void LauncherStatusChanged() OVERRIDE; - // Overridden from LauncherButtonHost: - virtual void PointerPressedOnButton( - views::View* view, - Pointer pointer, - const ui::LocatedEvent& event) OVERRIDE; - virtual void PointerDraggedOnButton( - views::View* view, - Pointer pointer, - const ui::LocatedEvent& event) OVERRIDE; + // Overridden from ShelfButtonHost: + virtual void PointerPressedOnButton(views::View* view, + Pointer pointer, + const ui::LocatedEvent& event) OVERRIDE; + virtual void PointerDraggedOnButton(views::View* view, + Pointer pointer, + const ui::LocatedEvent& event) OVERRIDE; virtual void PointerReleasedOnButton(views::View* view, Pointer pointer, bool canceled) OVERRIDE; diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc index 4fb440d..2b367d0 100644 --- a/ash/shelf/shelf_view_unittest.cc +++ b/ash/shelf/shelf_view_unittest.cc @@ -336,9 +336,9 @@ class ShelfViewTest : public AshTestBase { } views::View* SimulateButtonPressed( - internal::LauncherButtonHost::Pointer pointer, + internal::ShelfButtonHost::Pointer pointer, int button_index) { - internal::LauncherButtonHost* button_host = shelf_view_; + internal::ShelfButtonHost* button_host = shelf_view_; views::View* button = test_api_->GetButton(button_index); ui::MouseEvent click_event(ui::ET_MOUSE_PRESSED, button->bounds().origin(), @@ -347,20 +347,20 @@ class ShelfViewTest : public AshTestBase { return button; } - views::View* SimulateClick(internal::LauncherButtonHost::Pointer pointer, + views::View* SimulateClick(internal::ShelfButtonHost::Pointer pointer, int button_index) { - internal::LauncherButtonHost* button_host = shelf_view_; + internal::ShelfButtonHost* button_host = shelf_view_; views::View* button = SimulateButtonPressed(pointer, button_index); button_host->PointerReleasedOnButton(button, - internal::LauncherButtonHost::MOUSE, + internal::ShelfButtonHost::MOUSE, false); return button; } - views::View* SimulateDrag(internal::LauncherButtonHost::Pointer pointer, + views::View* SimulateDrag(internal::ShelfButtonHost::Pointer pointer, int button_index, int destination_index) { - internal::LauncherButtonHost* button_host = shelf_view_; + internal::ShelfButtonHost* button_host = shelf_view_; views::View* button = SimulateButtonPressed(pointer, button_index); // Drag. @@ -782,7 +782,7 @@ TEST_F(ShelfViewTest, AddButtonQuickly) { // Check that model changes are handled correctly while a launcher icon is being // dragged. TEST_F(ShelfViewTest, ModelChangesWhileDragging) { - internal::LauncherButtonHost* button_host = shelf_view_; + internal::ShelfButtonHost* button_host = shelf_view_; std::vector<std::pair<LauncherID, views::View*> > id_map; SetupForDragTest(&id_map); @@ -790,19 +790,18 @@ TEST_F(ShelfViewTest, ModelChangesWhileDragging) { // Dragging browser shortcut at index 1. EXPECT_TRUE(model_->items()[1].type == TYPE_BROWSER_SHORTCUT); views::View* dragged_button = SimulateDrag( - internal::LauncherButtonHost::MOUSE, 1, 3); + internal::ShelfButtonHost::MOUSE, 1, 3); std::rotate(id_map.begin() + 1, id_map.begin() + 2, id_map.begin() + 4); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); button_host->PointerReleasedOnButton(dragged_button, - internal::LauncherButtonHost::MOUSE, + internal::ShelfButtonHost::MOUSE, false); EXPECT_TRUE(model_->items()[3].type == TYPE_BROWSER_SHORTCUT); // Dragging changes model order. - dragged_button = SimulateDrag( - internal::LauncherButtonHost::MOUSE, 1, 3); + dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 1, 3); std::rotate(id_map.begin() + 1, id_map.begin() + 2, id_map.begin() + 4); @@ -810,7 +809,7 @@ TEST_F(ShelfViewTest, ModelChangesWhileDragging) { // Cancelling the drag operation restores previous order. button_host->PointerReleasedOnButton(dragged_button, - internal::LauncherButtonHost::MOUSE, + internal::ShelfButtonHost::MOUSE, true); std::rotate(id_map.begin() + 1, id_map.begin() + 3, @@ -818,38 +817,38 @@ TEST_F(ShelfViewTest, ModelChangesWhileDragging) { ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); // Deleting an item keeps the remaining intact. - dragged_button = SimulateDrag(internal::LauncherButtonHost::MOUSE, 1, 3); + dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 1, 3); model_->RemoveItemAt(1); id_map.erase(id_map.begin() + 1); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); button_host->PointerReleasedOnButton(dragged_button, - internal::LauncherButtonHost::MOUSE, + internal::ShelfButtonHost::MOUSE, false); // Adding a launcher item cancels the drag and respects the order. - dragged_button = SimulateDrag(internal::LauncherButtonHost::MOUSE, 1, 3); + dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 1, 3); LauncherID new_id = AddAppShortcut(); id_map.insert(id_map.begin() + 6, std::make_pair(new_id, GetButtonByID(new_id))); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); button_host->PointerReleasedOnButton(dragged_button, - internal::LauncherButtonHost::MOUSE, + internal::ShelfButtonHost::MOUSE, false); // Adding a launcher item at the end (i.e. a panel) canels drag and respects // the order. - dragged_button = SimulateDrag(internal::LauncherButtonHost::MOUSE, 1, 3); + dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 1, 3); new_id = AddPanel(); id_map.insert(id_map.begin() + 7, std::make_pair(new_id, GetButtonByID(new_id))); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); button_host->PointerReleasedOnButton(dragged_button, - internal::LauncherButtonHost::MOUSE, + internal::ShelfButtonHost::MOUSE, false); } TEST_F(ShelfViewLegacyShelfLayoutTest, ModelChangesWhileDragging) { - internal::LauncherButtonHost* button_host = shelf_view_; + internal::ShelfButtonHost* button_host = shelf_view_; std::vector<std::pair<LauncherID, views::View*> > id_map; SetupForDragTest(&id_map); @@ -857,19 +856,18 @@ TEST_F(ShelfViewLegacyShelfLayoutTest, ModelChangesWhileDragging) { // Dragging browser shortcut at index 0. EXPECT_TRUE(model_->items()[0].type == TYPE_BROWSER_SHORTCUT); views::View* dragged_button = SimulateDrag( - internal::LauncherButtonHost::MOUSE, 0, 2); + internal::ShelfButtonHost::MOUSE, 0, 2); std::rotate(id_map.begin(), id_map.begin() + 1, id_map.begin() + 3); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); button_host->PointerReleasedOnButton(dragged_button, - internal::LauncherButtonHost::MOUSE, + internal::ShelfButtonHost::MOUSE, false); EXPECT_TRUE(model_->items()[2].type == TYPE_BROWSER_SHORTCUT); // Dragging changes model order. - dragged_button = SimulateDrag( - internal::LauncherButtonHost::MOUSE, 0, 2); + dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 0, 2); std::rotate(id_map.begin(), id_map.begin() + 1, id_map.begin() + 3); @@ -877,7 +875,7 @@ TEST_F(ShelfViewLegacyShelfLayoutTest, ModelChangesWhileDragging) { // Cancelling the drag operation restores previous order. button_host->PointerReleasedOnButton(dragged_button, - internal::LauncherButtonHost::MOUSE, + internal::ShelfButtonHost::MOUSE, true); std::rotate(id_map.begin(), id_map.begin() + 2, @@ -885,80 +883,78 @@ TEST_F(ShelfViewLegacyShelfLayoutTest, ModelChangesWhileDragging) { ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); // Deleting an item keeps the remaining intact. - dragged_button = SimulateDrag(internal::LauncherButtonHost::MOUSE, 0, 2); + dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 0, 2); model_->RemoveItemAt(1); id_map.erase(id_map.begin() + 1); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); button_host->PointerReleasedOnButton(dragged_button, - internal::LauncherButtonHost::MOUSE, + internal::ShelfButtonHost::MOUSE, false); // Adding a launcher item cancels the drag and respects the order. - dragged_button = SimulateDrag(internal::LauncherButtonHost::MOUSE, 0, 2); + dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 0, 2); LauncherID new_id = AddAppShortcut(); id_map.insert(id_map.begin() + 5, std::make_pair(new_id, GetButtonByID(new_id))); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); button_host->PointerReleasedOnButton(dragged_button, - internal::LauncherButtonHost::MOUSE, + internal::ShelfButtonHost::MOUSE, false); // Adding a launcher item at the end (i.e. a panel) canels drag and respects // the order. - dragged_button = SimulateDrag(internal::LauncherButtonHost::MOUSE, 0, 2); + dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 0, 2); new_id = AddPanel(); id_map.insert(id_map.begin() + 7, std::make_pair(new_id, GetButtonByID(new_id))); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); button_host->PointerReleasedOnButton(dragged_button, - internal::LauncherButtonHost::MOUSE, + internal::ShelfButtonHost::MOUSE, false); } // Check that 2nd drag from the other pointer would be ignored. TEST_F(ShelfViewTest, SimultaneousDrag) { - internal::LauncherButtonHost* button_host = shelf_view_; + internal::ShelfButtonHost* button_host = shelf_view_; std::vector<std::pair<LauncherID, views::View*> > id_map; SetupForDragTest(&id_map); // Start a mouse drag. views::View* dragged_button_mouse = SimulateDrag( - internal::LauncherButtonHost::MOUSE, 1, 3); + internal::ShelfButtonHost::MOUSE, 1, 3); std::rotate(id_map.begin() + 1, id_map.begin() + 2, id_map.begin() + 4); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); // Attempt a touch drag before the mouse drag finishes. views::View* dragged_button_touch = SimulateDrag( - internal::LauncherButtonHost::TOUCH, 4, 2); + internal::ShelfButtonHost::TOUCH, 4, 2); // Nothing changes since 2nd drag is ignored. ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); // Finish the mouse drag. button_host->PointerReleasedOnButton(dragged_button_mouse, - internal::LauncherButtonHost::MOUSE, + internal::ShelfButtonHost::MOUSE, false); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); // Now start a touch drag. - dragged_button_touch = SimulateDrag( - internal::LauncherButtonHost::TOUCH, 4, 2); + dragged_button_touch = SimulateDrag(internal::ShelfButtonHost::TOUCH, 4, 2); std::rotate(id_map.begin() + 3, id_map.begin() + 4, id_map.begin() + 5); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); // And attempt a mouse drag before the touch drag finishes. - dragged_button_mouse = SimulateDrag( - internal::LauncherButtonHost::MOUSE, 1, 2); + dragged_button_mouse = SimulateDrag(internal::ShelfButtonHost::MOUSE, 1, 2); // Nothing changes since 2nd drag is ignored. ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); button_host->PointerReleasedOnButton(dragged_button_touch, - internal::LauncherButtonHost::TOUCH, + internal::ShelfButtonHost::TOUCH, false); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); } @@ -966,24 +962,24 @@ TEST_F(ShelfViewTest, SimultaneousDrag) { // Check that clicking first on one item and then dragging another works as // expected. TEST_F(ShelfViewTest, ClickOneDragAnother) { - internal::LauncherButtonHost* button_host = shelf_view_; + internal::ShelfButtonHost* button_host = shelf_view_; std::vector<std::pair<LauncherID, views::View*> > id_map; SetupForDragTest(&id_map); // A click on item 1 is simulated. - SimulateClick(internal::LauncherButtonHost::MOUSE, 1); + SimulateClick(internal::ShelfButtonHost::MOUSE, 1); // Dragging browser index at 0 should change the model order correctly. EXPECT_TRUE(model_->items()[1].type == TYPE_BROWSER_SHORTCUT); views::View* dragged_button = SimulateDrag( - internal::LauncherButtonHost::MOUSE, 1, 3); + internal::ShelfButtonHost::MOUSE, 1, 3); std::rotate(id_map.begin() + 1, id_map.begin() + 2, id_map.begin() + 4); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); button_host->PointerReleasedOnButton(dragged_button, - internal::LauncherButtonHost::MOUSE, + internal::ShelfButtonHost::MOUSE, false); EXPECT_TRUE(model_->items()[3].type == TYPE_BROWSER_SHORTCUT); } @@ -1084,7 +1080,7 @@ TEST_F(ShelfViewTest, ShelfTooltipTest) { internal::LauncherButton* app_button = GetButtonByID(app_button_id); internal::LauncherButton* platform_button = GetButtonByID(platform_button_id); - internal::LauncherButtonHost* button_host = shelf_view_; + internal::ShelfButtonHost* button_host = shelf_view_; internal::ShelfTooltipManager* tooltip_manager = shelf_view_->tooltip_manager(); @@ -1122,7 +1118,7 @@ TEST_F(ShelfViewTest, ShelfTooltipTest) { // Verify a fix for crash caused by a tooltip update for a deleted launcher // button, see crbug.com/288838. TEST_F(ShelfViewTest, RemovingItemClosesTooltip) { - internal::LauncherButtonHost* button_host = shelf_view_; + internal::ShelfButtonHost* button_host = shelf_view_; internal::ShelfTooltipManager* tooltip_manager = shelf_view_->tooltip_manager(); @@ -1148,7 +1144,7 @@ TEST_F(ShelfViewTest, RemovingItemClosesTooltip) { // Changing the shelf alignment closes any open tooltip. TEST_F(ShelfViewTest, ShelfAlignmentClosesTooltip) { - internal::LauncherButtonHost* button_host = shelf_view_; + internal::ShelfButtonHost* button_host = shelf_view_; internal::ShelfTooltipManager* tooltip_manager = shelf_view_->tooltip_manager(); |