| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |