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

Side by Side Diff: ash/launcher/launcher_delegate_proxy.cc

Issue 22429004: Refactor LauncherDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 7 years, 4 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
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ash/launcher/launcher_delegate_proxy.h"
6
7 #include "ash/launcher/app_list_launcher_item_delegate.h"
8 #include "ash/shell.h"
9 #include "ash/shell_delegate.h"
10 #include "ui/aura/window.h"
11
12 namespace ash {
13 namespace internal {
14
15 LauncherDelegateProxy::LauncherDelegateProxy() {
16 DCHECK(Shell::GetInstance()->launcher_model());
17 chrome_launcher_delegate_.reset(
18 Shell::GetInstance()->delegate()->CreateLauncherDelegate(
19 Shell::GetInstance()->launcher_model()));
20
21 app_list_launcher_item_delegate_.reset(new AppListLauncherItemDelegate);
22 }
23
24 LauncherDelegateProxy::~LauncherDelegateProxy() {
25 }
26
27 ash::LauncherID LauncherDelegateProxy::GetIDByWindow(aura::Window* window) {
28 return chrome_launcher_delegate_->GetIDByWindow(window);
29 }
30
31 void LauncherDelegateProxy::OnLauncherCreated(Launcher* launcher) {
32 chrome_launcher_delegate_->OnLauncherCreated(launcher);
33 }
34
35 void LauncherDelegateProxy::OnLauncherDestroyed(Launcher* launcher) {
36 chrome_launcher_delegate_->OnLauncherDestroyed(launcher);
37 }
38
39 LauncherID LauncherDelegateProxy::GetLauncherIDForAppID(
40 const std::string& app_id) {
41 return chrome_launcher_delegate_->GetLauncherIDForAppID(app_id);
42 }
43
44 void LauncherDelegateProxy::PinAppWithID(const std::string& app_id) {
45 chrome_launcher_delegate_->PinAppWithID(app_id);
46 }
47
48 bool LauncherDelegateProxy::IsAppPinned(const std::string& app_id) {
49 return chrome_launcher_delegate_->IsAppPinned(app_id);
50 }
51
52 void LauncherDelegateProxy::UnpinAppsWithID(const std::string& app_id) {
53 chrome_launcher_delegate_->UnpinAppsWithID(app_id);
54 }
55
56 LauncherItemDelegate* LauncherDelegateProxy::GetLauncherItemDelegate(
57 const LauncherItem& item) {
58 switch(item.type) {
59 case TYPE_TABBED:
60 case TYPE_APP_PANEL:
61 case TYPE_APP_SHORTCUT:
62 case TYPE_BROWSER_SHORTCUT:
63 case TYPE_PLATFORM_APP:
64 case TYPE_WINDOWED_APP:
65 return chrome_launcher_delegate_->GetLauncherItemDelegate(item);
66 case TYPE_APP_LIST:
67 return app_list_launcher_item_delegate_.get();
68 }
69 NOTREACHED();
70 return NULL;
71 }
72
73 } // namespace internal
74 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698