profile_metrics.h revision 868fa2fe829687343ffae624259930155e16dbd8
12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_PROFILES_PROFILE_METRICS_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_PROFILES_PROFILE_METRICS_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <stddef.h>
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string>
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/basictypes.h"
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Profile;
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ProfileManager;
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace base {
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class FilePath;
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ProfileMetrics {
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Enum for counting the ways users were added.
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  enum ProfileAdd {
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ADD_NEW_USER_ICON = 0,    // User adds new user from icon menu
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ADD_NEW_USER_MENU,        // User adds new user from menu bar
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ADD_NEW_USER_DIALOG,      // User adds new user from create-profile dialog
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    NUM_PROFILE_ADD_METRICS
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Enum for counting the ways user profiles and menus were opened.
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  enum ProfileOpen {
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    NTP_AVATAR_BUBBLE = 0,    // User opens avatar icon menu from NTP
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ICON_AVATAR_BUBBLE,       // User opens avatar icon menu from icon
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    SWITCH_PROFILE_ICON,      // User switches profiles from icon menu
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    SWITCH_PROFILE_MENU,      // User switches profiles from menu bar
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    SWITCH_PROFILE_DOCK,      // User switches profiles from dock (Mac-only)
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    NUM_PROFILE_OPEN_METRICS
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Enum for getting net counts for adding and deleting users.
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  enum ProfileNetUserCounts {
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ADD_NEW_USER = 0,         // Total count of add new user
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    PROFILE_DELETED,          // User deleted a profile
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    NUM_PROFILE_NET_METRICS
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Sign in is logged once the user has entered their GAIA information.
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The options for sync are logged after the user has submitted the options
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // form. See sync_setup_handler.h.
50c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  enum ProfileSync {
51c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)    SYNC_CUSTOMIZE = 0,       // User decided to customize sync
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    SYNC_CHOOSE,              // User chose what to sync
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    SYNC_ENCRYPT,             // User has chosen to encrypt all data
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    SYNC_PASSPHRASE,          // User is using a passphrase
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    NUM_PROFILE_SYNC_METRICS
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  enum ProfileType {
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ORIGINAL = 0,         // Refers to the original/default profile
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    SECONDARY,            // Refers to a user-created profile
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    NUM_PROFILE_TYPE_METRICS
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  enum ProfileGaia {
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    GAIA_OPT_IN = 0,           // User changed to GAIA photo as avatar
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    GAIA_OPT_OUT,              // User changed to not use GAIA photo as avatar
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    NUM_PROFILE_GAIA_METRICS
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static void LogNumberOfProfiles(ProfileManager* manager);
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static void LogProfileAddNewUser(ProfileAdd metric);
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static void LogProfileAvatarSelection(size_t icon_index);
735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static void LogProfileDeleteUser(ProfileNetUserCounts metric);
745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static void LogProfileOpenMethod(ProfileOpen metric);
755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static void LogProfileSwitchGaia(ProfileGaia metric);
765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static void LogProfileSwitchUser(ProfileOpen metric);
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static void LogProfileSyncInfo(ProfileSync metric);
785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // These functions should only be called on the UI thread because they hook
805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // into g_browser_process through a helper function.
815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static void LogProfileLaunch(Profile* profile);
825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static void LogProfileSyncSignIn(const base::FilePath& profile_path);
835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static void LogProfileUpdate(const base::FilePath& profile_path);
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROME_BROWSER_PROFILES_PROFILE_METRICS_H_
885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)