Home | History | Annotate | Download | only in profiles
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_METRICS_H_
      6 #define CHROME_BROWSER_PROFILES_PROFILE_METRICS_H_
      7 
      8 #include <stddef.h>
      9 #include <string>
     10 
     11 #include "base/basictypes.h"
     12 
     13 class Profile;
     14 class ProfileManager;
     15 
     16 namespace base {
     17 class FilePath;
     18 }
     19 
     20 class ProfileMetrics {
     21  public:
     22   // Enum for counting the ways users were added.
     23   enum ProfileAdd {
     24     ADD_NEW_USER_ICON = 0,    // User adds new user from icon menu
     25     ADD_NEW_USER_MENU,        // User adds new user from menu bar
     26     ADD_NEW_USER_DIALOG,      // User adds new user from create-profile dialog
     27     NUM_PROFILE_ADD_METRICS
     28   };
     29 
     30   // Enum for counting the ways user profiles and menus were opened.
     31   enum ProfileOpen {
     32     NTP_AVATAR_BUBBLE = 0,    // User opens avatar icon menu from NTP
     33     ICON_AVATAR_BUBBLE,       // User opens avatar icon menu from icon
     34     SWITCH_PROFILE_ICON,      // User switches profiles from icon menu
     35     SWITCH_PROFILE_MENU,      // User switches profiles from menu bar
     36     SWITCH_PROFILE_DOCK,      // User switches profiles from dock (Mac-only)
     37     NUM_PROFILE_OPEN_METRICS
     38   };
     39 
     40   // Enum for getting net counts for adding and deleting users.
     41   enum ProfileNetUserCounts {
     42     ADD_NEW_USER = 0,         // Total count of add new user
     43     PROFILE_DELETED,          // User deleted a profile
     44     NUM_PROFILE_NET_METRICS
     45   };
     46 
     47   // Sign in is logged once the user has entered their GAIA information.
     48   // The options for sync are logged after the user has submitted the options
     49   // form. See sync_setup_handler.h.
     50   enum ProfileSync {
     51     SYNC_CUSTOMIZE = 0,       // User decided to customize sync
     52     SYNC_CHOOSE,              // User chose what to sync
     53     SYNC_ENCRYPT,             // User has chosen to encrypt all data
     54     SYNC_PASSPHRASE,          // User is using a passphrase
     55     NUM_PROFILE_SYNC_METRICS
     56   };
     57 
     58   enum ProfileType {
     59     ORIGINAL = 0,         // Refers to the original/default profile
     60     SECONDARY,            // Refers to a user-created profile
     61     NUM_PROFILE_TYPE_METRICS
     62   };
     63 
     64   enum ProfileGaia {
     65     GAIA_OPT_IN = 0,           // User changed to GAIA photo as avatar
     66     GAIA_OPT_OUT,              // User changed to not use GAIA photo as avatar
     67     NUM_PROFILE_GAIA_METRICS
     68   };
     69 
     70   static void LogNumberOfProfiles(ProfileManager* manager);
     71   static void LogProfileAddNewUser(ProfileAdd metric);
     72   static void LogProfileAvatarSelection(size_t icon_index);
     73   static void LogProfileDeleteUser(ProfileNetUserCounts metric);
     74   static void LogProfileOpenMethod(ProfileOpen metric);
     75   static void LogProfileSwitchGaia(ProfileGaia metric);
     76   static void LogProfileSwitchUser(ProfileOpen metric);
     77   static void LogProfileSyncInfo(ProfileSync metric);
     78 
     79   // These functions should only be called on the UI thread because they hook
     80   // into g_browser_process through a helper function.
     81   static void LogProfileLaunch(Profile* profile);
     82   static void LogProfileSyncSignIn(const base::FilePath& profile_path);
     83   static void LogProfileUpdate(const base::FilePath& profile_path);
     84 };
     85 
     86 
     87 #endif  // CHROME_BROWSER_PROFILES_PROFILE_METRICS_H_
     88