diff options
Diffstat (limited to 'chrome')
11 files changed, 46 insertions, 27 deletions
diff --git a/chrome/browser/ui/views/ash/app_list/app_list_model_builder.cc b/chrome/browser/ui/views/ash/app_list/app_list_model_builder.cc index def39ce..9a3fb35 100644 --- a/chrome/browser/ui/views/ash/app_list/app_list_model_builder.cc +++ b/chrome/browser/ui/views/ash/app_list/app_list_model_builder.cc @@ -53,7 +53,7 @@ class ChromeAppItem : public ChromeAppListItem { // ModelItemSortData provides a string key to sort with // l10n_util::StringComparator. struct ModelItemSortData { - explicit ModelItemSortData(ash::AppListItemModel* item) + explicit ModelItemSortData(app_list::AppListItemModel* item) : item(item), key(base::i18n::ToLower(UTF8ToUTF16(item->title()))) { } @@ -64,7 +64,7 @@ struct ModelItemSortData { return key; } - ash::AppListItemModel* item; + app_list::AppListItemModel* item; string16 key; }; @@ -102,7 +102,7 @@ AppListModelBuilder::AppListModelBuilder(Profile* profile) AppListModelBuilder::~AppListModelBuilder() { } -void AppListModelBuilder::SetModel(ash::AppListModel* model) { +void AppListModelBuilder::SetModel(app_list::AppListModel* model) { model_ = model; } @@ -139,7 +139,7 @@ void AppListModelBuilder::SortAndPopulateModel(const Items& items) { } } -void AppListModelBuilder::InsertItemByTitle(ash::AppListItemModel* item) { +void AppListModelBuilder::InsertItemByTitle(app_list::AppListItemModel* item) { DCHECK(model_); icu::Locale locale(g_browser_process->GetApplicationLocale().c_str()); diff --git a/chrome/browser/ui/views/ash/app_list/app_list_model_builder.h b/chrome/browser/ui/views/ash/app_list/app_list_model_builder.h index 6bdcdcd..b75ebdf 100644 --- a/chrome/browser/ui/views/ash/app_list/app_list_model_builder.h +++ b/chrome/browser/ui/views/ash/app_list/app_list_model_builder.h @@ -6,11 +6,14 @@ #define CHROME_BROWSER_UI_VIEWS_ASH_APP_LIST_APP_LIST_MODEL_BUILDER_H_ #pragma once -#include "ash/app_list/app_list_model.h" +#include <string> +#include <vector> + #include "base/gtest_prod_util.h" #include "base/string16.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "ui/app_list/app_list_model.h" class Profile; @@ -19,20 +22,20 @@ class AppListModelBuilder : public content::NotificationObserver { explicit AppListModelBuilder(Profile* profile); virtual ~AppListModelBuilder(); - void SetModel(ash::AppListModel* model); + void SetModel(app_list::AppListModel* model); // Populates the model. void Build(const std::string& query); private: - typedef std::vector<ash::AppListItemModel*> Items; + typedef std::vector<app_list::AppListItemModel*> Items; FRIEND_TEST_ALL_PREFIXES(AppListModelBuilderTest, GetExtensionApps); FRIEND_TEST_ALL_PREFIXES(AppListModelBuilderTest, SortAndPopulateModel); FRIEND_TEST_ALL_PREFIXES(AppListModelBuilderTest, InsertItemByTitle); void SortAndPopulateModel(const Items& items); - void InsertItemByTitle(ash::AppListItemModel* item); + void InsertItemByTitle(app_list::AppListItemModel* item); void GetExtensionApps(const string16& query, Items* items); void CreateSpecialItems(); @@ -57,7 +60,7 @@ class AppListModelBuilder : public content::NotificationObserver { // The model used by AppListView. It is passed in via SetModel and owned by // AppListView. - ash::AppListModel* model_; + app_list::AppListModel* model_; // Number of special items in the model. Special items index should be ranged // from [0, special_items_count_ - 1]. diff --git a/chrome/browser/ui/views/ash/app_list/app_list_model_builder_unittest.cc b/chrome/browser/ui/views/ash/app_list/app_list_model_builder_unittest.cc index 9137752..ed2d918 100644 --- a/chrome/browser/ui/views/ash/app_list/app_list_model_builder_unittest.cc +++ b/chrome/browser/ui/views/ash/app_list/app_list_model_builder_unittest.cc @@ -2,18 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/app_list/app_list_item_model.h" +#include "chrome/browser/ui/views/ash/app_list/app_list_model_builder.h" + +#include <string> + #include "base/file_util.h" #include "base/stl_util.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/ui/views/ash/app_list/app_list_model_builder.h" #include "chrome/browser/extensions/extension_service_unittest.h" #include "chrome/test/base/testing_profile.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/app_list/app_list_item_model.h" namespace { -class TestAppListItemModel : public ash::AppListItemModel { +class TestAppListItemModel : public app_list::AppListItemModel { public: explicit TestAppListItemModel(const std::string& title) { SetTitle(title); @@ -24,7 +27,7 @@ class TestAppListItemModel : public ash::AppListItemModel { }; // Get a string of all items in |model| joined with ','. -std::string GetModelContent(ash::AppListModel* model) { +std::string GetModelContent(app_list::AppListModel* model) { std::string content; for (int i = 0; i < model->item_count(); ++i) { if (i > 0) @@ -78,7 +81,7 @@ TEST_F(AppListModelBuilderTest, SortAndPopulateModel) { }; const char* kExpected = "a,B,Ca,CB"; - scoped_ptr<ash::AppListModel> model(new ash::AppListModel()); + scoped_ptr<app_list::AppListModel> model(new app_list::AppListModel()); AppListModelBuilder::Items items; for (size_t i = 0; i < arraysize(kInput); ++i) @@ -92,7 +95,7 @@ TEST_F(AppListModelBuilderTest, SortAndPopulateModel) { } TEST_F(AppListModelBuilderTest, InsertItemByTitle) { - scoped_ptr<ash::AppListModel> model(new ash::AppListModel()); + scoped_ptr<app_list::AppListModel> model(new app_list::AppListModel()); AppListModelBuilder builder(profile_.get()); builder.SetModel(model.get()); diff --git a/chrome/browser/ui/views/ash/app_list/app_list_view_delegate.cc b/chrome/browser/ui/views/ash/app_list/app_list_view_delegate.cc index 487830b..1dfe853 100644 --- a/chrome/browser/ui/views/ash/app_list/app_list_view_delegate.cc +++ b/chrome/browser/ui/views/ash/app_list/app_list_view_delegate.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ui/views/ash/app_list/app_list_view_delegate.h" +#include "ash/shell.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/views/ash/app_list/app_list_model_builder.h" #include "chrome/browser/ui/views/ash/app_list/chrome_app_list_item.h" @@ -14,7 +15,7 @@ AppListViewDelegate::AppListViewDelegate() { AppListViewDelegate::~AppListViewDelegate() { } -void AppListViewDelegate::SetModel(ash::AppListModel* model) { +void AppListViewDelegate::SetModel(app_list::AppListModel* model) { if (model) { if (!model_builder_.get()) { model_builder_.reset( @@ -33,7 +34,13 @@ void AppListViewDelegate::UpdateModel(const std::string& query) { } void AppListViewDelegate::OnAppListItemActivated( - ash::AppListItemModel* item, + app_list::AppListItemModel* item, int event_flags) { static_cast<ChromeAppListItem*>(item)->Activate(event_flags); } + +void AppListViewDelegate::Close() { + DCHECK(ash::Shell::HasInstance()); + if (ash::Shell::GetInstance()->GetAppListTargetVisibility()) + ash::Shell::GetInstance()->ToggleAppList(); +} diff --git a/chrome/browser/ui/views/ash/app_list/app_list_view_delegate.h b/chrome/browser/ui/views/ash/app_list/app_list_view_delegate.h index aefe3ee..0837997 100644 --- a/chrome/browser/ui/views/ash/app_list/app_list_view_delegate.h +++ b/chrome/browser/ui/views/ash/app_list/app_list_view_delegate.h @@ -6,24 +6,27 @@ #define CHROME_BROWSER_UI_VIEWS_ASH_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ #pragma once -#include "ash/app_list/app_list_view_delegate.h" +#include <string> + #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" +#include "ui/app_list/app_list_view_delegate.h" class AppListModelBuilder; -class AppListViewDelegate : public ash::AppListViewDelegate { +class AppListViewDelegate : public app_list::AppListViewDelegate { public: AppListViewDelegate(); virtual ~AppListViewDelegate(); private: - // Overridden from ash::AppListViewDelegate: - virtual void SetModel(ash::AppListModel* model) OVERRIDE; + // Overridden from app_list::AppListViewDelegate: + virtual void SetModel(app_list::AppListModel* model) OVERRIDE; virtual void UpdateModel(const std::string& query) OVERRIDE; - virtual void OnAppListItemActivated(ash::AppListItemModel* item, + virtual void OnAppListItemActivated(app_list::AppListItemModel* item, int event_flags) OVERRIDE; + virtual void Close() OVERRIDE; scoped_ptr<AppListModelBuilder> model_builder_; diff --git a/chrome/browser/ui/views/ash/app_list/chrome_app_list_item.h b/chrome/browser/ui/views/ash/app_list/chrome_app_list_item.h index dd0aac2..ae3129f 100644 --- a/chrome/browser/ui/views/ash/app_list/chrome_app_list_item.h +++ b/chrome/browser/ui/views/ash/app_list/chrome_app_list_item.h @@ -6,12 +6,12 @@ #define CHROME_BROWSER_UI_VIEWS_ASH_APP_LIST_CHROME_APP_LIST_ITEM_H_ #pragma once -#include "ash/app_list/app_list_item_model.h" +#include "ui/app_list/app_list_item_model.h" // Base class of all chrome app list items. Chrome's AppListViewDelegate assumes // all items are derived from this class and calls Activate when an item is // activated. -class ChromeAppListItem : public ash::AppListItemModel { +class ChromeAppListItem : public app_list::AppListItemModel { public: enum Type { TYPE_APP, diff --git a/chrome/browser/ui/views/ash/app_list/extension_app_item.cc b/chrome/browser/ui/views/ash/app_list/extension_app_item.cc index 6750a6c..abb17c0 100644 --- a/chrome/browser/ui/views/ash/app_list/extension_app_item.cc +++ b/chrome/browser/ui/views/ash/app_list/extension_app_item.cc @@ -4,7 +4,6 @@ #include "chrome/browser/ui/views/ash/app_list/extension_app_item.h" -#include "ash/app_list/app_list_item_view.h" #include "base/utf_string_conversions.h" #include "chrome/browser/extensions/extension_prefs.h" #include "chrome/browser/extensions/extension_service.h" @@ -19,6 +18,7 @@ #include "chrome/common/extensions/extension_icon_set.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" +#include "ui/app_list/app_list_item_view.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/image/image.h" diff --git a/chrome/browser/ui/views/ash/app_list/extension_app_item.h b/chrome/browser/ui/views/ash/app_list/extension_app_item.h index 19aad01..3621ded 100644 --- a/chrome/browser/ui/views/ash/app_list/extension_app_item.h +++ b/chrome/browser/ui/views/ash/app_list/extension_app_item.h @@ -6,6 +6,8 @@ #define CHROME_BROWSER_UI_VIEWS_ASH_APP_LIST_EXTENSION_APP_ITEM_H_ #pragma once +#include <string> + #include "base/memory/scoped_ptr.h" #include "chrome/browser/extensions/image_loading_tracker.h" #include "chrome/browser/ui/views/ash/app_list/chrome_app_list_item.h" diff --git a/chrome/browser/ui/views/ash/chrome_shell_delegate.cc b/chrome/browser/ui/views/ash/chrome_shell_delegate.cc index ab8d0f2..9ee52fa 100644 --- a/chrome/browser/ui/views/ash/chrome_shell_delegate.cc +++ b/chrome/browser/ui/views/ash/chrome_shell_delegate.cc @@ -207,7 +207,7 @@ void ChromeShellDelegate::ToggleSpokenFeedback() { #endif } -ash::AppListViewDelegate* +app_list::AppListViewDelegate* ChromeShellDelegate::CreateAppListViewDelegate() { // Shell will own the created delegate. return new AppListViewDelegate; diff --git a/chrome/browser/ui/views/ash/chrome_shell_delegate.h b/chrome/browser/ui/views/ash/chrome_shell_delegate.h index 4e9f243..ab1d222 100644 --- a/chrome/browser/ui/views/ash/chrome_shell_delegate.h +++ b/chrome/browser/ui/views/ash/chrome_shell_delegate.h @@ -44,7 +44,7 @@ class ChromeShellDelegate : public ash::ShellDelegate, virtual void OpenMobileSetup() OVERRIDE; virtual content::BrowserContext* GetCurrentBrowserContext() OVERRIDE; virtual void ToggleSpokenFeedback() OVERRIDE; - virtual ash::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; + virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; virtual void StartPartialScreenshot( ash::ScreenshotDelegate* screenshot_delegate) OVERRIDE; virtual ash::LauncherDelegate* CreateLauncherDelegate( diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 87e53e4..22e2f20 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -4262,6 +4262,7 @@ ['use_ash==1', { 'dependencies': [ '../ash/ash.gyp:ash', + '../ui/app_list/app_list.gyp:app_list', ], }], ['use_aura==1', { |