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

Side by Side Diff: chrome/browser/ui/extensions/application_launch.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 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/extensions/application_launch.h" 5 #include "chrome/browser/ui/extensions/application_launch.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "apps/launcher.h" 9 #include "apps/launcher.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 WebContents* OpenEnabledApplication(const AppLaunchParams& params) { 298 WebContents* OpenEnabledApplication(const AppLaunchParams& params) {
299 const Extension* extension = GetExtension(params); 299 const Extension* extension = GetExtension(params);
300 if (!extension) 300 if (!extension)
301 return NULL; 301 return NULL;
302 302
303 WebContents* tab = NULL; 303 WebContents* tab = NULL;
304 ExtensionPrefs* prefs = ExtensionPrefs::Get(params.profile); 304 ExtensionPrefs* prefs = ExtensionPrefs::Get(params.profile);
305 prefs->SetActiveBit(extension->id(), true); 305 prefs->SetActiveBit(extension->id(), true);
306 306
307 if (CanLaunchViaEvent(extension)) { 307 if (CanLaunchViaEvent(extension)) {
308 apps::LaunchPlatformAppWithCommandLine( 308 if (params.launch_id.empty()) {
309 params.profile, extension, params.command_line, 309 apps::LaunchPlatformAppWithCommandLine(
310 params.current_directory, params.source, params.play_store_status); 310 params.profile, extension, params.command_line,
311 params.current_directory, params.source, params.play_store_status);
312 } else {
313 apps::LaunchPlatformAppWithCommandLineAndLaunchId(
314 params.profile, extension, params.launch_id, params.command_line,
315 params.current_directory, params.source, params.play_store_status);
316 }
311 return NULL; 317 return NULL;
312 } 318 }
313 319
314 UMA_HISTOGRAM_ENUMERATION("Extensions.HostedAppLaunchContainer", 320 UMA_HISTOGRAM_ENUMERATION("Extensions.HostedAppLaunchContainer",
315 params.container, 321 params.container,
316 extensions::NUM_LAUNCH_CONTAINERS); 322 extensions::NUM_LAUNCH_CONTAINERS);
317 323
318 GURL url = UrlForExtension(extension, params.override_url); 324 GURL url = UrlForExtension(extension, params.override_url);
319 if (extension->from_bookmark()) { 325 if (extension->from_bookmark()) {
320 UMA_HISTOGRAM_ENUMERATION("Extensions.BookmarkAppLaunchContainer", 326 UMA_HISTOGRAM_ENUMERATION("Extensions.BookmarkAppLaunchContainer",
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 extensions::TabHelper::FromWebContents(tab)->UpdateShortcutOnLoadComplete(); 404 extensions::TabHelper::FromWebContents(tab)->UpdateShortcutOnLoadComplete();
399 405
400 return tab; 406 return tab;
401 } 407 }
402 408
403 bool CanLaunchViaEvent(const extensions::Extension* extension) { 409 bool CanLaunchViaEvent(const extensions::Extension* extension) {
404 const extensions::Feature* feature = 410 const extensions::Feature* feature =
405 extensions::FeatureProvider::GetAPIFeature("app.runtime"); 411 extensions::FeatureProvider::GetAPIFeature("app.runtime");
406 return feature && feature->IsAvailableToExtension(extension).is_available(); 412 return feature && feature->IsAvailableToExtension(extension).is_available();
407 } 413 }
OLDNEW
« apps/launcher.cc ('K') | « chrome/browser/ui/extensions/app_launch_params.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698