summaryrefslogtreecommitdiffstats
path: root/ash/shell/shell_main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ash/shell/shell_main.cc')
-rw-r--r--ash/shell/shell_main.cc53
1 files changed, 35 insertions, 18 deletions
diff --git a/ash/shell/shell_main.cc b/ash/shell/shell_main.cc
index e6a1efa..4dc19b3 100644
--- a/ash/shell/shell_main.cc
+++ b/ash/shell/shell_main.cc
@@ -5,6 +5,7 @@
#include <map>
#include "ash/launcher/launcher.h"
+#include "ash/launcher/launcher_delegate.h"
#include "ash/launcher/launcher_model.h"
#include "ash/launcher/launcher_types.h"
#include "ash/shell.h"
@@ -110,12 +111,13 @@ class WindowWatcher : public aura::WindowObserver {
DISALLOW_COPY_AND_ASSIGN(WindowWatcher);
};
-class ShellDelegateImpl : public ash::ShellDelegate {
+class LauncherDelegateImpl : public ash::LauncherDelegate {
public:
- ShellDelegateImpl() {}
-
- void set_watcher(WindowWatcher* watcher) { watcher_ = watcher; }
+ explicit LauncherDelegateImpl(WindowWatcher* watcher)
+ : watcher_(watcher) {
+ }
+ // LauncherDelegate overrides:
virtual void CreateNewWindow() OVERRIDE {
ash::shell::ToplevelWindow::CreateParams create_params;
create_params.can_resize = true;
@@ -123,6 +125,33 @@ class ShellDelegateImpl : public ash::ShellDelegate {
ash::shell::ToplevelWindow::CreateToplevelWindow(create_params);
}
+ virtual void ItemClicked(const ash::LauncherItem& item) OVERRIDE {
+ aura::Window* window = watcher_->GetWindowByID(item.id);
+ window->Show();
+ ash::ActivateWindow(window);
+ }
+
+ virtual int GetBrowserShortcutResourceId() OVERRIDE {
+ return IDR_AURA_LAUNCHER_BROWSER_SHORTCUT;
+ }
+
+ virtual string16 GetTitle(const ash::LauncherItem& item) OVERRIDE {
+ return watcher_->GetWindowByID(item.id)->title();
+ }
+
+ private:
+ // Used to update Launcher. Owned by main.
+ WindowWatcher* watcher_;
+
+ DISALLOW_COPY_AND_ASSIGN(LauncherDelegateImpl);
+};
+
+class ShellDelegateImpl : public ash::ShellDelegate {
+ public:
+ ShellDelegateImpl() {}
+
+ void set_watcher(WindowWatcher* watcher) { watcher_ = watcher; }
+
virtual views::Widget* CreateStatusArea() OVERRIDE {
return ash::internal::CreateStatusArea();
}
@@ -156,20 +185,8 @@ class ShellDelegateImpl : public ash::ShellDelegate {
return windows;
}
- virtual void LauncherItemClicked(
- const ash::LauncherItem& item) OVERRIDE {
- aura::Window* window = watcher_->GetWindowByID(item.id);
- window->Show();
- ash::ActivateWindow(window);
- }
-
- virtual int GetBrowserShortcutResourceId() OVERRIDE {
- return IDR_AURA_LAUNCHER_BROWSER_SHORTCUT;
- }
-
- virtual string16 GetLauncherItemTitle(
- const ash::LauncherItem& item) OVERRIDE {
- return watcher_->GetWindowByID(item.id)->title();
+ virtual ash::LauncherDelegate* CreateLauncherDelegate() OVERRIDE {
+ return new LauncherDelegateImpl(watcher_);
}
private: