summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrlp@chromium.org <rlp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-07 21:00:48 +0000
committerrlp@chromium.org <rlp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-07 21:00:48 +0000
commit5f97c7d634a7ce6dba2006f2c26e075b1edf760e (patch)
tree673ccfbb9d4600e39c1a2846382bacbcd8d61380
parentded9142c3b7e1b08e0d0436a213d9f3fc84ade19 (diff)
downloadchromium_src-5f97c7d634a7ce6dba2006f2c26e075b1edf760e.zip
chromium_src-5f97c7d634a7ce6dba2006f2c26e075b1edf760e.tar.gz
chromium_src-5f97c7d634a7ce6dba2006f2c26e075b1edf760e.tar.bz2
Merge 108547 - Adding in metrics for profiles.
BUG=93825 TEST=none Review URL: http://codereview.chromium.org/8390061 TBR=rlp@chromium.org Review URL: http://codereview.chromium.org/8477038 git-svn-id: svn://svn.chromium.org/chrome/branches/912/src@108908 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/profiles/avatar_menu_model.cc4
-rw-r--r--chrome/browser/profiles/profile_metrics.cc124
-rw-r--r--chrome/browser/profiles/profile_metrics.h89
-rw-r--r--chrome/browser/ui/cocoa/browser/avatar_button_controller.mm3
-rw-r--r--chrome/browser/ui/cocoa/profile_menu_controller.mm4
-rw-r--r--chrome/browser/ui/gtk/avatar_menu_button_gtk.cc2
-rw-r--r--chrome/browser/ui/views/avatar_menu_button.cc3
-rw-r--r--chrome/browser/ui/webui/ntp/ntp_login_handler.cc2
-rw-r--r--chrome/browser/ui/webui/options/manage_profile_handler.cc6
-rw-r--r--chrome/browser/ui/webui/sync_setup_handler.cc19
-rw-r--r--chrome/chrome_browser.gypi2
11 files changed, 258 insertions, 0 deletions
diff --git a/chrome/browser/profiles/avatar_menu_model.cc b/chrome/browser/profiles/avatar_menu_model.cc
index 82db6c4..4f86a66 100644
--- a/chrome/browser/profiles/avatar_menu_model.cc
+++ b/chrome/browser/profiles/avatar_menu_model.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_init.h"
#include "chrome/browser/ui/browser_list.h"
@@ -80,6 +81,7 @@ void AvatarMenuModel::SwitchToProfile(size_t index) {
ProfileSwitchObserver* observer = new ProfileSwitchObserver();
g_browser_process->profile_manager()->CreateProfileAsync(
path, observer);
+ ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::SWITCH_PROFILE_ICON);
}
void AvatarMenuModel::EditProfile(size_t index) {
@@ -97,6 +99,8 @@ void AvatarMenuModel::EditProfile(size_t index) {
void AvatarMenuModel::AddNewProfile() {
ProfileManager::CreateMultiProfileAsync();
+ ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ADD_NEW_USER);
+ ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ADD_NEW_USER_ICON);
}
size_t AvatarMenuModel::GetNumberOfItems() {
diff --git a/chrome/browser/profiles/profile_metrics.cc b/chrome/browser/profiles/profile_metrics.cc
new file mode 100644
index 0000000..3ead76d5
--- /dev/null
+++ b/chrome/browser/profiles/profile_metrics.cc
@@ -0,0 +1,124 @@
+// Copyright (c) 2011 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.
+
+#include "chrome/browser/profiles/profile_metrics.h"
+
+#include "base/file_path.h"
+#include "base/logging.h"
+#include "base/metrics/histogram.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/profiles/profile_info_cache.h"
+#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/common/chrome_constants.h"
+
+namespace {
+
+ProfileMetrics::ProfileType GetProfileType(
+ FilePath& profile_path) {
+ ProfileMetrics::ProfileType metric = ProfileMetrics::SECONDARY;
+ ProfileManager* manager = g_browser_process->profile_manager();
+ FilePath user_data_dir;
+ // In unittests, we do not always have a profile_manager so check.
+ if (manager) {
+ user_data_dir = manager->user_data_dir();
+ }
+ if (profile_path == user_data_dir.AppendASCII(chrome::kInitialProfile)) {
+ metric = ProfileMetrics::ORIGINAL;
+ }
+ return metric;
+}
+
+} // namespace
+
+void ProfileMetrics::LogProfileAvatarSelection(size_t icon_index) {
+ DCHECK(icon_index < NUM_PROFILE_AVATAR_METRICS);
+ ProfileAvatar icon_name;
+ switch (icon_index) {
+ case 0:
+ icon_name = AVATAR_GENERIC;
+ case 1:
+ icon_name = AVATAR_GENERIC_AQUA;
+ case 2:
+ icon_name = AVATAR_GENERIC_BLUE;
+ case 3:
+ icon_name = AVATAR_GENERIC_GREEN;
+ case 4:
+ icon_name = AVATAR_GENERIC_ORANGE;
+ case 5:
+ icon_name = AVATAR_GENERIC_PURPLE;
+ case 6:
+ icon_name = AVATAR_GENERIC_RED;
+ case 7:
+ icon_name = AVATAR_GENERIC_YELLOW;
+ case 8:
+ icon_name = AVATAR_SECRET_AGENT;
+ case 9:
+ icon_name = AVATAR_SUPERHERO;
+ case 10:
+ icon_name = AVATAR_VOLLEYBALL;
+ case 11:
+ icon_name = AVATAR_BUSINESSMAN;
+ case 12:
+ icon_name = AVATAR_NINJA;
+ case 13:
+ icon_name = AVATAR_ALIEN;
+ case 14:
+ icon_name = AVATAR_AWESOME;
+ case 15:
+ icon_name = AVATAR_FLOWER;
+ case 16:
+ icon_name = AVATAR_PIZZA;
+ case 17:
+ icon_name = AVATAR_SOCCER;
+ case 18:
+ icon_name = AVATAR_BURGER;
+ case 19:
+ icon_name = AVATAR_CAT;
+ case 20:
+ icon_name = AVATAR_CUPCAKE;
+ case 21:
+ icon_name = AVATAR_DOG;
+ case 22:
+ icon_name = AVATAR_HORSE;
+ case 23:
+ icon_name = AVATAR_MARGARITA;
+ case 24:
+ icon_name = AVATAR_NOTE;
+ case 25:
+ icon_name = AVATAR_SUN_CLOUD;
+ default: // We should never actually get here, but just in case
+ icon_name = AVATAR_UNKNOWN;
+ }
+ UMA_HISTOGRAM_ENUMERATION("Profile.Avatar", icon_name,
+ NUM_PROFILE_AVATAR_METRICS);
+}
+
+void ProfileMetrics::LogProfileOpenMethod(ProfileOpen metric) {
+ DCHECK(metric < NUM_PROFILE_OPEN_METRICS);
+ UMA_HISTOGRAM_ENUMERATION("Profile.Opening", metric,
+ NUM_PROFILE_OPEN_METRICS);
+}
+
+void ProfileMetrics::LogProfileSyncInfo(ProfileSync metric) {
+ DCHECK(metric < NUM_PROFILE_SYNC_METRICS);
+ UMA_HISTOGRAM_ENUMERATION("Profile.Sync", metric,
+ NUM_PROFILE_SYNC_METRICS);
+}
+
+void ProfileMetrics::LogProfileUpdate(FilePath& profile_path) {
+ UMA_HISTOGRAM_ENUMERATION("Profile.Update",
+ GetProfileType(profile_path),
+ NUM_PROFILE_TYPE_METRICS);
+}
+
+void ProfileMetrics::LogProfileSyncSignIn(FilePath& profile_path) {
+ ProfileSync metric = SYNC_SIGN_IN_ORIGINAL;
+ if (GetProfileType(profile_path) == SECONDARY) {
+ metric = SYNC_SIGN_IN_SECONDARY;
+ }
+ UMA_HISTOGRAM_ENUMERATION("Profile.Sync", SYNC_SIGN_IN,
+ NUM_PROFILE_SYNC_METRICS);
+ UMA_HISTOGRAM_ENUMERATION("Profile.Sync", metric,
+ NUM_PROFILE_SYNC_METRICS);
+}
diff --git a/chrome/browser/profiles/profile_metrics.h b/chrome/browser/profiles/profile_metrics.h
new file mode 100644
index 0000000..68d221c
--- /dev/null
+++ b/chrome/browser/profiles/profile_metrics.h
@@ -0,0 +1,89 @@
+// Copyright (c) 2011 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.
+
+#ifndef CHROME_BROWSER_PROFILES_PROFILE_METRICS_H_
+#define CHROME_BROWSER_PROFILES_PROFILE_METRICS_H_
+
+#include <stddef.h>
+#include <string>
+
+#include "base/basictypes.h"
+
+class FilePath;
+
+class ProfileMetrics {
+ public:
+ enum ProfileAvatar {
+ AVATAR_GENERIC = 0, // The names for avatar icons
+ AVATAR_GENERIC_AQUA,
+ AVATAR_GENERIC_BLUE,
+ AVATAR_GENERIC_GREEN,
+ AVATAR_GENERIC_ORANGE,
+ AVATAR_GENERIC_PURPLE,
+ AVATAR_GENERIC_RED,
+ AVATAR_GENERIC_YELLOW,
+ AVATAR_SECRET_AGENT,
+ AVATAR_SUPERHERO,
+ AVATAR_VOLLEYBALL,
+ AVATAR_BUSINESSMAN,
+ AVATAR_NINJA,
+ AVATAR_ALIEN,
+ AVATAR_AWESOME,
+ AVATAR_FLOWER,
+ AVATAR_PIZZA,
+ AVATAR_SOCCER,
+ AVATAR_BURGER,
+ AVATAR_CAT,
+ AVATAR_CUPCAKE,
+ AVATAR_DOG,
+ AVATAR_HORSE,
+ AVATAR_MARGARITA,
+ AVATAR_NOTE,
+ AVATAR_SUN_CLOUD,
+ AVATAR_UNKNOWN,
+ NUM_PROFILE_AVATAR_METRICS
+ };
+
+ enum ProfileOpen {
+ ADD_NEW_USER = 0, // Total count of add new user
+ ADD_NEW_USER_ICON, // User adds new user from icon menu
+ ADD_NEW_USER_MENU, // User adds new user from menu bar
+ SWITCH_PROFILE_ICON, // User switches profiles from icon menu
+ SWITCH_PROFILE_MENU, // User switches profiles from menu bar
+ NTP_AVATAR_BUBBLE, // User opens avatar icon menu from NTP
+ ICON_AVATAR_BUBBLE, // User opens avatar icon menu from icon
+ PROFILE_DELETED, // User deleted a profile
+ NUM_PROFILE_OPEN_METRICS
+ };
+
+ // Sign in is logged once the user has entered their GAIA information.
+ // See sync_setup_flow.h.
+ // The options for sync are logged after the user has submitted the options
+ // form. See sync_setup_handler.h.
+ enum ProfileSync {
+ SYNC_SIGN_IN = 0, // User signed into sync
+ SYNC_SIGN_IN_ORIGINAL, // User signed into sync in original profile
+ SYNC_SIGN_IN_SECONDARY, // User signed into sync in secondary profile
+ SYNC_CUSTOMIZE, // User decided to customize sync
+ SYNC_CHOOSE, // User chose what to sync
+ SYNC_ENCRYPT, // User has chosen to encrypt all data
+ SYNC_PASSPHRASE, // User is using a passphrase
+ NUM_PROFILE_SYNC_METRICS
+ };
+
+ enum ProfileType {
+ ORIGINAL = 0, // Refers to the original/default profile
+ SECONDARY, // Refers to a user-created profile
+ NUM_PROFILE_TYPE_METRICS
+ };
+
+ static void LogProfileAvatarSelection(size_t icon_index);
+ static void LogProfileOpenMethod(ProfileOpen metric);
+ static void LogProfileSyncInfo(ProfileSync metric);
+ static void LogProfileUpdate(FilePath& profile_path);
+ static void LogProfileSyncSignIn(FilePath& profile_path);
+};
+
+
+#endif // CHROME_BROWSER_PROFILES_PROFILE_METRICS_H_
diff --git a/chrome/browser/ui/cocoa/browser/avatar_button_controller.mm b/chrome/browser/ui/cocoa/browser/avatar_button_controller.mm
index 9a25aec..a72feec 100644
--- a/chrome/browser/ui/cocoa/browser/avatar_button_controller.mm
+++ b/chrome/browser/ui/cocoa/browser/avatar_button_controller.mm
@@ -9,6 +9,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#import "chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h"
@@ -166,6 +167,8 @@ const CGFloat kMenuYOffsetAdjust = 1.0;
name:NSWindowWillCloseNotification
object:[menuController_ window]];
[menuController_ showWindow:self];
+
+ ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE);
}
// Private /////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/ui/cocoa/profile_menu_controller.mm b/chrome/browser/ui/cocoa/profile_menu_controller.mm
index ad4ff7a..de86017 100644
--- a/chrome/browser/ui/cocoa/profile_menu_controller.mm
+++ b/chrome/browser/ui/cocoa/profile_menu_controller.mm
@@ -12,6 +12,7 @@
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_info_interface.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#import "chrome/browser/ui/cocoa/menu_controller.h"
@@ -81,6 +82,7 @@ class Observer : public BrowserList::Observer,
- (IBAction)switchToProfile:(id)sender {
model_->SwitchToProfile([sender tag]);
+ ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::SWITCH_PROFILE_MENU);
}
- (IBAction)editProfile:(id)sender {
@@ -89,6 +91,8 @@ class Observer : public BrowserList::Observer,
- (IBAction)newProfile:(id)sender {
model_->AddNewProfile();
+ ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ADD_NEW_USER);
+ ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ADD_NEW_USER_MENU);
}
// Private /////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/ui/gtk/avatar_menu_button_gtk.cc b/chrome/browser/ui/gtk/avatar_menu_button_gtk.cc
index 9d57f28..c96a2ce 100644
--- a/chrome/browser/ui/gtk/avatar_menu_button_gtk.cc
+++ b/chrome/browser/ui/gtk/avatar_menu_button_gtk.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/gtk/avatar_menu_button_gtk.h"
#include "base/i18n/rtl.h"
+#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/ui/gtk/avatar_menu_bubble_gtk.h"
#include "chrome/browser/ui/gtk/bubble/bubble_gtk.h"
#include "ui/gfx/gtk_util.h"
@@ -43,6 +44,7 @@ gboolean AvatarMenuButtonGtk::OnButtonPressed(GtkWidget* widget,
return FALSE;
ShowAvatarBubble();
+ ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE);
return TRUE;
}
diff --git a/chrome/browser/ui/views/avatar_menu_button.cc b/chrome/browser/ui/views/avatar_menu_button.cc
index 36a899d..ab962a1 100644
--- a/chrome/browser/ui/views/avatar_menu_button.cc
+++ b/chrome/browser/ui/views/avatar_menu_button.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/views/avatar_menu_button.h"
+#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/views/avatar_menu_bubble_view.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
@@ -160,6 +161,8 @@ void AvatarMenuButton::ShowAvatarBubble() {
bubble_ = Bubble::Show(browser_view->GetWidget(), bounds,
views::BubbleBorder::TOP_LEFT, bubble_view, bubble_view);
bubble_->AddObserver(this);
+
+ ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE);
}
void AvatarMenuButton::OnBubbleClosing() {
diff --git a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
index a47dd35..e62b59b 100644
--- a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/prefs/pref_notifier.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/sync_setup_flow.h"
#include "chrome/browser/ui/browser.h"
@@ -106,6 +107,7 @@ void NTPLoginHandler::HandleShowSyncLoginUI(const ListValue* args) {
DCHECK(success);
gfx::Rect rect(x, y, width, height);
browser->window()->ShowAvatarBubble(web_ui_->tab_contents(), rect);
+ ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::NTP_AVATAR_BUBBLE);
}
}
diff --git a/chrome/browser/ui/webui/options/manage_profile_handler.cc b/chrome/browser/ui/webui/options/manage_profile_handler.cc
index 0287dfa..5a496c28 100644
--- a/chrome/browser/ui/webui/options/manage_profile_handler.cc
+++ b/chrome/browser/ui/webui/options/manage_profile_handler.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/common/chrome_notification_types.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/common/notification_service.h"
@@ -128,12 +129,17 @@ void ManageProfileHandler::SetProfileNameAndIcon(const ListValue* args) {
!cache.IsDefaultAvatarIconUrl(UTF16ToUTF8(icon_url), &new_icon_index))
return;
+ ProfileMetrics::LogProfileAvatarSelection(new_icon_index);
cache.SetAvatarIconOfProfileAtIndex(profile_index, new_icon_index);
+
+ ProfileMetrics::LogProfileUpdate(profile_file_path);
}
void ManageProfileHandler::DeleteProfile(const ListValue* args) {
DCHECK(args);
+ ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::PROFILE_DELETED);
+
Value* file_path_value;
FilePath profile_file_path;
if (!args->Get(0, &file_path_value) ||
diff --git a/chrome/browser/ui/webui/sync_setup_handler.cc b/chrome/browser/ui/webui/sync_setup_handler.cc
index cc3a90c..9539dac 100644
--- a/chrome/browser/ui/webui/sync_setup_handler.cc
+++ b/chrome/browser/ui/webui/sync_setup_handler.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/signin_manager.h"
#include "chrome/browser/sync/sync_setup_flow.h"
@@ -424,6 +425,13 @@ void SyncSetupHandler::ShowSetupDone(const std::wstring& user) {
// Suppress the sync promo once the user signs into sync. This way the user
// doesn't see the sync promo even if they sign out of sync later on.
SyncPromoUI::SetUserSkippedSyncPromo(Profile::FromWebUI(web_ui_));
+
+ Profile* profile = Profile::FromWebUI(web_ui_);
+ ProfileSyncService* service = profile->GetProfileSyncService();
+ if (!service->HasSyncSetupCompleted()) {
+ FilePath profile_file_path = profile->GetPath();
+ ProfileMetrics::LogProfileSyncSignIn(profile_file_path);
+ }
}
void SyncSetupHandler::SetFlow(SyncSetupFlow* flow) {
@@ -487,6 +495,17 @@ void SyncSetupHandler::HandleConfigure(const ListValue* args) {
DCHECK(flow_);
flow_->OnUserConfigured(configuration);
+
+ ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_CUSTOMIZE);
+ if (configuration.encrypt_all) {
+ ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_ENCRYPT);
+ }
+ if (configuration.set_secondary_passphrase) {
+ ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_PASSPHRASE);
+ }
+ if (!configuration.sync_everything) {
+ ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_CHOOSE);
+ }
}
void SyncSetupHandler::HandlePassphraseEntry(const ListValue* args) {
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 1f74465..62537044 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1957,6 +1957,8 @@
'browser/profiles/profile_keyed_service_factory.h',
'browser/profiles/profile_manager.cc',
'browser/profiles/profile_manager.h',
+ 'browser/profiles/profile_metrics.cc',
+ 'browser/profiles/profile_metrics.h',
'browser/protector/settings_change_global_error.cc',
'browser/protector/settings_change_global_error.h',
'browser/remove_rows_table_model.h',