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

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

Issue 2523053004: Enhance chrome.app.window API for shelf integration with restore support (Closed)
Patch Set: Created 4 years 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
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 "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" 5 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 if (!arc_auth_service->IsAllowed()) 158 if (!arc_auth_service->IsAllowed())
159 return false; 159 return false;
160 if (!arc_auth_service->IsArcEnabled() && arc_auth_service->IsArcManaged()) 160 if (!arc_auth_service->IsArcEnabled() && arc_auth_service->IsArcManaged())
161 return false; 161 return false;
162 } 162 }
163 163
164 return true; 164 return true;
165 } 165 }
166 166
167 void LauncherControllerHelper::LaunchApp(const std::string& app_id, 167 void LauncherControllerHelper::LaunchApp(const std::string& app_id,
168 const std::string& launch_id,
168 ash::LaunchSource source, 169 ash::LaunchSource source,
169 int event_flags) { 170 int event_flags) {
170 const ArcAppListPrefs* arc_prefs = GetArcAppListPrefs(); 171 const ArcAppListPrefs* arc_prefs = GetArcAppListPrefs();
171 if (arc_prefs && arc_prefs->IsRegistered(app_id)) { 172 if (arc_prefs && arc_prefs->IsRegistered(app_id)) {
172 arc::LaunchApp(profile_, app_id); 173 arc::LaunchApp(profile_, app_id);
173 return; 174 return;
174 } 175 }
175 176
176 // |extension| could be null when it is being unloaded for updating. 177 // |extension| could be null when it is being unloaded for updating.
177 const extensions::Extension* extension = GetExtensionByID(profile_, app_id); 178 const extensions::Extension* extension = GetExtensionByID(profile_, app_id);
(...skipping 17 matching lines...) Expand all
195 if (source != ash::LAUNCH_FROM_UNKNOWN && 196 if (source != ash::LAUNCH_FROM_UNKNOWN &&
196 app_id == extensions::kWebStoreAppId) { 197 app_id == extensions::kWebStoreAppId) {
197 // Get the corresponding source string. 198 // Get the corresponding source string.
198 std::string source_value = GetSourceFromAppListSource(source); 199 std::string source_value = GetSourceFromAppListSource(source);
199 200
200 // Set an override URL to include the source. 201 // Set an override URL to include the source.
201 GURL extension_url = extensions::AppLaunchInfo::GetFullLaunchURL(extension); 202 GURL extension_url = extensions::AppLaunchInfo::GetFullLaunchURL(extension);
202 params.override_url = net::AppendQueryParameter( 203 params.override_url = net::AppendQueryParameter(
203 extension_url, extension_urls::kWebstoreSourceField, source_value); 204 extension_url, extension_urls::kWebstoreSourceField, source_value);
204 } 205 }
206 params.launch_id = launch_id;
205 207
206 OpenApplication(params); 208 OpenApplication(params);
207 } 209 }
208 210
209 ArcAppListPrefs* LauncherControllerHelper::GetArcAppListPrefs() const { 211 ArcAppListPrefs* LauncherControllerHelper::GetArcAppListPrefs() const {
210 return ArcAppListPrefs::Get(profile_); 212 return ArcAppListPrefs::Get(profile_);
211 } 213 }
212 214
213 void LauncherControllerHelper::ExtensionEnableFlowFinished() { 215 void LauncherControllerHelper::ExtensionEnableFlowFinished() {
214 LaunchApp(extension_enable_flow_->extension_id(), ash::LAUNCH_FROM_UNKNOWN, 216 LaunchApp(extension_enable_flow_->extension_id(), "",
215 ui::EF_NONE); 217 ash::LAUNCH_FROM_UNKNOWN, ui::EF_NONE);
216 extension_enable_flow_.reset(); 218 extension_enable_flow_.reset();
217 } 219 }
218 220
219 void LauncherControllerHelper::ExtensionEnableFlowAborted(bool user_initiated) { 221 void LauncherControllerHelper::ExtensionEnableFlowAborted(bool user_initiated) {
220 extension_enable_flow_.reset(); 222 extension_enable_flow_.reset();
221 } 223 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698