Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: ash/shell/launcher_delegate_impl.cc

Issue 23606016: Refactor LauncherItemController and LauncherItemDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix for unittest.. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/shell/launcher_delegate_impl.h ('k') | ash/shell/window_watcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/shell/launcher_delegate_impl.h" 5 #include "ash/shell/launcher_delegate_impl.h"
6 6
7 #include "ash/launcher/launcher_item_delegate_manager.h"
8 #include "ash/shelf/shelf_util.h"
9 #include "ash/shell.h" 7 #include "ash/shell.h"
10 #include "ash/shell/toplevel_window.h" 8 #include "ash/shell/toplevel_window.h"
11 #include "ash/shell/window_watcher.h" 9 #include "ash/shell/window_watcher.h"
12 #include "ash/wm/window_util.h" 10 #include "ash/wm/window_util.h"
13 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
14 #include "grit/ash_resources.h" 12 #include "grit/ash_resources.h"
15 #include "ui/aura/window.h"
16 13
17 namespace ash { 14 namespace ash {
18 namespace shell { 15 namespace shell {
19 16
20 LauncherDelegateImpl::LauncherDelegateImpl(WindowWatcher* watcher) 17 LauncherDelegateImpl::LauncherDelegateImpl(WindowWatcher* watcher)
21 : watcher_(watcher) { 18 : watcher_(watcher) {
22 ash::LauncherItemDelegateManager* manager =
23 ash::Shell::GetInstance()->launcher_item_delegate_manager();
24 manager->RegisterLauncherItemDelegate(ash::TYPE_APP_PANEL, this);
25 manager->RegisterLauncherItemDelegate(ash::TYPE_PLATFORM_APP, this);
26 } 19 }
27 20
28 LauncherDelegateImpl::~LauncherDelegateImpl() { 21 LauncherDelegateImpl::~LauncherDelegateImpl() {
29 } 22 }
30 23
31 void LauncherDelegateImpl::ItemSelected(const ash::LauncherItem& item,
32 const ui::Event& event) {
33 aura::Window* window = watcher_->GetWindowByID(item.id);
34 if (window->type() == aura::client::WINDOW_TYPE_PANEL)
35 ash::wm::MoveWindowToEventRoot(window, event);
36 window->Show();
37 ash::wm::ActivateWindow(window);
38 }
39
40 base::string16 LauncherDelegateImpl::GetTitle(const ash::LauncherItem& item) {
41 return watcher_->GetWindowByID(item.id)->title();
42 }
43
44 ui::MenuModel* LauncherDelegateImpl::CreateContextMenu(
45 const ash::LauncherItem& item,
46 aura::RootWindow* root_window) {
47 return NULL;
48 }
49
50 ash::LauncherMenuModel* LauncherDelegateImpl::CreateApplicationMenu(
51 const ash::LauncherItem& item,
52 int event_flags) {
53 return NULL;
54 }
55
56 ash::LauncherID LauncherDelegateImpl::GetIDByWindow(aura::Window* window) { 24 ash::LauncherID LauncherDelegateImpl::GetIDByWindow(aura::Window* window) {
57 return watcher_ ? watcher_->GetIDByWindow(window) : 0; 25 return watcher_ ? watcher_->GetIDByWindow(window) : 0;
58 } 26 }
59 27
60 bool LauncherDelegateImpl::IsDraggable(const ash::LauncherItem& item) {
61 return true;
62 }
63
64 bool LauncherDelegateImpl::ShouldShowTooltip(const ash::LauncherItem& item) {
65 return true;
66 }
67
68 void LauncherDelegateImpl::OnLauncherCreated(Launcher* launcher) { 28 void LauncherDelegateImpl::OnLauncherCreated(Launcher* launcher) {
69 } 29 }
70 30
71 void LauncherDelegateImpl::OnLauncherDestroyed(Launcher* launcher) { 31 void LauncherDelegateImpl::OnLauncherDestroyed(Launcher* launcher) {
72 } 32 }
73 33
74 LauncherID LauncherDelegateImpl::GetLauncherIDForAppID( 34 LauncherID LauncherDelegateImpl::GetLauncherIDForAppID(
75 const std::string& app_id) { 35 const std::string& app_id) {
76 return 0; 36 return 0;
77 } 37 }
(...skipping 11 matching lines...) Expand all
89 49
90 bool LauncherDelegateImpl::CanPin() const { 50 bool LauncherDelegateImpl::CanPin() const {
91 return false; 51 return false;
92 } 52 }
93 53
94 void LauncherDelegateImpl::UnpinAppWithID(const std::string& app_id) { 54 void LauncherDelegateImpl::UnpinAppWithID(const std::string& app_id) {
95 } 55 }
96 56
97 } // namespace shell 57 } // namespace shell
98 } // namespace ash 58 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell/launcher_delegate_impl.h ('k') | ash/shell/window_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698