diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-14 19:48:36 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-14 19:48:36 +0000 |
commit | 64936bfc5e259b97286498932cd4abe1ad4d3c57 (patch) | |
tree | 977b1c6e7c9b2af1b63dbe46312ba9b6603b0894 /ash | |
parent | 04afd69e36366fa5cdc3b8c03720119d755c5580 (diff) | |
download | chromium_src-64936bfc5e259b97286498932cd4abe1ad4d3c57.zip chromium_src-64936bfc5e259b97286498932cd4abe1ad4d3c57.tar.gz chromium_src-64936bfc5e259b97286498932cd4abe1ad4d3c57.tar.bz2 |
ash: Rename LauncherModel to ShelfModel.
* Move launcher_model.* from launcher/ to shelf/
* Rename to shelf_model.*
BUG=248353
TEST=None, no functional changes
R=jamescook@chromium.org,harrym@chromium.org
Review URL: https://codereview.chromium.org/71653003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235217 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
46 files changed, 177 insertions, 190 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index b4acff9..1392b34 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -21,7 +21,6 @@ #include "ash/ime_control_delegate.h" #include "ash/launcher/launcher.h" #include "ash/launcher/launcher_delegate.h" -#include "ash/launcher/launcher_model.h" #include "ash/magnifier/magnification_controller.h" #include "ash/magnifier/partial_magnification_controller.h" #include "ash/media_delegate.h" @@ -31,6 +30,7 @@ #include "ash/rotator/screen_rotation.h" #include "ash/screenshot_delegate.h" #include "ash/session_state_delegate.h" +#include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/shell_delegate.h" diff --git a/ash/ash.gyp b/ash/ash.gyp index 46213cf..ce88694 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -164,8 +164,6 @@ 'launcher/launcher_item_delegate_manager.cc', 'launcher/launcher_item_delegate_manager.h', 'launcher/launcher_item_delegate.h', - 'launcher/launcher_model.cc', - 'launcher/launcher_model.h', 'launcher/launcher_types.cc', 'launcher/launcher_types.h', 'magnifier/magnification_controller.cc', @@ -214,6 +212,8 @@ 'shelf/shelf_layout_manager.cc', 'shelf/shelf_layout_manager.h', 'shelf/shelf_layout_manager_observer.h', + 'shelf/shelf_model.cc', + 'shelf/shelf_model.h', 'shelf/shelf_model_observer.h', 'shelf/shelf_model_util.cc', 'shelf/shelf_model_util.h', @@ -762,7 +762,6 @@ 'focus_cycler_unittest.cc', 'keyboard_overlay/keyboard_overlay_delegate_unittest.cc', 'keyboard_overlay/keyboard_overlay_view_unittest.cc', - 'launcher/launcher_model_unittest.cc', 'launcher/launcher_unittest.cc', 'magnifier/magnification_controller_unittest.cc', 'root_window_controller_unittest.cc', @@ -772,6 +771,7 @@ 'session_state_delegate_stub.h', 'shelf/scoped_observer_with_duplicated_sources_unittest.cc', 'shelf/shelf_layout_manager_unittest.cc', + 'shelf/shelf_model_unittest.cc', 'shelf/shelf_navigator_unittest.cc', 'shelf/shelf_tooltip_manager_unittest.cc', 'shelf/shelf_view_unittest.cc', diff --git a/ash/launcher/launcher.cc b/ash/launcher/launcher.cc index e981709..e0dc133 100644 --- a/ash/launcher/launcher.cc +++ b/ash/launcher/launcher.cc @@ -11,10 +11,10 @@ #include "ash/launcher/launcher_delegate.h" #include "ash/launcher/launcher_item_delegate.h" #include "ash/launcher/launcher_item_delegate_manager.h" -#include "ash/launcher/launcher_model.h" #include "ash/root_window_controller.h" #include "ash/screen_ash.h" #include "ash/shelf/shelf_layout_manager.h" +#include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_navigator.h" #include "ash/shelf/shelf_view.h" #include "ash/shelf/shelf_widget.h" @@ -41,7 +41,7 @@ namespace ash { const char Launcher::kNativeViewName[] = "ShelfView"; -Launcher::Launcher(LauncherModel* launcher_model, +Launcher::Launcher(ShelfModel* shelf_model, LauncherDelegate* launcher_delegate, ShelfWidget* shelf_widget) : shelf_view_(NULL), @@ -49,7 +49,7 @@ Launcher::Launcher(LauncherModel* launcher_model, delegate_(launcher_delegate), shelf_widget_(shelf_widget) { shelf_view_ = new internal::ShelfView( - launcher_model, delegate_, shelf_widget_->shelf_layout_manager()); + shelf_model, delegate_, shelf_widget_->shelf_layout_manager()); shelf_view_->Init(); shelf_widget_->GetContentsView()->AddChildView(shelf_view_); shelf_widget_->GetNativeView()->SetName(kNativeViewName); @@ -154,9 +154,9 @@ views::View* Launcher::GetAppListButtonView() const { } void Launcher::LaunchAppIndexAt(int item_index) { - LauncherModel* launcher_model = shelf_view_->model(); - const LauncherItems& items = launcher_model->items(); - int item_count = launcher_model->item_count(); + ShelfModel* shelf_model = shelf_view_->model(); + const LauncherItems& items = shelf_model->items(); + int item_count = shelf_model->item_count(); int indexes_left = item_index >= 0 ? item_index : item_count; int found_index = -1; diff --git a/ash/launcher/launcher.h b/ash/launcher/launcher.h index 5c663b4..5f1da0b 100644 --- a/ash/launcher/launcher.h +++ b/ash/launcher/launcher.h @@ -42,15 +42,15 @@ class LauncherTestAPI; } class LauncherDelegate; -class LauncherModel; class ShelfIconObserver; +class ShelfModel; class ShelfWidget; class ASH_EXPORT Launcher { public: static const char kNativeViewName[]; - Launcher(LauncherModel* launcher_model, + Launcher(ShelfModel* shelf_model, LauncherDelegate* launcher_delegate, ShelfWidget* shelf_widget); virtual ~Launcher(); diff --git a/ash/launcher/launcher_item_delegate_manager.cc b/ash/launcher/launcher_item_delegate_manager.cc index ecc821c..efd8857 100644 --- a/ash/launcher/launcher_item_delegate_manager.cc +++ b/ash/launcher/launcher_item_delegate_manager.cc @@ -5,15 +5,15 @@ #include "ash/launcher/launcher_item_delegate_manager.h" #include "ash/launcher/launcher_item_delegate.h" -#include "ash/launcher/launcher_model.h" +#include "ash/shelf/shelf_model.h" #include "ash/shell.h" #include "base/logging.h" #include "base/stl_util.h" namespace ash { -LauncherItemDelegateManager::LauncherItemDelegateManager( - ash::LauncherModel* model) : model_(model) { +LauncherItemDelegateManager::LauncherItemDelegateManager(ShelfModel* model) + : model_(model) { DCHECK(model_); model_->AddObserver(this); } diff --git a/ash/launcher/launcher_item_delegate_manager.h b/ash/launcher/launcher_item_delegate_manager.h index a04e1e0..7ae9abb 100644 --- a/ash/launcher/launcher_item_delegate_manager.h +++ b/ash/launcher/launcher_item_delegate_manager.h @@ -15,7 +15,7 @@ namespace ash { class LauncherItemDelegate; -class LauncherModel; +class ShelfModel; namespace test { class LauncherItemDelegateManagerTestAPI; @@ -28,7 +28,7 @@ class LauncherItemDelegateManagerTestAPI; // LauncherItemDelegates when the corresponding item from the model is removed. class ASH_EXPORT LauncherItemDelegateManager : public ShelfModelObserver { public: - explicit LauncherItemDelegateManager(ash::LauncherModel* model); + explicit LauncherItemDelegateManager(ShelfModel* model); virtual ~LauncherItemDelegateManager(); // Set |item_delegate| for |id| and take an ownership. @@ -58,7 +58,7 @@ class ASH_EXPORT LauncherItemDelegateManager : public ShelfModelObserver { // Clear all exsiting LauncherItemDelegate for test. // Not owned by LauncherItemDelegate. - ash::LauncherModel* model_; + ShelfModel* model_; LauncherIDToItemDelegateMap id_to_item_delegate_map_; diff --git a/ash/launcher/launcher_unittest.cc b/ash/launcher/launcher_unittest.cc index 3e72f6d..32dafb6 100644 --- a/ash/launcher/launcher_unittest.cc +++ b/ash/launcher/launcher_unittest.cc @@ -5,7 +5,7 @@ #include "ash/launcher/launcher.h" #include "ash/launcher/launcher_button.h" #include "ash/launcher/launcher_item_delegate_manager.h" -#include "ash/launcher/launcher_model.h" +#include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_view.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" @@ -35,7 +35,7 @@ class LauncherTest : public ash::test::AshTestBase { public: LauncherTest() : launcher_(NULL), shelf_view_(NULL), - launcher_model_(NULL), + shelf_model_(NULL), item_delegate_manager_(NULL) { } @@ -49,7 +49,7 @@ class LauncherTest : public ash::test::AshTestBase { ash::test::LauncherTestAPI test(launcher_); shelf_view_ = test.shelf_view(); - launcher_model_ = shelf_view_->model(); + shelf_model_ = shelf_view_->model(); item_delegate_manager_ = Shell::GetInstance()->launcher_item_delegate_manager(); @@ -68,8 +68,8 @@ class LauncherTest : public ash::test::AshTestBase { return shelf_view_; } - LauncherModel* launcher_model() { - return launcher_model_; + ShelfModel* shelf_model() { + return shelf_model_; } LauncherItemDelegateManager* item_manager() { @@ -83,7 +83,7 @@ class LauncherTest : public ash::test::AshTestBase { private: Launcher* launcher_; ShelfView* shelf_view_; - LauncherModel* launcher_model_; + ShelfModel* shelf_model_; LauncherItemDelegateManager* item_delegate_manager_; scoped_ptr<ash::test::ShelfViewTestAPI> test_; @@ -99,13 +99,13 @@ TEST_F(LauncherTest, StatusReflection) { LauncherItem item; item.type = TYPE_PLATFORM_APP; item.status = STATUS_RUNNING; - int index = launcher_model()->Add(item); + int index = shelf_model()->Add(item); ASSERT_EQ(++button_count, test_api()->GetButtonCount()); LauncherButton* button = test_api()->GetButton(index); EXPECT_EQ(LauncherButton::STATE_RUNNING, button->state()); // Remove it. - launcher_model()->RemoveItemAt(index); + shelf_model()->RemoveItemAt(index); ASSERT_EQ(--button_count, test_api()->GetButtonCount()); } @@ -119,11 +119,11 @@ TEST_F(LauncherTest, checkHoverAfterMenu) { LauncherItem item; item.type = TYPE_PLATFORM_APP; item.status = STATUS_RUNNING; - int index = launcher_model()->Add(item); + int index = shelf_model()->Add(item); scoped_ptr<LauncherItemDelegate> delegate( new ash::test::TestLauncherItemDelegate(NULL)); - item_manager()->SetLauncherItemDelegate(launcher_model()->items()[index].id, + item_manager()->SetLauncherItemDelegate(shelf_model()->items()[index].id, delegate.Pass()); ASSERT_EQ(++button_count, test_api()->GetButtonCount()); @@ -133,11 +133,11 @@ TEST_F(LauncherTest, checkHoverAfterMenu) { EXPECT_FALSE(button->state() & LauncherButton::STATE_HOVERED); // Remove it. - launcher_model()->RemoveItemAt(index); + shelf_model()->RemoveItemAt(index); } TEST_F(LauncherTest, ShowOverflowBubble) { - LauncherID first_item_id = launcher_model()->next_id(); + LauncherID first_item_id = shelf_model()->next_id(); // Add platform app button until overflow. int items_added = 0; @@ -145,7 +145,7 @@ TEST_F(LauncherTest, ShowOverflowBubble) { LauncherItem item; item.type = TYPE_PLATFORM_APP; item.status = STATUS_RUNNING; - launcher_model()->Add(item); + shelf_model()->Add(item); ++items_added; ASSERT_LT(items_added, 10000); @@ -156,8 +156,7 @@ TEST_F(LauncherTest, ShowOverflowBubble) { EXPECT_TRUE(launcher()->IsShowingOverflowBubble()); // Removes the first item in main shelf view. - launcher_model()->RemoveItemAt( - launcher_model()->ItemIndexByID(first_item_id)); + shelf_model()->RemoveItemAt(shelf_model()->ItemIndexByID(first_item_id)); // Waits for all transitions to finish and there should be no crash. test_api()->RunMessageLoopUntilAnimationsDone(); diff --git a/ash/shelf/app_list_shelf_item_delegate.cc b/ash/shelf/app_list_shelf_item_delegate.cc index affa767..b9fd49d 100644 --- a/ash/shelf/app_list_shelf_item_delegate.cc +++ b/ash/shelf/app_list_shelf_item_delegate.cc @@ -4,7 +4,7 @@ #include "ash/shelf/app_list_shelf_item_delegate.h" -#include "ash/launcher/launcher_model.h" +#include "ash/shelf/shelf_model.h" #include "ash/shell.h" #include "grit/ash_strings.h" #include "ui/base/l10n/l10n_util.h" @@ -15,7 +15,7 @@ namespace internal { AppListShelfItemDelegate::AppListShelfItemDelegate() { LauncherItem app_list; app_list.type = TYPE_APP_LIST; - Shell::GetInstance()->launcher_model()->Add(app_list); + Shell::GetInstance()->shelf_model()->Add(app_list); } AppListShelfItemDelegate::~AppListShelfItemDelegate() { @@ -29,9 +29,9 @@ bool AppListShelfItemDelegate::ItemSelected(const ui::Event& event) { } base::string16 AppListShelfItemDelegate::GetTitle() { - LauncherModel* model = Shell::GetInstance()->launcher_model(); + ShelfModel* model = Shell::GetInstance()->shelf_model(); DCHECK(model); - return model->status() == LauncherModel::STATUS_LOADING ? + return model->status() == ShelfModel::STATUS_LOADING ? l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_SYNCING_TITLE) : l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE); } diff --git a/ash/shelf/overflow_bubble.h b/ash/shelf/overflow_bubble.h index ad4d11f..7dc63d1 100644 --- a/ash/shelf/overflow_bubble.h +++ b/ash/shelf/overflow_bubble.h @@ -20,9 +20,6 @@ class View; namespace ash { -class LauncherDelegate; -class LauncherModel; - namespace internal { class ShelfView; diff --git a/ash/shelf/overflow_button.h b/ash/shelf/overflow_button.h index 7b6e400..9e73505 100644 --- a/ash/shelf/overflow_button.h +++ b/ash/shelf/overflow_button.h @@ -14,7 +14,7 @@ namespace ash { namespace internal { -// Launcher overflow chevron button. +// Shelf overflow chevron button. class OverflowButton : public views::CustomButton { public: explicit OverflowButton(views::ButtonListener* listener); diff --git a/ash/launcher/launcher_model.cc b/ash/shelf/shelf_model.cc index a8c206393..b108a21 100644 --- a/ash/launcher/launcher_model.cc +++ b/ash/shelf/shelf_model.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/launcher/launcher_model.h" +#include "ash/shelf/shelf_model.h" #include <algorithm> @@ -60,17 +60,17 @@ bool CompareByWeight(const LauncherItem& a, const LauncherItem& b) { } // namespace -LauncherModel::LauncherModel() : next_id_(1), status_(STATUS_NORMAL) { +ShelfModel::ShelfModel() : next_id_(1), status_(STATUS_NORMAL) { } -LauncherModel::~LauncherModel() { +ShelfModel::~ShelfModel() { } -int LauncherModel::Add(const LauncherItem& item) { +int ShelfModel::Add(const LauncherItem& item) { return AddAt(items_.size(), item); } -int LauncherModel::AddAt(int index, const LauncherItem& item) { +int ShelfModel::AddAt(int index, const LauncherItem& item) { index = ValidateInsertionIndex(item.type, index); items_.insert(items_.begin() + index, item); items_[index].id = next_id_++; @@ -78,7 +78,7 @@ int LauncherModel::AddAt(int index, const LauncherItem& item) { return index; } -void LauncherModel::RemoveItemAt(int index) { +void ShelfModel::RemoveItemAt(int index) { DCHECK(index >= 0 && index < item_count()); // The app list and browser shortcut can't be removed. DCHECK(items_[index].type != TYPE_APP_LIST && @@ -89,7 +89,7 @@ void LauncherModel::RemoveItemAt(int index) { ShelfItemRemoved(index, id)); } -void LauncherModel::Move(int index, int target_index) { +void ShelfModel::Move(int index, int target_index) { if (index == target_index) return; // TODO: this needs to enforce valid ranges. @@ -100,7 +100,7 @@ void LauncherModel::Move(int index, int target_index) { ShelfItemMoved(index, target_index)); } -void LauncherModel::Set(int index, const LauncherItem& item) { +void ShelfModel::Set(int index, const LauncherItem& item) { DCHECK(index >= 0 && index < item_count()); int new_index = item.type == items_[index].type ? index : ValidateInsertionIndex(item.type, index); @@ -126,12 +126,12 @@ void LauncherModel::Set(int index, const LauncherItem& item) { } } -int LauncherModel::ItemIndexByID(LauncherID id) const { +int ShelfModel::ItemIndexByID(LauncherID id) const { LauncherItems::const_iterator i = ItemByID(id); return i == items_.end() ? -1 : static_cast<int>(i - items_.begin()); } -LauncherItems::const_iterator LauncherModel::ItemByID(int id) const { +LauncherItems::const_iterator ShelfModel::ItemByID(int id) const { for (LauncherItems::const_iterator i = items_.begin(); i != items_.end(); ++i) { if (i->id == id) @@ -140,14 +140,14 @@ LauncherItems::const_iterator LauncherModel::ItemByID(int id) const { return items_.end(); } -int LauncherModel::FirstPanelIndex() const { +int ShelfModel::FirstPanelIndex() const { LauncherItem weight_dummy; weight_dummy.type = TYPE_APP_PANEL; return std::lower_bound(items_.begin(), items_.end(), weight_dummy, CompareByWeight) - items_.begin(); } -void LauncherModel::SetStatus(Status status) { +void ShelfModel::SetStatus(Status status) { if (status_ == status) return; @@ -155,16 +155,15 @@ void LauncherModel::SetStatus(Status status) { FOR_EACH_OBSERVER(ShelfModelObserver, observers_, ShelfStatusChanged()); } -void LauncherModel::AddObserver(ShelfModelObserver* observer) { +void ShelfModel::AddObserver(ShelfModelObserver* observer) { observers_.AddObserver(observer); } -void LauncherModel::RemoveObserver(ShelfModelObserver* observer) { +void ShelfModel::RemoveObserver(ShelfModelObserver* observer) { observers_.RemoveObserver(observer); } -int LauncherModel::ValidateInsertionIndex(LauncherItemType type, - int index) const { +int ShelfModel::ValidateInsertionIndex(LauncherItemType type, int index) const { DCHECK(index >= 0 && index <= item_count() + (ash::switches::UseAlternateShelfLayout() ? 1 : 0)); diff --git a/ash/launcher/launcher_model.h b/ash/shelf/shelf_model.h index 2845fb0..58e931a 100644 --- a/ash/launcher/launcher_model.h +++ b/ash/shelf/shelf_model.h @@ -1,9 +1,9 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ASH_LAUNCHER_LAUNCHER_MODEL_H_ -#define ASH_LAUNCHER_LAUNCHER_MODEL_H_ +#ifndef ASH_SHELF_SHELF_MODEL_H_ +#define ASH_SHELF_SHELF_MODEL_H_ #include "ash/ash_export.h" #include "ash/launcher/launcher_types.h" @@ -15,7 +15,7 @@ namespace ash { class ShelfModelObserver; // Model used by ShelfView. -class ASH_EXPORT LauncherModel { +class ASH_EXPORT ShelfModel { public: enum Status { STATUS_NORMAL, @@ -23,8 +23,8 @@ class ASH_EXPORT LauncherModel { STATUS_LOADING, }; - LauncherModel(); - ~LauncherModel(); + ShelfModel(); + ~ShelfModel(); // Adds a new item to the model. Returns the resulting index. int Add(const LauncherItem& item); @@ -54,7 +54,7 @@ class ASH_EXPORT LauncherModel { // Returns the id assigned to the next item added. LauncherID next_id() const { return next_id_; } - // Returns a reserved id which will not be used by the |LauncherModel|. + // Returns a reserved id which will not be used by the |ShelfModel|. LauncherID reserve_external_id() { return next_id_++; } // Returns an iterator into items() for the item with the specified id, or @@ -83,9 +83,9 @@ class ASH_EXPORT LauncherModel { Status status_; ObserverList<ShelfModelObserver> observers_; - DISALLOW_COPY_AND_ASSIGN(LauncherModel); + DISALLOW_COPY_AND_ASSIGN(ShelfModel); }; } // namespace ash -#endif // ASH_LAUNCHER_LAUNCHER_MODEL_H_ +#endif // ASH_SHELF_SHELF_MODEL_H_ diff --git a/ash/shelf/shelf_model_observer.h b/ash/shelf/shelf_model_observer.h index 46df44e..6d9f21f 100644 --- a/ash/shelf/shelf_model_observer.h +++ b/ash/shelf/shelf_model_observer.h @@ -21,7 +21,7 @@ class ASH_EXPORT ShelfModelObserver { // at. virtual void ShelfItemRemoved(int index, LauncherID id) = 0; - // Invoked after an item has been moved. See LauncherModel::Move() for details + // Invoked after an item has been moved. See ShelfModel::Move() for details // of the arguments. virtual void ShelfItemMoved(int start_index, int target_index) = 0; diff --git a/ash/launcher/launcher_model_unittest.cc b/ash/shelf/shelf_model_unittest.cc index b22dee9..be30167 100644 --- a/ash/launcher/launcher_model_unittest.cc +++ b/ash/shelf/shelf_model_unittest.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/launcher/launcher_model.h" +#include "ash/shelf/shelf_model.h" #include <set> #include <string> @@ -75,13 +75,13 @@ class TestShelfModelObserver : public ShelfModelObserver { } // namespace -class LauncherModelTest : public testing::Test { +class ShelfModelTest : public testing::Test { public: - LauncherModelTest() {} - virtual ~LauncherModelTest() {} + ShelfModelTest() {} + virtual ~ShelfModelTest() {} virtual void SetUp() { - model_.reset(new LauncherModel); + model_.reset(new ShelfModel); observer_.reset(new TestShelfModelObserver); EXPECT_EQ(0, model_->item_count()); @@ -98,14 +98,14 @@ class LauncherModelTest : public testing::Test { model_.reset(); } - scoped_ptr<LauncherModel> model_; + scoped_ptr<ShelfModel> model_; scoped_ptr<TestShelfModelObserver> observer_; private: - DISALLOW_COPY_AND_ASSIGN(LauncherModelTest); + DISALLOW_COPY_AND_ASSIGN(ShelfModelTest); }; -TEST_F(LauncherModelTest, BasicAssertions) { +TEST_F(ShelfModelTest, BasicAssertions) { // Add an item. LauncherItem item; item.type = TYPE_APP_SHORTCUT; @@ -157,7 +157,7 @@ TEST_F(LauncherModelTest, BasicAssertions) { } // Assertions around where items are added. -TEST_F(LauncherModelTest, AddIndices) { +TEST_F(ShelfModelTest, AddIndices) { // Insert browser short cut at index 1. LauncherItem browser_shortcut; browser_shortcut.type = TYPE_BROWSER_SHORTCUT; @@ -237,7 +237,7 @@ TEST_F(LauncherModelTest, AddIndices) { } // Assertions around where items are added. -TEST_F(LauncherModelTest, AddIndicesForLegacyShelfLayout) { +TEST_F(ShelfModelTest, AddIndicesForLegacyShelfLayout) { CommandLine::ForCurrentProcess()->AppendSwitch( ash::switches::kAshDisableAlternateShelfLayout); @@ -320,7 +320,7 @@ TEST_F(LauncherModelTest, AddIndicesForLegacyShelfLayout) { } // Assertions around id generation and usage. -TEST_F(LauncherModelTest, LauncherIDTests) { +TEST_F(ShelfModelTest, LauncherIDTests) { // Get the next to use ID counter. LauncherID id = model_->next_id(); @@ -345,7 +345,7 @@ TEST_F(LauncherModelTest, LauncherIDTests) { // This verifies that converting an existing item into a lower weight category // (e.g. shortcut to running but not pinned app) will move it to the proper // location. See crbug.com/248769. -TEST_F(LauncherModelTest, CorrectMoveItemsWhenStateChange) { +TEST_F(ShelfModelTest, CorrectMoveItemsWhenStateChange) { // The first item is the app list and last item is the browser. LauncherItem browser_shortcut; browser_shortcut.type = TYPE_BROWSER_SHORTCUT; @@ -372,7 +372,7 @@ TEST_F(LauncherModelTest, CorrectMoveItemsWhenStateChange) { EXPECT_EQ(TYPE_PLATFORM_APP, model_->items()[4].type); } -TEST_F(LauncherModelTest, CorrectMoveItemsWhenStateChangeForLegacyShelfLayout) { +TEST_F(ShelfModelTest, CorrectMoveItemsWhenStateChangeForLegacyShelfLayout) { CommandLine::ForCurrentProcess()->AppendSwitch( ash::switches::kAshDisableAlternateShelfLayout); diff --git a/ash/shelf/shelf_model_util.cc b/ash/shelf/shelf_model_util.cc index c4debdc..e1fe827 100644 --- a/ash/shelf/shelf_model_util.cc +++ b/ash/shelf/shelf_model_util.cc @@ -4,14 +4,14 @@ #include "ash/shelf/shelf_model_util.h" -#include "ash/launcher/launcher_model.h" +#include "ash/shelf/shelf_model.h" namespace ash { int GetShelfItemIndexForType(LauncherItemType type, - const LauncherModel& launcher_model) { - for (size_t i = 0; i < launcher_model.items().size(); i++) { - if (launcher_model.items()[i].type == type) + const ShelfModel& shelf_model) { + for (size_t i = 0; i < shelf_model.items().size(); i++) { + if (shelf_model.items()[i].type == type) return i; } return -1; diff --git a/ash/shelf/shelf_model_util.h b/ash/shelf/shelf_model_util.h index 15433ee..4aa94d9 100644 --- a/ash/shelf/shelf_model_util.h +++ b/ash/shelf/shelf_model_util.h @@ -10,15 +10,15 @@ namespace ash { -class LauncherModel; +class ShelfModel; -// Return the index of the |type| from a given |launcher_model|. +// Return the index of the |type| from a given |shelf_model|. // Note: -// * If there are many items for |type| in the |launcher_model|, an index of +// * If there are many items for |type| in the |shelf_model|, an index of // first item will be returned. // * If there is no item for |type|, -1 will be returned. ASH_EXPORT int GetShelfItemIndexForType(LauncherItemType type, - const LauncherModel& launcher_model); + const ShelfModel& shelf_model); } // namespace ash diff --git a/ash/shelf/shelf_navigator.cc b/ash/shelf/shelf_navigator.cc index a6ce50e..0dc5dfd 100644 --- a/ash/shelf/shelf_navigator.cc +++ b/ash/shelf/shelf_navigator.cc @@ -4,7 +4,7 @@ #include "ash/shelf/shelf_navigator.h" -#include "ash/launcher/launcher_model.h" +#include "ash/shelf/shelf_model.h" namespace ash { @@ -21,7 +21,7 @@ bool ShouldSkip(ash::LauncherItemType type) { } // namespace -int GetNextActivatedItemIndex(const LauncherModel& model, +int GetNextActivatedItemIndex(const ShelfModel& model, CycleDirection direction) { const ash::LauncherItems& items = model.items(); int item_count = model.item_count(); diff --git a/ash/shelf/shelf_navigator.h b/ash/shelf/shelf_navigator.h index 03bc155..b8ecfb3 100644 --- a/ash/shelf/shelf_navigator.h +++ b/ash/shelf/shelf_navigator.h @@ -10,12 +10,12 @@ namespace ash { -class LauncherModel; +class ShelfModel; // Scans the current shelf item and returns the index of the shelf item which // should be activated next for the specified |direction|. Returns -1 if fails // to find such item. -ASH_EXPORT int GetNextActivatedItemIndex(const LauncherModel& model, +ASH_EXPORT int GetNextActivatedItemIndex(const ShelfModel& model, CycleDirection direction); } // namespace ash diff --git a/ash/shelf/shelf_navigator_unittest.cc b/ash/shelf/shelf_navigator_unittest.cc index 4c8bf1e..c4f392d 100644 --- a/ash/shelf/shelf_navigator_unittest.cc +++ b/ash/shelf/shelf_navigator_unittest.cc @@ -6,8 +6,8 @@ #include "ash/ash_switches.h" #include "ash/launcher/launcher.h" -#include "ash/launcher/launcher_model.h" #include "ash/launcher/launcher_types.h" +#include "ash/shelf/shelf_model.h" #include "base/command_line.h" #include "base/compiler_specific.h" #include "testing/gtest/include/gtest/gtest.h" @@ -22,7 +22,7 @@ class LauncherNavigatorTest : public testing::Test { protected: virtual void SetUp() OVERRIDE { - model_.reset(new LauncherModel); + model_.reset(new ShelfModel); // Add APP_LIST for test. LauncherItem app_list; @@ -40,7 +40,7 @@ class LauncherNavigatorTest : public testing::Test { model_->Add(browser_shortcut); } - void SetupMockLauncherModel(LauncherItemType* types, + void SetupMockShelfModel(LauncherItemType* types, int types_length, int focused_index) { for (int i = 0; i < types_length; ++i) { @@ -61,10 +61,10 @@ class LauncherNavigatorTest : public testing::Test { } } - const LauncherModel& model() { return *model_.get(); } + const ShelfModel& model() { return *model_.get(); } private: - scoped_ptr<LauncherModel> model_; + scoped_ptr<ShelfModel> model_; DISALLOW_COPY_AND_ASSIGN(LauncherNavigatorTest); }; @@ -91,9 +91,9 @@ TEST_F(LauncherNavigatorTest, BasicCycle) { LauncherItemType types[] = { TYPE_APP_SHORTCUT, TYPE_PLATFORM_APP, TYPE_PLATFORM_APP, TYPE_PLATFORM_APP, }; - // LauncherModel automatically adds BROWSER_SHORTCUT item at the + // ShelfModel automatically adds BROWSER_SHORTCUT item at the // beginning, so '3' refers the first TYPE_PLATFORM_APP item. - SetupMockLauncherModel(types, arraysize(types), 3); + SetupMockShelfModel(types, arraysize(types), 3); EXPECT_EQ(4, GetNextActivatedItemIndex(model(), CYCLE_FORWARD)); @@ -107,9 +107,9 @@ TEST_F(LauncherNavigatorLegacyShelfLayoutTest, BasicCycle) { LauncherItemType types[] = { TYPE_APP_SHORTCUT, TYPE_PLATFORM_APP, TYPE_PLATFORM_APP, TYPE_PLATFORM_APP, }; - // LauncherModel automatically adds BROWSER_SHORTCUT item at the + // ShelfModel automatically adds BROWSER_SHORTCUT item at the // beginning, so '2' refers the first TYPE_PLATFORM_APP item. - SetupMockLauncherModel(types, arraysize(types), 2); + SetupMockShelfModel(types, arraysize(types), 2); EXPECT_EQ(3, GetNextActivatedItemIndex(model(), CYCLE_FORWARD)); @@ -122,7 +122,7 @@ TEST_F(LauncherNavigatorTest, WrapToBeginning) { LauncherItemType types[] = { TYPE_APP_SHORTCUT, TYPE_PLATFORM_APP, TYPE_PLATFORM_APP, TYPE_PLATFORM_APP, }; - SetupMockLauncherModel(types, arraysize(types), 5); + SetupMockShelfModel(types, arraysize(types), 5); // Second one. It skips the APP_LIST item at the end of the list, // wraps to the beginning, and skips BROWSER_SHORTCUT and APP_SHORTCUT @@ -134,7 +134,7 @@ TEST_F(LauncherNavigatorLegacyShelfLayoutTest, WrapToBeginning) { LauncherItemType types[] = { TYPE_APP_SHORTCUT, TYPE_PLATFORM_APP, TYPE_PLATFORM_APP, TYPE_PLATFORM_APP, }; - SetupMockLauncherModel(types, arraysize(types), 4); + SetupMockShelfModel(types, arraysize(types), 4); // Second one. It skips the APP_LIST item at the end of the list, // wraps to the beginning, and skips BROWSER_SHORTCUT and APP_SHORTCUT @@ -143,14 +143,14 @@ TEST_F(LauncherNavigatorLegacyShelfLayoutTest, WrapToBeginning) { } TEST_F(LauncherNavigatorTest, Empty) { - SetupMockLauncherModel(NULL, 0, -1); + SetupMockShelfModel(NULL, 0, -1); EXPECT_EQ(-1, GetNextActivatedItemIndex(model(), CYCLE_FORWARD)); EXPECT_EQ(-1, GetNextActivatedItemIndex(model(), CYCLE_BACKWARD)); } TEST_F(LauncherNavigatorTest, SingleEntry) { LauncherItemType type = TYPE_PLATFORM_APP; - SetupMockLauncherModel(&type, 1, 2); + SetupMockShelfModel(&type, 1, 2); // If there's only one item there and it is already active, there's no item // to be activated next. @@ -160,7 +160,7 @@ TEST_F(LauncherNavigatorTest, SingleEntry) { TEST_F(LauncherNavigatorLegacyShelfLayoutTest, SingleEntry) { LauncherItemType type = TYPE_PLATFORM_APP; - SetupMockLauncherModel(&type, 1, 1); + SetupMockShelfModel(&type, 1, 1); // If there's only one item there and it is already active, there's no item // to be activated next. @@ -173,7 +173,7 @@ TEST_F(LauncherNavigatorTest, NoActive) { TYPE_PLATFORM_APP, TYPE_PLATFORM_APP, }; // Special case: no items are 'STATUS_ACTIVE'. - SetupMockLauncherModel(types, arraysize(types), -1); + SetupMockShelfModel(types, arraysize(types), -1); // If there are no active status, pick the first running item as a fallback. EXPECT_EQ(2, GetNextActivatedItemIndex(model(), CYCLE_FORWARD)); @@ -185,7 +185,7 @@ TEST_F(LauncherNavigatorLegacyShelfLayoutTest, NoActive) { TYPE_PLATFORM_APP, TYPE_PLATFORM_APP, }; // Special case: no items are 'STATUS_ACTIVE'. - SetupMockLauncherModel(types, arraysize(types), -1); + SetupMockShelfModel(types, arraysize(types), -1); // If there are no active status, pick the first running item as a fallback. EXPECT_EQ(1, GetNextActivatedItemIndex(model(), CYCLE_FORWARD)); diff --git a/ash/shelf/shelf_tooltip_manager.cc b/ash/shelf/shelf_tooltip_manager.cc index 10ea4a6..8e5b780 100644 --- a/ash/shelf/shelf_tooltip_manager.cc +++ b/ash/shelf/shelf_tooltip_manager.cc @@ -80,7 +80,7 @@ ShelfTooltipManager::ShelfTooltipBubble::ShelfTooltipBubble( kArrowOffsetLeftRight, kArrowOffsetTopBottom, kArrowOffsetLeftRight); - // Launcher items can have an asymmetrical border for spacing reasons. + // Shelf items can have an asymmetrical border for spacing reasons. // Adjust anchor location for this. if (anchor->border()) insets += anchor->border()->GetInsets(); diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc index 811dd71..d13f70c 100644 --- a/ash/shelf/shelf_view.cc +++ b/ash/shelf/shelf_view.cc @@ -13,7 +13,6 @@ #include "ash/launcher/launcher_delegate.h" #include "ash/launcher/launcher_item_delegate.h" #include "ash/launcher/launcher_item_delegate_manager.h" -#include "ash/launcher/launcher_model.h" #include "ash/root_window_controller.h" #include "ash/scoped_target_root_window.h" #include "ash/shelf/alternate_app_list_button.h" @@ -22,6 +21,7 @@ #include "ash/shelf/overflow_button.h" #include "ash/shelf/shelf_icon_observer.h" #include "ash/shelf/shelf_layout_manager.h" +#include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_tooltip_manager.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell_delegate.h" @@ -375,7 +375,7 @@ class ShelfView::StartFadeAnimationDelegate DISALLOW_COPY_AND_ASSIGN(StartFadeAnimationDelegate); }; -ShelfView::ShelfView(LauncherModel* model, +ShelfView::ShelfView(ShelfModel* model, LauncherDelegate* delegate, ShelfLayoutManager* shelf_layout_manager) : model_(model), @@ -444,7 +444,7 @@ void ShelfView::OnShelfAlignmentChanged() { overflow_button_->OnShelfAlignmentChanged(); LayoutToIdealBounds(); for (int i=0; i < view_model_->view_size(); ++i) { - // TODO: remove when AppIcon is a Launcher Button. + // TODO: remove when AppIcon is a Shelf Button. if (TYPE_APP_LIST == model_->items()[i].type && !ash::switches::UseAlternateShelfLayout()) { static_cast<AppListButton*>(view_model_->view_at(i))->SetImageAlignment( @@ -1466,7 +1466,7 @@ void ShelfView::ShelfItemRemoved(int model_index, LauncherID id) { // When the overflow bubble is visible, the overflow range needs to be set // before CalculateIdealBounds() gets called. Otherwise CalculateIdealBounds() // could trigger a LauncherItemChanged() by hiding the overflow bubble and - // since the overflow bubble is not yet synced with the LauncherModel this + // since the overflow bubble is not yet synced with the ShelfModel this // could cause a crash. if (overflow_bubble_ && overflow_bubble_->IsShowing()) { last_hidden_index_ = std::min(last_hidden_index_, @@ -1516,7 +1516,7 @@ void ShelfView::ShelfItemChanged(int model_index, views::View* view = view_model_->view_at(model_index); switch (item.type) { case TYPE_BROWSER_SHORTCUT: - // Fallthrough for the new Launcher since it needs to show the activation + // Fallthrough for the new Shelf since it needs to show the activation // change as well. case TYPE_APP_SHORTCUT: case TYPE_WINDOWED_APP: @@ -1552,7 +1552,7 @@ void ShelfView::ShelfStatusChanged() { return; AppListButton* app_list_button = static_cast<AppListButton*>(GetAppListButtonView()); - if (model_->status() == LauncherModel::STATUS_LOADING) + if (model_->status() == ShelfModel::STATUS_LOADING) app_list_button->StartLoadingAnimation(); else app_list_button->StopLoadingAnimation(); @@ -1792,7 +1792,7 @@ void ShelfView::ShowMenu(scoped_ptr<views::MenuModelAdapter> menu_model_adapter, anchor_point.set_x(anchor_point.x() - offset.x()); anchor_point.set_y(anchor_point.y() - offset.y()); - // Launcher items can have an asymmetrical border for spacing reasons. + // Shelf items can have an asymmetrical border for spacing reasons. // Adjust anchor location for this. if (source->border()) anchor_point.Inset(source->border()->GetInsets()); diff --git a/ash/shelf/shelf_view.h b/ash/shelf/shelf_view.h index 250ba3b..852e403 100644 --- a/ash/shelf/shelf_view.h +++ b/ash/shelf/shelf_view.h @@ -35,8 +35,8 @@ class ShelfViewTestAPI; class LauncherDelegate; struct LauncherItem; class LauncherItemDelegateManager; -class LauncherModel; class ShelfIconObserver; +class ShelfModel; namespace internal { @@ -56,7 +56,7 @@ class ASH_EXPORT ShelfView : public views::View, public views::BoundsAnimatorObserver, public app_list::ApplicationDragAndDropHost { public: - ShelfView(LauncherModel* model, + ShelfView(ShelfModel* model, LauncherDelegate* delegate, ShelfLayoutManager* shelf_layout_manager); virtual ~ShelfView(); @@ -65,7 +65,7 @@ class ASH_EXPORT ShelfView : public views::View, ShelfLayoutManager* shelf_layout_manager() { return layout_manager_; } - LauncherModel* model() { return model_; } + ShelfModel* model() { return model_; } void Init(); @@ -318,7 +318,7 @@ class ASH_EXPORT ShelfView : public views::View, int CalculateShelfDistance(const gfx::Point& coordinate) const; // The model; owned by Launcher. - LauncherModel* model_; + ShelfModel* model_; // Delegate; owned by Launcher. LauncherDelegate* delegate_; diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc index d4c456a..f63b24c 100644 --- a/ash/shelf/shelf_view_unittest.cc +++ b/ash/shelf/shelf_view_unittest.cc @@ -11,12 +11,12 @@ #include "ash/launcher/launcher.h" #include "ash/launcher/launcher_button.h" #include "ash/launcher/launcher_item_delegate_manager.h" -#include "ash/launcher/launcher_model.h" #include "ash/launcher/launcher_types.h" #include "ash/root_window_controller.h" #include "ash/shelf/overflow_bubble.h" #include "ash/shelf/shelf_icon_observer.h" #include "ash/shelf/shelf_layout_manager.h" +#include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_tooltip_manager.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" @@ -202,7 +202,7 @@ TEST_F(ShelfViewIconObserverTest, BoundsChanged) { // pinned. class TestLauncherDelegateForShelfView : public TestLauncherDelegate { public: - explicit TestLauncherDelegateForShelfView(LauncherModel* model) + explicit TestLauncherDelegateForShelfView(ShelfModel* model) : TestLauncherDelegate(model) {} virtual ~TestLauncherDelegateForShelfView() {} @@ -225,7 +225,7 @@ class ShelfViewTest : public AshTestBase { virtual void SetUp() OVERRIDE { AshTestBase::SetUp(); test::ShellTestApi test_api(Shell::GetInstance()); - model_ = test_api.launcher_model(); + model_ = test_api.shelf_model(); Launcher* launcher = Launcher::ForPrimaryDisplay(); shelf_view_ = test::LauncherTestAPI(launcher).shelf_view(); @@ -421,7 +421,7 @@ class ShelfViewTest : public AshTestBase { shelf_view_->tooltip_manager()->ShowInternal(); } - LauncherModel* model_; + ShelfModel* model_; internal::ShelfView* shelf_view_; int browser_index_; LauncherItemDelegateManager* item_manager_; diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc index 42204a7..8dc737a 100644 --- a/ash/shelf/shelf_widget.cc +++ b/ash/shelf/shelf_widget.cc @@ -7,10 +7,10 @@ #include "ash/ash_switches.h" #include "ash/focus_cycler.h" #include "ash/launcher/launcher_delegate.h" -#include "ash/launcher/launcher_model.h" #include "ash/root_window_controller.h" #include "ash/session_state_delegate.h" #include "ash/shelf/shelf_layout_manager.h" +#include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_navigator.h" #include "ash/shelf/shelf_view.h" #include "ash/shelf/shelf_widget.h" @@ -604,12 +604,12 @@ void ShelfWidget::CreateLauncher() { return; Shell* shell = Shell::GetInstance(); - // This needs to be called before launcher_model(). + // This needs to be called before shelf_model(). LauncherDelegate* launcher_delegate = shell->GetLauncherDelegate(); if (!launcher_delegate) return; // Not ready to create Launcher - launcher_.reset(new Launcher(shell->launcher_model(), + launcher_.reset(new Launcher(shell->shelf_model(), shell->GetLauncherDelegate(), this)); SetFocusCycler(shell->focus_cycler()); diff --git a/ash/shelf/shelf_widget_unittest.cc b/ash/shelf/shelf_widget_unittest.cc index c9f17c9..a0fd9ca 100644 --- a/ash/shelf/shelf_widget_unittest.cc +++ b/ash/shelf/shelf_widget_unittest.cc @@ -6,9 +6,9 @@ #include "ash/launcher/launcher.h" #include "ash/launcher/launcher_button.h" -#include "ash/launcher/launcher_model.h" #include "ash/root_window_controller.h" #include "ash/shelf/shelf_layout_manager.h" +#include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_view.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" @@ -38,7 +38,7 @@ internal::ShelfLayoutManager* GetShelfLayoutManager() { typedef test::AshTestBase ShelfWidgetTest; -// Launcher can't be activated on mouse click, but it is activable from +// Shelf can't be activated on mouse click, but it is activable from // the focus cycler or as fallback. // TODO(mtomasz): make this test work with the FocusController. // crbug.com/285364. diff --git a/ash/shell.cc b/ash/shell.cc index 4eff38c..600c77e 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -32,7 +32,6 @@ #include "ash/launcher/launcher_delegate.h" #include "ash/launcher/launcher_item_delegate.h" #include "ash/launcher/launcher_item_delegate_manager.h" -#include "ash/launcher/launcher_model.h" #include "ash/magnifier/magnification_controller.h" #include "ash/magnifier/partial_magnification_controller.h" #include "ash/media_delegate.h" @@ -42,6 +41,7 @@ #include "ash/session_state_delegate.h" #include "ash/shelf/app_list_shelf_item_delegate.h" #include "ash/shelf/shelf_layout_manager.h" +#include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_model_util.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell_delegate.h" @@ -487,22 +487,21 @@ SystemTray* Shell::GetPrimarySystemTray() { LauncherDelegate* Shell::GetLauncherDelegate() { if (!launcher_delegate_) { - launcher_model_.reset(new LauncherModel); + shelf_model_.reset(new ShelfModel); // Creates LauncherItemDelegateManager before LauncherDelegate. launcher_item_delegate_manager_.reset( - new LauncherItemDelegateManager(launcher_model_.get())); + new LauncherItemDelegateManager(shelf_model_.get())); launcher_delegate_.reset( - delegate_->CreateLauncherDelegate(launcher_model_.get())); + delegate_->CreateLauncherDelegate(shelf_model_.get())); scoped_ptr<LauncherItemDelegate> controller( new internal::AppListShelfItemDelegate); - // Finding the launcher model's location of the app list and setting its + // Finding the shelf model's location of the app list and setting its // LauncherItemDelegate. - int app_list_index = - GetShelfItemIndexForType(ash::TYPE_APP_LIST, *launcher_model_); + int app_list_index = GetShelfItemIndexForType(TYPE_APP_LIST, *shelf_model_); DCHECK_GE(app_list_index, 0); - ash::LauncherID app_list_id = launcher_model_->items()[app_list_index].id; + LauncherID app_list_id = shelf_model_->items()[app_list_index].id; DCHECK(app_list_id); launcher_item_delegate_manager_->SetLauncherItemDelegate( app_list_id, @@ -644,10 +643,10 @@ Shell::~Shell() { user_action_client_.reset(); visibility_controller_.reset(); launcher_delegate_.reset(); - // |launcher_item_delegate_manager_| observes |launcher_model_|. It must be - // destroyed before |launcher_model_| is destroyed. + // |launcher_item_delegate_manager_| observes |shelf_model_|. It must be + // destroyed before |shelf_model_| is destroyed. launcher_item_delegate_manager_.reset(); - launcher_model_.reset(); + shelf_model_.reset(); video_detector_.reset(); power_button_controller_.reset(); diff --git a/ash/shell.h b/ash/shell.h index 8d8e3bb..6bab5b1 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -87,7 +87,6 @@ class Launcher; class LauncherDelegate; class LauncherItemDelegate; class LauncherItemDelegateManager; -class LauncherModel; class LockStateController; class MagnificationController; class MediaDelegate; @@ -99,6 +98,7 @@ class PowerButtonController; class RootWindowHostFactory; class ScreenAsh; class SessionStateDelegate; +class ShelfModel; class ShellDelegate; class ShellObserver; class StickyKeys; @@ -495,8 +495,8 @@ class ASH_EXPORT Shell return root_window_host_factory_.get(); } - LauncherModel* launcher_model() { - return launcher_model_.get(); + ShelfModel* shelf_model() { + return shelf_model_.get(); } WindowPositioner* window_positioner() { @@ -592,8 +592,8 @@ class ASH_EXPORT Shell scoped_ptr<LauncherDelegate> launcher_delegate_; scoped_ptr<LauncherItemDelegateManager> launcher_item_delegate_manager_; - scoped_ptr<LauncherModel> launcher_model_; - scoped_ptr<ash::WindowPositioner> window_positioner_; + scoped_ptr<ShelfModel> shelf_model_; + scoped_ptr<WindowPositioner> window_positioner_; scoped_ptr<internal::AppListController> app_list_controller_; diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc index 8e75027..44d955f 100644 --- a/ash/shell/shell_delegate_impl.cc +++ b/ash/shell/shell_delegate_impl.cc @@ -121,8 +121,7 @@ app_list::AppListViewDelegate* ShellDelegateImpl::CreateAppListViewDelegate() { return ash::shell::CreateAppListViewDelegate(); } -ash::LauncherDelegate* ShellDelegateImpl::CreateLauncherDelegate( - ash::LauncherModel* model) { +LauncherDelegate* ShellDelegateImpl::CreateLauncherDelegate(ShelfModel* model) { launcher_delegate_ = new LauncherDelegateImpl(watcher_); return launcher_delegate_; } diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h index 74e4314..500bef2 100644 --- a/ash/shell/shell_delegate_impl.h +++ b/ash/shell/shell_delegate_impl.h @@ -45,8 +45,7 @@ class ShellDelegateImpl : public ash::ShellDelegate { CreateKeyboardControllerProxy() OVERRIDE; virtual content::BrowserContext* GetCurrentBrowserContext() OVERRIDE; virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; - virtual ash::LauncherDelegate* CreateLauncherDelegate( - ash::LauncherModel* model) OVERRIDE; + virtual LauncherDelegate* CreateLauncherDelegate(ShelfModel* model) OVERRIDE; virtual ash::SystemTrayDelegate* CreateSystemTrayDelegate() OVERRIDE; virtual ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() OVERRIDE; virtual ash::CapsLockDelegate* CreateCapsLockDelegate() OVERRIDE; diff --git a/ash/shell/window_watcher.cc b/ash/shell/window_watcher.cc index ed3b0f0..c8b198e 100644 --- a/ash/shell/window_watcher.cc +++ b/ash/shell/window_watcher.cc @@ -7,7 +7,7 @@ #include "ash/display/display_controller.h" #include "ash/launcher/launcher.h" #include "ash/launcher/launcher_item_delegate_manager.h" -#include "ash/launcher/launcher_model.h" +#include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/shell/window_watcher_launcher_item_delegate.h" @@ -106,8 +106,8 @@ void WindowWatcher::OnWindowAdded(aura::Window* new_window) { return; static int image_count = 0; - ash::LauncherModel* model = Shell::GetInstance()->launcher_model(); - ash::LauncherItem item; + ShelfModel* model = Shell::GetInstance()->shelf_model(); + LauncherItem item; item.type = new_window->type() == aura::client::WINDOW_TYPE_PANEL ? ash::TYPE_APP_PANEL : ash::TYPE_PLATFORM_APP; ash::LauncherID id = model->next_id(); @@ -136,7 +136,7 @@ void WindowWatcher::OnWillRemoveWindow(aura::Window* window) { for (IDToWindow::iterator i = id_to_window_.begin(); i != id_to_window_.end(); ++i) { if (i->second == window) { - ash::LauncherModel* model = Shell::GetInstance()->launcher_model(); + ShelfModel* model = Shell::GetInstance()->shelf_model(); int index = model->ItemIndexByID(i->first); DCHECK_NE(-1, index); model->RemoveItemAt(index); diff --git a/ash/shell/window_watcher.h b/ash/shell/window_watcher.h index 7a2c7c0..4654993 100644 --- a/ash/shell/window_watcher.h +++ b/ash/shell/window_watcher.h @@ -24,7 +24,7 @@ namespace shell { // TODO(sky): fix this class, its a bit broke with workspace2. // WindowWatcher is responsible for listening for newly created windows and -// creating items on the Launcher for them. +// creating items on the Shelf for them. class WindowWatcher : public aura::WindowObserver, public gfx::DisplayObserver { public: diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h index 5415692..61e2eb0 100644 --- a/ash/shell_delegate.h +++ b/ash/shell_delegate.h @@ -42,15 +42,15 @@ class KeyboardControllerProxy; namespace ash { +class AccessibilityDelegate; class CapsLockDelegate; class LauncherDelegate; -class LauncherModel; struct LauncherItem; class MediaDelegate; class NewWindowDelegate; class RootWindowHostFactory; -class AccessibilityDelegate; class SessionStateDelegate; +class ShelfModel; class SystemTrayDelegate; class UserWallpaperDelegate; @@ -152,8 +152,7 @@ class ASH_EXPORT ShellDelegate { // Creates a new LauncherDelegate. Shell takes ownership of the returned // value. - virtual LauncherDelegate* CreateLauncherDelegate( - ash::LauncherModel* model) = 0; + virtual LauncherDelegate* CreateLauncherDelegate(ShelfModel* model) = 0; // Creates a system-tray delegate. Shell takes ownership of the delegate. virtual SystemTrayDelegate* CreateSystemTrayDelegate() = 0; diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc index 7bd36af..5652115 100644 --- a/ash/shell_unittest.cc +++ b/ash/shell_unittest.cc @@ -395,10 +395,10 @@ TEST_F(ShellTest, ManagedWindowModeBasics) { // We start with the usual window containers. ExpectAllContainers(); - // Launcher is visible. + // Shelf is visible. ShelfWidget* launcher_widget = Launcher::ForPrimaryDisplay()->shelf_widget(); EXPECT_TRUE(launcher_widget->IsVisible()); - // Launcher is at bottom-left of screen. + // Shelf is at bottom-left of screen. EXPECT_EQ(0, launcher_widget->GetWindowBoundsInScreen().x()); EXPECT_EQ( Shell::GetPrimaryRootWindow()->GetDispatcher()->GetHostSize().height(), diff --git a/ash/test/shelf_view_test_api.cc b/ash/test/shelf_view_test_api.cc index 7f37b5c..bbbae76 100644 --- a/ash/test/shelf_view_test_api.cc +++ b/ash/test/shelf_view_test_api.cc @@ -5,8 +5,8 @@ #include "ash/test/shelf_view_test_api.h" #include "ash/launcher/launcher_button.h" -#include "ash/launcher/launcher_model.h" #include "ash/shelf/overflow_button.h" +#include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_view.h" #include "base/message_loop/message_loop.h" #include "ui/views/animation/bounds_animator.h" diff --git a/ash/test/shell_test_api.cc b/ash/test/shell_test_api.cc index c6a0f67..353a76c 100644 --- a/ash/test/shell_test_api.cc +++ b/ash/test/shell_test_api.cc @@ -45,8 +45,8 @@ AshNativeCursorManager* ShellTestApi::ash_native_cursor_manager() { return shell_->native_cursor_manager_; } -LauncherModel* ShellTestApi::launcher_model() { - return shell_->launcher_model_.get(); +ShelfModel* ShellTestApi::shelf_model() { + return shell_->shelf_model_.get(); } internal::DragDropController* ShellTestApi::drag_drop_controller() { diff --git a/ash/test/shell_test_api.h b/ash/test/shell_test_api.h index f197d50..9457e75 100644 --- a/ash/test/shell_test_api.h +++ b/ash/test/shell_test_api.h @@ -16,7 +16,7 @@ class InputMethodEventFilter; namespace ash { class AshNativeCursorManager; class LauncherDelegate; -class LauncherModel; +class ShelfModel; class Shell; namespace internal { @@ -41,7 +41,7 @@ public: internal::WorkspaceController* workspace_controller(); internal::ScreenPositionController* screen_position_controller(); AshNativeCursorManager* ash_native_cursor_manager(); - LauncherModel* launcher_model(); + ShelfModel* shelf_model(); internal::DragDropController* drag_drop_controller(); internal::AppListController* app_list_controller(); diff --git a/ash/test/test_launcher_delegate.cc b/ash/test/test_launcher_delegate.cc index 1867980..78c69fb 100644 --- a/ash/test/test_launcher_delegate.cc +++ b/ash/test/test_launcher_delegate.cc @@ -5,7 +5,7 @@ #include "ash/test/test_launcher_delegate.h" #include "ash/launcher/launcher_item_delegate_manager.h" -#include "ash/launcher/launcher_model.h" +#include "ash/shelf/shelf_model.h" #include "ash/shell.h" #include "ash/test/test_launcher_item_delegate.h" #include "base/strings/string_util.h" @@ -18,7 +18,7 @@ namespace test { TestLauncherDelegate* TestLauncherDelegate::instance_ = NULL; -TestLauncherDelegate::TestLauncherDelegate(LauncherModel* model) +TestLauncherDelegate::TestLauncherDelegate(ShelfModel* model) : model_(model) { CHECK(!instance_); instance_ = this; diff --git a/ash/test/test_launcher_delegate.h b/ash/test/test_launcher_delegate.h index 4198665..436b261 100644 --- a/ash/test/test_launcher_delegate.h +++ b/ash/test/test_launcher_delegate.h @@ -14,7 +14,7 @@ namespace ash { -class LauncherModel; +class ShelfModel; namespace test { @@ -23,7 +23,7 @@ namespace test { class TestLauncherDelegate : public LauncherDelegate, public aura::WindowObserver { public: - explicit TestLauncherDelegate(LauncherModel* model); + explicit TestLauncherDelegate(ShelfModel* model); virtual ~TestLauncherDelegate(); void AddLauncherItem(aura::Window* window); @@ -54,7 +54,7 @@ class TestLauncherDelegate : public LauncherDelegate, static TestLauncherDelegate* instance_; - LauncherModel* model_; + ShelfModel* model_; // Maps from window to the id we gave it. WindowToID window_to_id_; diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc index 735ad60..8a4970c 100644 --- a/ash/test/test_shell_delegate.cc +++ b/ash/test/test_shell_delegate.cc @@ -98,8 +98,7 @@ app_list::AppListViewDelegate* TestShellDelegate::CreateAppListViewDelegate() { return NULL; } -LauncherDelegate* TestShellDelegate::CreateLauncherDelegate( - ash::LauncherModel* model) { +LauncherDelegate* TestShellDelegate::CreateLauncherDelegate(ShelfModel* model) { return new TestLauncherDelegate(model); } diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h index 790163c..3edd95c 100644 --- a/ash/test/test_shell_delegate.h +++ b/ash/test/test_shell_delegate.h @@ -41,8 +41,7 @@ class TestShellDelegate : public ShellDelegate { CreateKeyboardControllerProxy() OVERRIDE; virtual content::BrowserContext* GetCurrentBrowserContext() OVERRIDE; virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; - virtual LauncherDelegate* CreateLauncherDelegate( - ash::LauncherModel* model) OVERRIDE; + virtual LauncherDelegate* CreateLauncherDelegate(ShelfModel* model) OVERRIDE; virtual SystemTrayDelegate* CreateSystemTrayDelegate() OVERRIDE; virtual UserWallpaperDelegate* CreateUserWallpaperDelegate() OVERRIDE; virtual CapsLockDelegate* CreateCapsLockDelegate() OVERRIDE; diff --git a/ash/wm/dock/docked_window_layout_manager_unittest.cc b/ash/wm/dock/docked_window_layout_manager_unittest.cc index 4ea9dfc..9d31f4d 100644 --- a/ash/wm/dock/docked_window_layout_manager_unittest.cc +++ b/ash/wm/dock/docked_window_layout_manager_unittest.cc @@ -6,10 +6,10 @@ #include "ash/ash_switches.h" #include "ash/launcher/launcher.h" -#include "ash/launcher/launcher_model.h" #include "ash/root_window_controller.h" #include "ash/screen_ash.h" #include "ash/shelf/shelf_layout_manager.h" +#include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_types.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" diff --git a/ash/wm/dock/docked_window_resizer_unittest.cc b/ash/wm/dock/docked_window_resizer_unittest.cc index cc0da82..1f658c6 100644 --- a/ash/wm/dock/docked_window_resizer_unittest.cc +++ b/ash/wm/dock/docked_window_resizer_unittest.cc @@ -6,10 +6,10 @@ #include "ash/ash_switches.h" #include "ash/launcher/launcher.h" -#include "ash/launcher/launcher_model.h" #include "ash/root_window_controller.h" #include "ash/screen_ash.h" #include "ash/shelf/shelf_layout_manager.h" +#include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_types.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" @@ -46,7 +46,7 @@ class DockedWindowResizerTest AshTestBase::SetUp(); UpdateDisplay("600x400"); test::ShellTestApi test_api(Shell::GetInstance()); - model_ = test_api.launcher_model(); + model_ = test_api.shelf_model(); } virtual void TearDown() OVERRIDE { @@ -220,7 +220,7 @@ class DockedWindowResizerTest private: scoped_ptr<WindowResizer> resizer_; - LauncherModel* model_; + ShelfModel* model_; aura::client::WindowType window_type_; aura::test::TestWindowDelegate delegate_; diff --git a/ash/wm/panels/panel_layout_manager_unittest.cc b/ash/wm/panels/panel_layout_manager_unittest.cc index 88bba1b..69f1df0 100644 --- a/ash/wm/panels/panel_layout_manager_unittest.cc +++ b/ash/wm/panels/panel_layout_manager_unittest.cc @@ -7,10 +7,10 @@ #include "ash/ash_switches.h" #include "ash/launcher/launcher.h" #include "ash/launcher/launcher_button.h" -#include "ash/launcher/launcher_model.h" #include "ash/root_window_controller.h" #include "ash/screen_ash.h" #include "ash/shelf/shelf_layout_manager.h" +#include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_types.h" #include "ash/shelf/shelf_view.h" #include "ash/shelf/shelf_widget.h" @@ -223,8 +223,7 @@ class PanelLayoutManagerTest : public test::AshTestBase { test::ShelfViewTestAPI test_api(shelf_view); test_api.SetAnimationDuration(1); test_api.RunMessageLoopUntilAnimationsDone(); - LauncherModel* model = - test::ShellTestApi(Shell::GetInstance()).launcher_model(); + ShelfModel* model = test::ShellTestApi(Shell::GetInstance()).shelf_model(); test::TestLauncherDelegate* launcher_delegate = test::TestLauncherDelegate::instance(); int index = model->ItemIndexByID(launcher_delegate->GetIDByWindow(window)); diff --git a/ash/wm/panels/panel_window_resizer_unittest.cc b/ash/wm/panels/panel_window_resizer_unittest.cc index 9a01217..d84a683 100644 --- a/ash/wm/panels/panel_window_resizer_unittest.cc +++ b/ash/wm/panels/panel_window_resizer_unittest.cc @@ -5,9 +5,9 @@ #include "ash/wm/panels/panel_window_resizer.h" #include "ash/launcher/launcher.h" -#include "ash/launcher/launcher_model.h" #include "ash/root_window_controller.h" #include "ash/shelf/shelf_layout_manager.h" +#include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_types.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" @@ -39,7 +39,7 @@ class PanelWindowResizerTest : public test::AshTestBase { AshTestBase::SetUp(); UpdateDisplay("600x400"); test::ShellTestApi test_api(Shell::GetInstance()); - model_ = test_api.launcher_model(); + model_ = test_api.shelf_model(); launcher_delegate_ = test::TestLauncherDelegate::instance(); } @@ -186,7 +186,7 @@ class PanelWindowResizerTest : public test::AshTestBase { private: scoped_ptr<WindowResizer> resizer_; internal::PanelLayoutManager* panel_layout_manager_; - LauncherModel* model_; + ShelfModel* model_; test::TestLauncherDelegate* launcher_delegate_; DISALLOW_COPY_AND_ASSIGN(PanelWindowResizerTest); diff --git a/ash/wm/system_gesture_event_filter_unittest.cc b/ash/wm/system_gesture_event_filter_unittest.cc index cc0a1ba..66cc681 100644 --- a/ash/wm/system_gesture_event_filter_unittest.cc +++ b/ash/wm/system_gesture_event_filter_unittest.cc @@ -8,7 +8,7 @@ #include "ash/ash_switches.h" #include "ash/display/display_manager.h" #include "ash/launcher/launcher.h" -#include "ash/launcher/launcher_model.h" +#include "ash/shelf/shelf_model.h" #include "ash/shell.h" #include "ash/system/brightness_control_delegate.h" #include "ash/system/tray/system_tray_delegate.h" diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc index ffbe007..13abd4a 100644 --- a/ash/wm/window_animations.cc +++ b/ash/wm/window_animations.cc @@ -513,11 +513,10 @@ void SetTransformForScaleAnimation(ui::Layer* layer, gfx::Rect GetMinimizeAnimationTargetBoundsInScreen(aura::Window* window) { Launcher* launcher = Launcher::ForWindow(window); - // Launcher is created lazily and can be NULL. + // Shelf is created lazily and can be NULL. if (!launcher) return gfx::Rect(); - gfx::Rect item_rect = launcher-> - GetScreenBoundsOfItemIconForWindow(window); + gfx::Rect item_rect = launcher->GetScreenBoundsOfItemIconForWindow(window); // The launcher item is visible and has an icon. if (!item_rect.IsEmpty()) |