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

Unified 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: Review v2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/launcher/launcher_controller_helper.cc
diff --git a/chrome/browser/ui/ash/launcher/launcher_controller_helper.cc b/chrome/browser/ui/ash/launcher/launcher_controller_helper.cc
index 481db177854cafd8229aa0355aeed6c3d88b8407..d37ff023cd635559486a9f65a7ce969238e2c6e8 100644
--- a/chrome/browser/ui/ash/launcher/launcher_controller_helper.cc
+++ b/chrome/browser/ui/ash/launcher/launcher_controller_helper.cc
@@ -208,6 +208,51 @@ void LauncherControllerHelper::LaunchApp(const std::string& app_id,
OpenApplication(params);
}
+void LauncherControllerHelper::LaunchAppWithLaunchId(
+ const std::string& app_id,
+ const std::string& launch_id,
+ ash::LaunchSource source,
+ int event_flags) {
+ const ArcAppListPrefs* arc_prefs = GetArcAppListPrefs();
+ if (arc_prefs && arc_prefs->IsRegistered(app_id)) {
+ arc::LaunchApp(profile_, app_id, event_flags);
+ return;
+ }
+
+ // |extension| could be null when it is being unloaded for updating.
+ const extensions::Extension* extension = GetExtensionByID(profile_, app_id);
+ if (!extension)
+ return;
+
+ if (!extensions::util::IsAppLaunchableWithoutEnabling(app_id, profile_)) {
+ // Do nothing if there is already a running enable flow.
+ if (extension_enable_flow_)
+ return;
+
+ extension_enable_flow_.reset(
+ new ExtensionEnableFlow(profile_, app_id, this));
+ extension_enable_flow_->StartForNativeWindow(nullptr);
+ return;
+ }
+
+ // The app will be created for the currently active profile.
+ AppLaunchParams params = CreateAppLaunchParamsWithEventFlags(
+ profile_, extension, event_flags, extensions::SOURCE_APP_LAUNCHER);
+ if (source != ash::LAUNCH_FROM_UNKNOWN &&
+ app_id == extensions::kWebStoreAppId) {
+ // Get the corresponding source string.
+ std::string source_value = GetSourceFromAppListSource(source);
+
+ // Set an override URL to include the source.
+ GURL extension_url = extensions::AppLaunchInfo::GetFullLaunchURL(extension);
+ params.override_url = net::AppendQueryParameter(
+ extension_url, extension_urls::kWebstoreSourceField, source_value);
+ }
+ params.launch_id = launch_id;
+
+ OpenApplication(params);
+}
+
ArcAppListPrefs* LauncherControllerHelper::GetArcAppListPrefs() const {
return ArcAppListPrefs::Get(profile_);
}

Powered by Google App Engine
This is Rietveld 408576698