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

Side by Side Diff: chrome/browser/extensions/extension_omnibox_api.cc

Issue 7121017: Record omnibox app launches in AppLaunch histogram. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/common/extensions/extension_constants.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extensions/extension_omnibox_api.h" 5 #include "chrome/browser/extensions/extension_omnibox_api.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/metrics/histogram.h"
9 #include "base/string_util.h" 10 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
11 #include "base/values.h" 12 #include "base/values.h"
12 #include "chrome/browser/extensions/extension_event_router.h" 13 #include "chrome/browser/extensions/extension_event_router.h"
13 #include "chrome/browser/extensions/extension_service.h" 14 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/search_engines/template_url.h" 16 #include "chrome/browser/search_engines/template_url.h"
16 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/common/extensions/extension_constants.h"
17 #include "content/common/notification_service.h" 19 #include "content/common/notification_service.h"
18 20
19 namespace events { 21 namespace events {
20 const char kOnInputStarted[] = "omnibox.onInputStarted"; 22 const char kOnInputStarted[] = "omnibox.onInputStarted";
21 const char kOnInputChanged[] = "omnibox.onInputChanged"; 23 const char kOnInputChanged[] = "omnibox.onInputChanged";
22 const char kOnInputEntered[] = "omnibox.onInputEntered"; 24 const char kOnInputEntered[] = "omnibox.onInputEntered";
23 const char kOnInputCancelled[] = "omnibox.onInputCancelled"; 25 const char kOnInputCancelled[] = "omnibox.onInputCancelled";
24 }; // namespace events 26 }; // namespace events
25 27
26 namespace { 28 namespace {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 WindowOpenDisposition disposition) { 272 WindowOpenDisposition disposition) {
271 ExtensionService* service = profile->GetExtensionService(); 273 ExtensionService* service = profile->GetExtensionService();
272 const Extension* extension = 274 const Extension* extension =
273 service->GetInstalledApp(match.destination_url); 275 service->GetInstalledApp(match.destination_url);
274 // While the Omnibox popup is open, the extension can be updated, changing 276 // While the Omnibox popup is open, the extension can be updated, changing
275 // its URL and leaving us with no extension being found. In this case, we 277 // its URL and leaving us with no extension being found. In this case, we
276 // ignore the request. 278 // ignore the request.
277 if (!extension) 279 if (!extension)
278 return; 280 return;
279 281
282 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram,
283 extension_misc::APP_LAUNCH_OMNIBOX_APP,
284 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
285
280 // Look at the preferences to find the right launch container. If no 286 // Look at the preferences to find the right launch container. If no
281 // preference is set, launch as a regular tab. 287 // preference is set, launch as a regular tab.
282 extension_misc::LaunchContainer launch_container = 288 extension_misc::LaunchContainer launch_container =
283 service->extension_prefs()->GetLaunchContainer( 289 service->extension_prefs()->GetLaunchContainer(
284 extension, ExtensionPrefs::LAUNCH_REGULAR); 290 extension, ExtensionPrefs::LAUNCH_REGULAR);
285 291
286 Browser::OpenApplication(profile, extension, launch_container, disposition); 292 Browser::OpenApplication(profile, extension, launch_container, disposition);
287 } 293 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698