Chromium Code Reviews| 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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 WebContents* OpenEnabledApplication(const AppLaunchParams& params) { | 136 WebContents* OpenEnabledApplication(const AppLaunchParams& params) { |
| 137 const Extension* extension = GetExtension(params); | 137 const Extension* extension = GetExtension(params); |
| 138 if (!extension) | 138 if (!extension) |
| 139 return NULL; | 139 return NULL; |
| 140 Profile* profile = params.profile; | 140 Profile* profile = params.profile; |
| 141 | 141 |
| 142 WebContents* tab = NULL; | 142 WebContents* tab = NULL; |
| 143 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile); | 143 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile); |
| 144 prefs->SetActiveBit(extension->id(), true); | 144 prefs->SetActiveBit(extension->id(), true); |
| 145 | 145 |
| 146 UMA_HISTOGRAM_ENUMERATION( | |
| 147 "Extensions.AppLaunchContainer", params.container, 100); | |
|
Ilya Sherman
2014/12/02 02:52:01
Please mark this histogram as <obsolete>
benwells
2014/12/02 04:31:30
Done.
| |
| 148 | |
| 149 if (CanLaunchViaEvent(extension)) { | 146 if (CanLaunchViaEvent(extension)) { |
| 150 // Remember what desktop the launch happened on so that when the app opens a | 147 // Remember what desktop the launch happened on so that when the app opens a |
| 151 // window we can open them on the right desktop. | 148 // window we can open them on the right desktop. |
| 152 PerAppSettingsServiceFactory::GetForBrowserContext(profile)-> | 149 PerAppSettingsServiceFactory::GetForBrowserContext(profile)-> |
| 153 SetDesktopLastLaunchedFrom(extension->id(), params.desktop_type); | 150 SetDesktopLastLaunchedFrom(extension->id(), params.desktop_type); |
| 154 | 151 |
| 155 apps::LaunchPlatformAppWithCommandLine(profile, | 152 apps::LaunchPlatformAppWithCommandLine(profile, |
| 156 extension, | 153 extension, |
| 157 params.command_line, | 154 params.command_line, |
| 158 params.current_directory, | 155 params.current_directory, |
| 159 params.source); | 156 params.source); |
| 160 return NULL; | 157 return NULL; |
| 161 } | 158 } |
| 162 | 159 |
| 160 UMA_HISTOGRAM_ENUMERATION( | |
| 161 "Extensions.HostedAppLaunchContainer", params.container, 100); | |
|
Ilya Sherman
2014/12/02 02:52:02
Why are you setting the max for this histogram at
benwells
2014/12/02 04:31:30
No good reason. Updated to 4.
| |
| 162 | |
| 163 // Record v1 app launch. Platform app launch is recorded when dispatching | 163 // Record v1 app launch. Platform app launch is recorded when dispatching |
| 164 // the onLaunched event. | 164 // the onLaunched event. |
| 165 prefs->SetLastLaunchTime(extension->id(), base::Time::Now()); | 165 prefs->SetLastLaunchTime(extension->id(), base::Time::Now()); |
| 166 | 166 |
| 167 GURL url = UrlForExtension(extension, params.override_url); | 167 GURL url = UrlForExtension(extension, params.override_url); |
| 168 switch (params.container) { | 168 switch (params.container) { |
| 169 case extensions::LAUNCH_CONTAINER_NONE: { | 169 case extensions::LAUNCH_CONTAINER_NONE: { |
| 170 NOTREACHED(); | 170 NOTREACHED(); |
| 171 break; | 171 break; |
| 172 } | 172 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 | 236 |
| 237 return tab; | 237 return tab; |
| 238 } | 238 } |
| 239 | 239 |
| 240 bool CanLaunchViaEvent(const extensions::Extension* extension) { | 240 bool CanLaunchViaEvent(const extensions::Extension* extension) { |
| 241 const extensions::FeatureProvider* feature_provider = | 241 const extensions::FeatureProvider* feature_provider = |
| 242 extensions::FeatureProvider::GetAPIFeatures(); | 242 extensions::FeatureProvider::GetAPIFeatures(); |
| 243 extensions::Feature* feature = feature_provider->GetFeature("app.runtime"); | 243 extensions::Feature* feature = feature_provider->GetFeature("app.runtime"); |
| 244 return feature->IsAvailableToExtension(extension).is_available(); | 244 return feature->IsAvailableToExtension(extension).is_available(); |
| 245 } | 245 } |
| OLD | NEW |