diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-02 16:12:40 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-02 16:12:40 +0000 |
commit | 41247fdcdeceecef93a0f04f2240abf0e4b4e283 (patch) | |
tree | 915ef725b646d7bb57357c60da5a0407573cfefb /ash/shell/app_list.cc | |
parent | f656805bcc1e3996d3f6fccaa385ea2438d70003 (diff) | |
download | chromium_src-41247fdcdeceecef93a0f04f2240abf0e4b4e283.zip chromium_src-41247fdcdeceecef93a0f04f2240abf0e4b4e283.tar.gz chromium_src-41247fdcdeceecef93a0f04f2240abf0e4b4e283.tar.bz2 |
aura: Implement app list M19 mock.
- Make AppListModel flat, i.e. remove AppListItemGroupModel and its view;
- Move BuildAppListModel from ShellDelegate into AppListViewDelegate;
- Make AppListModelBuilder ready to support simple query;
- Make AppListItemView based on CustomButton and get rid of its listener
interface since we can use ButtonListener for that now;
- Update UI based on M19 mock:
- AppListItemView show label on its right instead of bottom;
- AppListItemView has a mouse hover effect now;
- AppListModelView show AppListItemView tiles alphabetically from top to
bottom instead of from left to right;
- AppListView to occupy full screen include area behind the launcher;
- AppListView to have a 0.4 black shade;
BUG=98308
TEST=Verify applist should look like M19 mock.
Review URL: https://chromiumcodereview.appspot.com/9559005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124661 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/shell/app_list.cc')
-rw-r--r-- | ash/shell/app_list.cc | 56 |
1 files changed, 22 insertions, 34 deletions
diff --git a/ash/shell/app_list.cc b/ash/shell/app_list.cc index eaa4ffa..f4f8bd6 100644 --- a/ash/shell/app_list.cc +++ b/ash/shell/app_list.cc @@ -2,7 +2,6 @@ // 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_group_model.h" #include "ash/app_list/app_list_item_model.h" #include "ash/app_list/app_list_item_view.h" #include "ash/app_list/app_list_model.h" @@ -36,17 +35,16 @@ class WindowTypeLauncherItem : public ash::AppListItemModel { static SkBitmap GetIcon(Type type) { static const SkColor kColors[] = { - SkColorSetA(SK_ColorRED, 0x4F), - SkColorSetA(SK_ColorGREEN, 0x4F), - SkColorSetA(SK_ColorBLUE, 0x4F), - SkColorSetA(SK_ColorYELLOW, 0x4F), - SkColorSetA(SK_ColorCYAN, 0x4F), + SK_ColorRED, + SK_ColorGREEN, + SK_ColorBLUE, + SK_ColorYELLOW, + SK_ColorCYAN, }; + const int kIconSize = 128; SkBitmap icon; - icon.setConfig(SkBitmap::kARGB_8888_Config, - ash::AppListItemView::kIconSize, - ash::AppListItemView::kIconSize); + icon.setConfig(SkBitmap::kARGB_8888_Config, kIconSize, kIconSize); icon.allocPixels(); icon.eraseColor(kColors[static_cast<int>(type) % arraysize(kColors)]); return icon; @@ -111,6 +109,21 @@ class ExampleAppListViewDelegate : public ash::AppListViewDelegate { ExampleAppListViewDelegate() {} private: + // Overridden from ash::AppListViewDelegate: + virtual void BuildAppListModel(const std::string& query, + AppListModel* model) OVERRIDE { + for (int i = 0; + i < static_cast<int>(WindowTypeLauncherItem::LAST_TYPE); + ++i) { + WindowTypeLauncherItem::Type type = + static_cast<WindowTypeLauncherItem::Type>(i); + + std::string title = WindowTypeLauncherItem::GetTitle(type); + if (title.find(query) != std::string::npos) + model->AddItem(new WindowTypeLauncherItem(type)); + } + } + virtual void OnAppListItemActivated(ash::AppListItemModel* item, int event_flags) OVERRIDE { static_cast<WindowTypeLauncherItem*>(item)->Activate(event_flags); @@ -119,33 +132,8 @@ class ExampleAppListViewDelegate : public ash::AppListViewDelegate { DISALLOW_COPY_AND_ASSIGN(ExampleAppListViewDelegate); }; -ash::AppListItemGroupModel* CreateGroup( - const std::string& title, - WindowTypeLauncherItem::Type start_type, - WindowTypeLauncherItem::Type end_type) { - ash::AppListItemGroupModel* group = - new ash::AppListItemGroupModel(title); - for (int i = static_cast<int>(start_type); - i < static_cast<int>(end_type); - ++i) { - WindowTypeLauncherItem::Type type = - static_cast<WindowTypeLauncherItem::Type>(i); - group->AddItem(new WindowTypeLauncherItem(type)); - } - return group; -} - } // namespace -void BuildAppListModel(ash::AppListModel* model) { - model->AddGroup(CreateGroup("Windows", - WindowTypeLauncherItem::TOPLEVEL_WINDOW, - WindowTypeLauncherItem::WIDGETS_WINDOW)); - model->AddGroup(CreateGroup("Samples", - WindowTypeLauncherItem::WIDGETS_WINDOW, - WindowTypeLauncherItem::LAST_TYPE)); -} - ash::AppListViewDelegate* CreateAppListViewDelegate() { return new ExampleAppListViewDelegate; } |