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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_mus.cc

Issue 2835063003: mash: Use ChromeLauncherControllerImpl, remove Mus subclass stub. (Closed)
Patch Set: Use CLCImpl for LauncherControllers, etc.; expose ShelfModel pointer. Created 3 years, 8 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 2016 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 "chrome/browser/ui/ash/launcher/chrome_launcher_controller_mus.h"
6
7 #include "ash/public/cpp/app_launch_id.h"
8 #include "base/strings/string_util.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_manager.h"
11 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h"
12 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h"
13 #include "extensions/grit/extensions_browser_resources.h"
14 #include "ui/base/resource/resource_bundle.h"
15 #include "ui/events/event_constants.h"
16
17 ChromeLauncherControllerMus::ChromeLauncherControllerMus() {
18 AttachProfile(ProfileManager::GetActiveUserProfile());
19 }
20
21 ChromeLauncherControllerMus::~ChromeLauncherControllerMus() {}
22
23 ash::ShelfID ChromeLauncherControllerMus::CreateAppLauncherItem(
24 std::unique_ptr<ash::ShelfItemDelegate> item_delegate,
25 ash::ShelfItemStatus status) {
26 NOTIMPLEMENTED();
27 return ash::TYPE_UNDEFINED;
28 }
29
30 const ash::ShelfItem* ChromeLauncherControllerMus::GetItem(
31 ash::ShelfID id) const {
32 NOTIMPLEMENTED();
33 return nullptr;
34 }
35
36 void ChromeLauncherControllerMus::SetItemType(ash::ShelfID id,
37 ash::ShelfItemType type) {
38 NOTIMPLEMENTED();
39 }
40
41 void ChromeLauncherControllerMus::SetItemStatus(ash::ShelfID id,
42 ash::ShelfItemStatus status) {
43 NOTIMPLEMENTED();
44 }
45
46 void ChromeLauncherControllerMus::CloseLauncherItem(ash::ShelfID id) {
47 NOTIMPLEMENTED();
48 }
49
50 bool ChromeLauncherControllerMus::IsPinned(ash::ShelfID id) {
51 NOTIMPLEMENTED();
52 return false;
53 }
54
55 void ChromeLauncherControllerMus::SetV1AppStatus(const std::string& app_id,
56 ash::ShelfItemStatus status) {
57 NOTIMPLEMENTED();
58 }
59
60 void ChromeLauncherControllerMus::Launch(ash::ShelfID id, int event_flags) {
61 NOTIMPLEMENTED();
62 }
63
64 void ChromeLauncherControllerMus::Close(ash::ShelfID id) {
65 NOTIMPLEMENTED();
66 }
67
68 bool ChromeLauncherControllerMus::IsOpen(ash::ShelfID id) {
69 NOTIMPLEMENTED();
70 return false;
71 }
72
73 bool ChromeLauncherControllerMus::IsPlatformApp(ash::ShelfID id) {
74 NOTIMPLEMENTED();
75 return false;
76 }
77
78 void ChromeLauncherControllerMus::ActivateApp(const std::string& app_id,
79 ash::ShelfLaunchSource source,
80 int event_flags) {
81 NOTIMPLEMENTED();
82 }
83
84 void ChromeLauncherControllerMus::SetLauncherItemImage(
85 ash::ShelfID shelf_id,
86 const gfx::ImageSkia& image) {
87 NOTIMPLEMENTED();
88 }
89
90 void ChromeLauncherControllerMus::UpdateAppState(content::WebContents* contents,
91 AppState app_state) {
92 NOTIMPLEMENTED();
93 }
94
95 ash::ShelfID ChromeLauncherControllerMus::GetShelfIDForWebContents(
96 content::WebContents* contents) {
97 NOTIMPLEMENTED();
98 return ash::TYPE_UNDEFINED;
99 }
100
101 void ChromeLauncherControllerMus::SetRefocusURLPatternForTest(ash::ShelfID id,
102 const GURL& url) {
103 NOTIMPLEMENTED();
104 }
105
106 ash::ShelfAction ChromeLauncherControllerMus::ActivateWindowOrMinimizeIfActive(
107 ui::BaseWindow* window,
108 bool allow_minimize) {
109 NOTIMPLEMENTED();
110 return ash::SHELF_ACTION_NONE;
111 }
112
113 void ChromeLauncherControllerMus::ActiveUserChanged(
114 const std::string& user_email) {
115 NOTIMPLEMENTED();
116 }
117
118 void ChromeLauncherControllerMus::AdditionalUserAddedToSession(
119 Profile* profile) {
120 NOTIMPLEMENTED();
121 }
122
123 ash::MenuItemList ChromeLauncherControllerMus::GetAppMenuItemsForTesting(
124 const ash::ShelfItem& item) {
125 NOTIMPLEMENTED();
126 return ash::MenuItemList();
127 }
128
129 std::vector<content::WebContents*>
130 ChromeLauncherControllerMus::GetV1ApplicationsFromAppId(
131 const std::string& app_id) {
132 NOTIMPLEMENTED();
133 return std::vector<content::WebContents*>();
134 }
135
136 void ChromeLauncherControllerMus::ActivateShellApp(const std::string& app_id,
137 int window_index) {
138 NOTIMPLEMENTED();
139 }
140
141 bool ChromeLauncherControllerMus::IsWebContentHandledByApplication(
142 content::WebContents* web_contents,
143 const std::string& app_id) {
144 NOTIMPLEMENTED();
145 return false;
146 }
147
148 bool ChromeLauncherControllerMus::ContentCanBeHandledByGmailApp(
149 content::WebContents* web_contents) {
150 NOTIMPLEMENTED();
151 return false;
152 }
153
154 gfx::Image ChromeLauncherControllerMus::GetAppListIcon(
155 content::WebContents* web_contents) const {
156 NOTIMPLEMENTED();
157 return gfx::Image();
158 }
159
160 base::string16 ChromeLauncherControllerMus::GetAppListTitle(
161 content::WebContents* web_contents) const {
162 NOTIMPLEMENTED();
163 return base::string16();
164 }
165
166 BrowserShortcutLauncherItemController*
167 ChromeLauncherControllerMus::GetBrowserShortcutLauncherItemController() {
168 NOTIMPLEMENTED();
169 return nullptr;
170 }
171
172 bool ChromeLauncherControllerMus::ShelfBoundsChangesProbablyWithUser(
173 ash::WmShelf* shelf,
174 const AccountId& account_id) const {
175 NOTIMPLEMENTED();
176 return false;
177 }
178
179 void ChromeLauncherControllerMus::OnUserProfileReadyToSwitch(Profile* profile) {
180 NOTIMPLEMENTED();
181 }
182
183 ArcAppDeferredLauncherController*
184 ChromeLauncherControllerMus::GetArcDeferredLauncher() {
185 NOTIMPLEMENTED();
186 return nullptr;
187 }
188
189 const std::string& ChromeLauncherControllerMus::GetLaunchIDForShelfID(
190 ash::ShelfID id) {
191 NOTIMPLEMENTED();
192 return base::EmptyString();
193 }
194
195 void ChromeLauncherControllerMus::OnAppImageUpdated(
196 const std::string& app_id,
197 const gfx::ImageSkia& image) {
198 if (ConnectToShelfController())
199 shelf_controller()->SetItemImage(app_id, *image.bitmap());
200 }
201
202 void ChromeLauncherControllerMus::OnInit() {}
203
204 void ChromeLauncherControllerMus::PinAppsFromPrefs() {
205 if (!ConnectToShelfController())
206 return;
207
208 std::vector<ash::AppLaunchId> pinned_apps =
209 ash::launcher::GetPinnedAppsFromPrefs(profile()->GetPrefs(),
210 launcher_controller_helper());
211
212 for (const auto& app_launch_id : pinned_apps) {
213 const std::string app_id = app_launch_id.app_id();
214 if (app_launch_id.app_id() == ash::launcher::kPinnedAppsPlaceholder)
215 continue;
216
217 ash::mojom::ShelfItemPtr item(ash::mojom::ShelfItem::New());
218 item->app_id = app_id;
219 item->title = launcher_controller_helper()->GetAppTitle(profile(), app_id);
220 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
221 const gfx::Image& image = rb.GetImageNamed(IDR_APP_DEFAULT_ICON);
222 item->image = *image.ToSkBitmap();
223 // TOOD(msw): Actually pin the item and install its delegate; this code is
224 // unused at the moment. See http://crbug.com/647879
225 AppIconLoader* app_icon_loader = GetAppIconLoaderForApp(app_id);
226 if (app_icon_loader) {
227 app_icon_loader->FetchImage(app_id);
228 app_icon_loader->UpdateImage(app_id);
229 }
230 }
231 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698