| 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 apps::LaunchPlatformAppWithCommandLineAndLaunchId( |
| 309 params.profile, extension, params.command_line, | 309 params.profile, extension, params.launch_id, params.command_line, |
| 310 params.current_directory, params.source, params.play_store_status); | 310 params.current_directory, params.source, params.play_store_status); |
| 311 return NULL; | 311 return NULL; |
| 312 } | 312 } |
| 313 | 313 |
| 314 UMA_HISTOGRAM_ENUMERATION("Extensions.HostedAppLaunchContainer", | 314 UMA_HISTOGRAM_ENUMERATION("Extensions.HostedAppLaunchContainer", |
| 315 params.container, | 315 params.container, |
| 316 extensions::NUM_LAUNCH_CONTAINERS); | 316 extensions::NUM_LAUNCH_CONTAINERS); |
| 317 | 317 |
| 318 GURL url = UrlForExtension(extension, params.override_url); | 318 GURL url = UrlForExtension(extension, params.override_url); |
| 319 if (extension->from_bookmark()) { | 319 if (extension->from_bookmark()) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 extensions::TabHelper::FromWebContents(tab)->UpdateShortcutOnLoadComplete(); | 398 extensions::TabHelper::FromWebContents(tab)->UpdateShortcutOnLoadComplete(); |
| 399 | 399 |
| 400 return tab; | 400 return tab; |
| 401 } | 401 } |
| 402 | 402 |
| 403 bool CanLaunchViaEvent(const extensions::Extension* extension) { | 403 bool CanLaunchViaEvent(const extensions::Extension* extension) { |
| 404 const extensions::Feature* feature = | 404 const extensions::Feature* feature = |
| 405 extensions::FeatureProvider::GetAPIFeature("app.runtime"); | 405 extensions::FeatureProvider::GetAPIFeature("app.runtime"); |
| 406 return feature && feature->IsAvailableToExtension(extension).is_available(); | 406 return feature && feature->IsAvailableToExtension(extension).is_available(); |
| 407 } | 407 } |
| OLD | NEW |