summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-08 04:04:52 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-08 04:04:52 +0000
commita9acdff8acba1fb3e51ce618b24972a76385196f (patch)
tree3be543bf016e66d9171878dc9a0a39882365c6a8
parent30799834a5f8a0490b5091c2ebf6c5001d8b6221 (diff)
downloadchromium_src-a9acdff8acba1fb3e51ce618b24972a76385196f.zip
chromium_src-a9acdff8acba1fb3e51ce618b24972a76385196f.tar.gz
chromium_src-a9acdff8acba1fb3e51ce618b24972a76385196f.tar.bz2
Fix app launch histograms.
Route all recording through a utility function so that it always records in the webstore link experiment histograms. BUG=none TEST=clicking a bookmark to an installed app adds to the _PlusIcon histogram when the plus icon experiment is on (it helps to increase the % of PlusIcon experiments to 94 or so) Review URL: https://chromiumcodereview.appspot.com/9619029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125549 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/extension_management_api.cc6
-rw-r--r--chrome/browser/extensions/extension_omnibox_api.cc8
-rw-r--r--chrome/browser/sessions/session_restore.cc6
-rw-r--r--chrome/browser/sessions/tab_restore_service.cc6
-rw-r--r--chrome/browser/ui/browser.cc11
-rw-r--r--chrome/browser/ui/browser_init.cc22
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm6
-rw-r--r--chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc6
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc6
-rw-r--r--chrome/browser/ui/webui/ntp/app_launcher_handler.cc38
-rw-r--r--chrome/browser/ui/webui/ntp/app_launcher_handler.h3
11 files changed, 59 insertions, 59 deletions
diff --git a/chrome/browser/extensions/extension_management_api.cc b/chrome/browser/extensions/extension_management_api.cc
index 7d50a04..ba80e0d 100644
--- a/chrome/browser/extensions/extension_management_api.cc
+++ b/chrome/browser/extensions/extension_management_api.cc
@@ -21,6 +21,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
+#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_utility_messages.h"
#include "chrome/common/extensions/extension.h"
@@ -352,9 +353,8 @@ bool LaunchAppFunction::RunImpl() {
extension, ExtensionPrefs::LAUNCH_DEFAULT);
Browser::OpenApplication(profile(), extension, launch_container, GURL(),
NEW_FOREGROUND_TAB);
- UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram,
- extension_misc::APP_LAUNCH_EXTENSION_API,
- extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ AppLauncherHandler::RecordAppLaunchType(
+ extension_misc::APP_LAUNCH_EXTENSION_API);
return true;
}
diff --git a/chrome/browser/extensions/extension_omnibox_api.cc b/chrome/browser/extensions/extension_omnibox_api.cc
index 20a1a8d..493642a 100644
--- a/chrome/browser/extensions/extension_omnibox_api.cc
+++ b/chrome/browser/extensions/extension_omnibox_api.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,6 +15,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension_constants.h"
#include "content/public/browser/notification_service.h"
@@ -282,9 +283,8 @@ void LaunchAppFromOmnibox(const AutocompleteMatch& match,
if (!extension)
return;
- UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram,
- extension_misc::APP_LAUNCH_OMNIBOX_APP,
- extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ AppLauncherHandler::RecordAppLaunchType(
+ extension_misc::APP_LAUNCH_OMNIBOX_APP);
// Look at the preferences to find the right launch container. If no
// preference is set, launch as a regular tab.
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index 06e47e7..b45ac82 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -29,6 +29,7 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
#include "chrome/common/chrome_notification_types.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/navigation_controller.h"
@@ -753,9 +754,8 @@ class SessionRestoreImpl : public content::NotificationObserver {
browser->profile()->GetExtensionService() &&
#endif
browser->profile()->GetExtensionService()->IsInstalledApp(url)) {
- UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram,
- extension_misc::APP_LAUNCH_SESSION_RESTORE,
- extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ AppLauncherHandler::RecordAppLaunchType(
+ extension_misc::APP_LAUNCH_SESSION_RESTORE);
}
WebContents* web_contents =
diff --git a/chrome/browser/sessions/tab_restore_service.cc b/chrome/browser/sessions/tab_restore_service.cc
index 380f917..b1f7e9d 100644
--- a/chrome/browser/sessions/tab_restore_service.cc
+++ b/chrome/browser/sessions/tab_restore_service.cc
@@ -24,6 +24,7 @@
#include "chrome/browser/sessions/tab_restore_service_delegate.h"
#include "chrome/browser/sessions/tab_restore_service_observer.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/url_constants.h"
@@ -166,9 +167,8 @@ void RecordAppLaunch(Profile* profile, const TabRestoreService::Tab& tab) {
if (!profile->GetExtensionService()->IsInstalledApp(url))
return;
- UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram,
- extension_misc::APP_LAUNCH_NTP_RECENTLY_CLOSED,
- extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ AppLauncherHandler::RecordAppLaunchType(
+ extension_misc::APP_LAUNCH_NTP_RECENTLY_CLOSED);
}
} // namespace
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 1d4ef8b..028b327 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -131,6 +131,7 @@
#include "chrome/browser/ui/tabs/tab_menu_model.h"
#include "chrome/browser/ui/web_applications/web_app_ui.h"
#include "chrome/browser/ui/webui/feedback_ui.h"
+#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
#include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h"
#include "chrome/browser/ui/webui/options/content_settings_handler.h"
#include "chrome/browser/ui/webui/signin/login_ui_service.h"
@@ -1747,9 +1748,8 @@ void Browser::OpenCurrentURL() {
DCHECK(profile_->GetExtensionService());
if (profile_->GetExtensionService()->IsInstalledApp(url)) {
- UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram,
- extension_misc::APP_LAUNCH_OMNIBOX_LOCATION,
- extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ AppLauncherHandler::RecordAppLaunchType(
+ extension_misc::APP_LAUNCH_OMNIBOX_LOCATION);
}
}
@@ -4552,9 +4552,8 @@ void Browser::CommitInstant(TabContentsWrapper* preview_contents) {
GURL url = preview_contents->web_contents()->GetURL();
DCHECK(profile_->GetExtensionService());
if (profile_->GetExtensionService()->IsInstalledApp(url)) {
- UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram,
- extension_misc::APP_LAUNCH_OMNIBOX_INSTANT,
- extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ AppLauncherHandler::RecordAppLaunchType(
+ extension_misc::APP_LAUNCH_OMNIBOX_INSTANT);
}
}
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc
index 23f43e9..6c1fc47 100644
--- a/chrome/browser/ui/browser_init.cc
+++ b/chrome/browser/ui/browser_init.cc
@@ -71,6 +71,7 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/dialog_style.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
#include "chrome/browser/ui/webui/sync_promo/sync_promo_dialog.h"
#include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h"
#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
@@ -583,9 +584,8 @@ bool GetAppLaunchContainer(
}
void RecordCmdLineAppHistogram() {
- UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram,
- extension_misc::APP_LAUNCH_CMD_LINE_APP,
- extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ AppLauncherHandler::RecordAppLaunchType(
+ extension_misc::APP_LAUNCH_CMD_LINE_APP);
}
void RecordAppLaunches(
@@ -596,16 +596,14 @@ void RecordAppLaunches(
DCHECK(extension_service);
for (size_t i = 0; i < cmd_line_urls.size(); ++i) {
if (extension_service->IsInstalledApp(cmd_line_urls.at(i))) {
- UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram,
- extension_misc::APP_LAUNCH_CMD_LINE_URL,
- extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ AppLauncherHandler::RecordAppLaunchType(
+ extension_misc::APP_LAUNCH_CMD_LINE_URL);
}
}
for (size_t i = 0; i < autolaunch_tabs.size(); ++i) {
if (extension_service->IsInstalledApp(autolaunch_tabs.at(i).url)) {
- UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram,
- extension_misc::APP_LAUNCH_AUTOLAUNCH,
- extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ AppLauncherHandler::RecordAppLaunchType(
+ extension_misc::APP_LAUNCH_AUTOLAUNCH);
}
}
}
@@ -1048,10 +1046,8 @@ bool BrowserInit::LaunchWithProfile::OpenApplicationWindow(Profile* profile) {
if (profile->GetExtensionService()->IsInstalledApp(url)) {
RecordCmdLineAppHistogram();
} else {
- UMA_HISTOGRAM_ENUMERATION(
- extension_misc::kAppLaunchHistogram,
- extension_misc::APP_LAUNCH_CMD_LINE_APP_LEGACY,
- extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ AppLauncherHandler::RecordAppLaunchType(
+ extension_misc::APP_LAUNCH_CMD_LINE_APP_LEGACY);
}
WebContents* app_tab = Browser::OpenAppShortcutWindow(
profile,
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
index 0362fbe..ba04ffd 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
@@ -40,6 +40,7 @@
#import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
#import "chrome/browser/ui/cocoa/view_id_util.h"
#import "chrome/browser/ui/cocoa/view_resizer.h"
+#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/user_metrics.h"
@@ -133,9 +134,8 @@ void RecordAppLaunch(Profile* profile, GURL url) {
if (!profile->GetExtensionService()->IsInstalledApp(url))
return;
- UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram,
- extension_misc::APP_LAUNCH_BOOKMARK_BAR,
- extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ AppLauncherHandler::RecordAppLaunchType(
+ extension_misc::APP_LAUNCH_BOOKMARK_BAR);
}
} // namespace
diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc
index da448e7..0b907f9 100644
--- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc
+++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc
@@ -31,6 +31,7 @@
#include "chrome/browser/ui/gtk/tabstrip_origin_provider.h"
#include "chrome/browser/ui/gtk/theme_service_gtk.h"
#include "chrome/browser/ui/gtk/view_id_util.h"
+#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/pref_names.h"
@@ -119,9 +120,8 @@ void RecordAppLaunch(Profile* profile, const GURL& url) {
if (!profile->GetExtensionService()->IsInstalledApp(url))
return;
- UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram,
- extension_misc::APP_LAUNCH_BOOKMARK_BAR,
- extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ AppLauncherHandler::RecordAppLaunchType(
+ extension_misc::APP_LAUNCH_BOOKMARK_BAR);
}
} // namespace
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
index 7c2c7b4..65698ad 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
@@ -32,6 +32,7 @@
#include "chrome/browser/ui/views/event_utils.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
+#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_constants.h"
@@ -255,9 +256,8 @@ void RecordAppLaunch(Profile* profile, GURL url) {
if (!profile->GetExtensionService()->IsInstalledApp(url))
return;
- UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram,
- extension_misc::APP_LAUNCH_BOOKMARK_BAR,
- extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ AppLauncherHandler::RecordAppLaunchType(
+ extension_misc::APP_LAUNCH_BOOKMARK_BAR);
}
} // namespace
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index 56f5656..6cb5214 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -35,7 +35,6 @@
#include "chrome/browser/ui/webui/web_ui_util.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_icon_set.h"
#include "chrome/common/extensions/extension_resource.h"
#include "chrome/common/favicon_url.h"
@@ -840,11 +839,26 @@ void AppLauncherHandler::CleanupAfterUninstall() {
}
// static
-void AppLauncherHandler::RecordWebStoreLaunch(bool promo_active) {
- UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram,
- extension_misc::APP_LAUNCH_NTP_WEBSTORE,
+void AppLauncherHandler::RecordAppLaunchType(
+ extension_misc::AppLaunchBucket bucket) {
+ UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, bucket,
extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ static const bool webstore_link_experiment_exists =
+ base::FieldTrialList::TrialExists(kWebStoreLinkExperiment);
+ if (webstore_link_experiment_exists) {
+ UMA_HISTOGRAM_ENUMERATION(
+ base::FieldTrial::MakeName(extension_misc::kAppLaunchHistogram,
+ kWebStoreLinkExperiment),
+ bucket,
+ extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ }
+}
+
+// static
+void AppLauncherHandler::RecordWebStoreLaunch(bool promo_active) {
+ RecordAppLaunchType(extension_misc::APP_LAUNCH_NTP_WEBSTORE);
+
if (!promo_active) return;
UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppsPromoHistogram,
@@ -857,8 +871,7 @@ void AppLauncherHandler::RecordAppLaunchByID(
extension_misc::AppLaunchBucket bucket) {
CHECK(bucket != extension_misc::APP_LAUNCH_BUCKET_INVALID);
- UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, bucket,
- extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ RecordAppLaunchType(bucket);
}
// static
@@ -873,18 +886,7 @@ void AppLauncherHandler::RecordAppLaunchByURL(
if (!profile->GetExtensionService()->IsInstalledApp(url))
return;
- UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, bucket,
- extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
-
- static const bool webstore_link_experiment_exists =
- base::FieldTrialList::TrialExists(kWebStoreLinkExperiment);
- if (webstore_link_experiment_exists) {
- UMA_HISTOGRAM_ENUMERATION(
- base::FieldTrial::MakeName(extension_misc::kAppLaunchHistogram,
- kWebStoreLinkExperiment),
- bucket,
- extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
- }
+ RecordAppLaunchType(bucket);
}
void AppLauncherHandler::PromptToEnableApp(const std::string& extension_id) {
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.h b/chrome/browser/ui/webui/ntp/app_launcher_handler.h
index 2119403..66a731f 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.h
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.h
@@ -105,6 +105,9 @@ class AppLauncherHandler : public content::WebUIMessageHandler,
// Register app launcher preferences.
static void RegisterUserPrefs(PrefService* pref_service);
+ // Records the given type of app launch for UMA.
+ static void RecordAppLaunchType(extension_misc::AppLaunchBucket bucket);
+
private:
struct AppInstallInfo {
AppInstallInfo();