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

Side by Side Diff: chrome/browser/ui/extensions/application_launch.cc

Issue 763933002: Record container for hosted app launches. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback Created 6 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 WebContents* OpenEnabledApplication(const AppLaunchParams& params) { 137 WebContents* OpenEnabledApplication(const AppLaunchParams& params) {
138 const Extension* extension = GetExtension(params); 138 const Extension* extension = GetExtension(params);
139 if (!extension) 139 if (!extension)
140 return NULL; 140 return NULL;
141 Profile* profile = params.profile; 141 Profile* profile = params.profile;
142 142
143 WebContents* tab = NULL; 143 WebContents* tab = NULL;
144 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile); 144 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile);
145 prefs->SetActiveBit(extension->id(), true); 145 prefs->SetActiveBit(extension->id(), true);
146 146
147 UMA_HISTOGRAM_ENUMERATION(
148 "Extensions.AppLaunchContainer", params.container, 100);
149
150 if (CanLaunchViaEvent(extension)) { 147 if (CanLaunchViaEvent(extension)) {
151 // Remember what desktop the launch happened on so that when the app opens a 148 // Remember what desktop the launch happened on so that when the app opens a
152 // window we can open them on the right desktop. 149 // window we can open them on the right desktop.
153 PerAppSettingsServiceFactory::GetForBrowserContext(profile)-> 150 PerAppSettingsServiceFactory::GetForBrowserContext(profile)->
154 SetDesktopLastLaunchedFrom(extension->id(), params.desktop_type); 151 SetDesktopLastLaunchedFrom(extension->id(), params.desktop_type);
155 152
156 apps::LaunchPlatformAppWithCommandLine(profile, 153 apps::LaunchPlatformAppWithCommandLine(profile,
157 extension, 154 extension,
158 params.command_line, 155 params.command_line,
159 params.current_directory, 156 params.current_directory,
160 params.source); 157 params.source);
161 return NULL; 158 return NULL;
162 } 159 }
163 160
161 UMA_HISTOGRAM_ENUMERATION(
162 "Extensions.HostedAppLaunchContainer", params.container, 4);
Ilya Sherman 2014/12/02 23:51:52 Rather than hardcoding the constant "4" here, plea
benwells 2014/12/04 00:17:28 Done.
163
164 // Record v1 app launch. Platform app launch is recorded when dispatching 164 // Record v1 app launch. Platform app launch is recorded when dispatching
165 // the onLaunched event. 165 // the onLaunched event.
166 prefs->SetLastLaunchTime(extension->id(), base::Time::Now()); 166 prefs->SetLastLaunchTime(extension->id(), base::Time::Now());
167 167
168 GURL url = UrlForExtension(extension, params.override_url); 168 GURL url = UrlForExtension(extension, params.override_url);
169 switch (params.container) { 169 switch (params.container) {
170 case extensions::LAUNCH_CONTAINER_NONE: { 170 case extensions::LAUNCH_CONTAINER_NONE: {
171 NOTREACHED(); 171 NOTREACHED();
172 break; 172 break;
173 } 173 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698