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

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

Issue 657023008: Add a new field "source" in launchData of chrome.app.runtime.onLaunched() to trace launch source. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo Created 6 years, 1 month 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/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 UMA_HISTOGRAM_ENUMERATION( 146 UMA_HISTOGRAM_ENUMERATION(
147 "Extensions.AppLaunchContainer", params.container, 100); 147 "Extensions.AppLaunchContainer", params.container, 100);
148 148
149 if (CanLaunchViaEvent(extension)) { 149 if (CanLaunchViaEvent(extension)) {
150 // Remember what desktop the launch happened on so that when the app opens a 150 // Remember what desktop the launch happened on so that when the app opens a
151 // window we can open them on the right desktop. 151 // window we can open them on the right desktop.
152 PerAppSettingsServiceFactory::GetForBrowserContext(profile)-> 152 PerAppSettingsServiceFactory::GetForBrowserContext(profile)->
153 SetDesktopLastLaunchedFrom(extension->id(), params.desktop_type); 153 SetDesktopLastLaunchedFrom(extension->id(), params.desktop_type);
154 154
155 apps::LaunchPlatformAppWithCommandLine( 155 apps::LaunchPlatformAppWithCommandLine(profile,
156 profile, extension, params.command_line, params.current_directory); 156 extension,
157 params.command_line,
158 params.current_directory,
159 params.source);
157 return NULL; 160 return NULL;
158 } 161 }
159 162
160 // Record v1 app launch. Platform app launch is recorded when dispatching 163 // Record v1 app launch. Platform app launch is recorded when dispatching
161 // the onLaunched event. 164 // the onLaunched event.
162 prefs->SetLastLaunchTime(extension->id(), base::Time::Now()); 165 prefs->SetLastLaunchTime(extension->id(), base::Time::Now());
163 166
164 GURL url = UrlForExtension(extension, params.override_url); 167 GURL url = UrlForExtension(extension, params.override_url);
165 switch (params.container) { 168 switch (params.container) {
166 case extensions::LAUNCH_CONTAINER_NONE: { 169 case extensions::LAUNCH_CONTAINER_NONE: {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 236
234 return tab; 237 return tab;
235 } 238 }
236 239
237 bool CanLaunchViaEvent(const extensions::Extension* extension) { 240 bool CanLaunchViaEvent(const extensions::Extension* extension) {
238 const extensions::FeatureProvider* feature_provider = 241 const extensions::FeatureProvider* feature_provider =
239 extensions::FeatureProvider::GetAPIFeatures(); 242 extensions::FeatureProvider::GetAPIFeatures();
240 extensions::Feature* feature = feature_provider->GetFeature("app.runtime"); 243 extensions::Feature* feature = feature_provider->GetFeature("app.runtime");
241 return feature->IsAvailableToExtension(extension).is_available(); 244 return feature->IsAvailableToExtension(extension).is_available();
242 } 245 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/extensions/app_launch_params.cc ('k') | chrome/browser/ui/webui/ntp/app_launcher_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698