summaryrefslogtreecommitdiffstats
path: root/ash/shell/app_list.cc
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-09 04:11:45 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-09 04:11:45 +0000
commit0039db9b4f365a4c6b1bbd72b4ca4e2aeb65c354 (patch)
tree5a50f8caa29ce4038da05b20f18161887c3c8fc3 /ash/shell/app_list.cc
parenteb951d02de207130faca3a648d481108c97a8525 (diff)
downloadchromium_src-0039db9b4f365a4c6b1bbd72b4ca4e2aeb65c354.zip
chromium_src-0039db9b4f365a4c6b1bbd72b4ca4e2aeb65c354.tar.gz
chromium_src-0039db9b4f365a4c6b1bbd72b4ca4e2aeb65c354.tar.bz2
Move app list from ash to ui.
The goal is to make app list an independent component so that it could be reused in elsewhere. BUG=none. TEST=none. Review URL: https://chromiumcodereview.appspot.com/10388032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135981 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/shell/app_list.cc')
-rw-r--r--ash/shell/app_list.cc30
1 files changed, 18 insertions, 12 deletions
diff --git a/ash/shell/app_list.cc b/ash/shell/app_list.cc
index 2e4fd77..4430e7b 100644
--- a/ash/shell/app_list.cc
+++ b/ash/shell/app_list.cc
@@ -2,16 +2,16 @@
// 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 "ash/app_list/app_list_item_view.h"
-#include "ash/app_list/app_list_model.h"
-#include "ash/app_list/app_list_view.h"
-#include "ash/app_list/app_list_view_delegate.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/shell/example_factory.h"
#include "ash/shell/toplevel_window.h"
#include "base/basictypes.h"
+#include "ui/app_list/app_list_item_model.h"
+#include "ui/app_list/app_list_item_view.h"
+#include "ui/app_list/app_list_model.h"
+#include "ui/app_list/app_list_view.h"
+#include "ui/app_list/app_list_view_delegate.h"
#include "ui/views/examples/examples_window.h"
namespace ash {
@@ -19,7 +19,7 @@ namespace shell {
namespace {
-class WindowTypeLauncherItem : public ash::AppListItemModel {
+class WindowTypeLauncherItem : public app_list::AppListItemModel {
public:
enum Type {
TOPLEVEL_WINDOW = 0,
@@ -30,7 +30,7 @@ class WindowTypeLauncherItem : public ash::AppListItemModel {
LAST_TYPE,
};
- WindowTypeLauncherItem(Type type) : type_(type) {
+ explicit WindowTypeLauncherItem(Type type) : type_(type) {
SetIcon(GetIcon(type));
SetTitle(GetTitle(type));
}
@@ -108,13 +108,13 @@ class WindowTypeLauncherItem : public ash::AppListItemModel {
DISALLOW_COPY_AND_ASSIGN(WindowTypeLauncherItem);
};
-class ExampleAppListViewDelegate : public ash::AppListViewDelegate {
+class ExampleAppListViewDelegate : public app_list::AppListViewDelegate {
public:
ExampleAppListViewDelegate() : model_(NULL) {}
private:
// Overridden from ash::AppListViewDelegate:
- virtual void SetModel(AppListModel* model) OVERRIDE {
+ virtual void SetModel(app_list::AppListModel* model) OVERRIDE {
model_ = model;
}
@@ -133,19 +133,25 @@ class ExampleAppListViewDelegate : public ash::AppListViewDelegate {
}
}
- virtual void OnAppListItemActivated(ash::AppListItemModel* item,
+ virtual void OnAppListItemActivated(app_list::AppListItemModel* item,
int event_flags) OVERRIDE {
static_cast<WindowTypeLauncherItem*>(item)->Activate(event_flags);
}
- AppListModel* model_;
+ virtual void Close() OVERRIDE {
+ DCHECK(ash::Shell::HasInstance());
+ if (Shell::GetInstance()->GetAppListTargetVisibility())
+ Shell::GetInstance()->ToggleAppList();
+ }
+
+ app_list::AppListModel* model_;
DISALLOW_COPY_AND_ASSIGN(ExampleAppListViewDelegate);
};
} // namespace
-ash::AppListViewDelegate* CreateAppListViewDelegate() {
+app_list::AppListViewDelegate* CreateAppListViewDelegate() {
return new ExampleAppListViewDelegate;
}