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

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

Issue 25716004: Revert 226547 "Refactor LauncherItemController and LauncherItemD..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « trunk/src/ash/shell/launcher_delegate_impl.h ('k') | trunk/src/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"
7 #include "ash/shell.h" 9 #include "ash/shell.h"
8 #include "ash/shell/toplevel_window.h" 10 #include "ash/shell/toplevel_window.h"
9 #include "ash/shell/window_watcher.h" 11 #include "ash/shell/window_watcher.h"
10 #include "ash/wm/window_util.h" 12 #include "ash/wm/window_util.h"
11 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
12 #include "grit/ash_resources.h" 14 #include "grit/ash_resources.h"
15 #include "ui/aura/window.h"
13 16
14 namespace ash { 17 namespace ash {
15 namespace shell { 18 namespace shell {
16 19
17 LauncherDelegateImpl::LauncherDelegateImpl(WindowWatcher* watcher) 20 LauncherDelegateImpl::LauncherDelegateImpl(WindowWatcher* watcher)
18 : watcher_(watcher) { 21 : 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);
19 } 26 }
20 27
21 LauncherDelegateImpl::~LauncherDelegateImpl() { 28 LauncherDelegateImpl::~LauncherDelegateImpl() {
22 } 29 }
23 30
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
24 ash::LauncherID LauncherDelegateImpl::GetIDByWindow(aura::Window* window) { 56 ash::LauncherID LauncherDelegateImpl::GetIDByWindow(aura::Window* window) {
25 return watcher_ ? watcher_->GetIDByWindow(window) : 0; 57 return watcher_ ? watcher_->GetIDByWindow(window) : 0;
26 } 58 }
27 59
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
28 void LauncherDelegateImpl::OnLauncherCreated(Launcher* launcher) { 68 void LauncherDelegateImpl::OnLauncherCreated(Launcher* launcher) {
29 } 69 }
30 70
31 void LauncherDelegateImpl::OnLauncherDestroyed(Launcher* launcher) { 71 void LauncherDelegateImpl::OnLauncherDestroyed(Launcher* launcher) {
32 } 72 }
33 73
34 LauncherID LauncherDelegateImpl::GetLauncherIDForAppID( 74 LauncherID LauncherDelegateImpl::GetLauncherIDForAppID(
35 const std::string& app_id) { 75 const std::string& app_id) {
36 return 0; 76 return 0;
37 } 77 }
(...skipping 11 matching lines...) Expand all
49 89
50 bool LauncherDelegateImpl::CanPin() const { 90 bool LauncherDelegateImpl::CanPin() const {
51 return false; 91 return false;
52 } 92 }
53 93
54 void LauncherDelegateImpl::UnpinAppWithID(const std::string& app_id) { 94 void LauncherDelegateImpl::UnpinAppWithID(const std::string& app_id) {
55 } 95 }
56 96
57 } // namespace shell 97 } // namespace shell
58 } // namespace ash 98 } // namespace ash
OLDNEW
« no previous file with comments | « trunk/src/ash/shell/launcher_delegate_impl.h ('k') | trunk/src/ash/shell/window_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698