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

Side by Side Diff: chrome/browser/profiles/profiles_state.cc

Issue 199533004: [Mac, Win] Show a user manager tutorial once per profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gab & nikita comments Created 6 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/profiles/profiles_state.h" 5 #include "chrome/browser/profiles/profiles_state.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/prefs/pref_registry_simple.h" 8 #include "base/prefs/pref_registry_simple.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/profiles/profile_info_cache.h" 13 #include "chrome/browser/profiles/profile_info_cache.h"
14 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
15 #include "chrome/browser/signin/profile_oauth2_token_service.h" 15 #include "chrome/browser/signin/profile_oauth2_token_service.h"
16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/common/chrome_constants.h" 18 #include "chrome/common/chrome_constants.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "components/user_prefs/pref_registry_syncable.h"
20 #include "grit/generated_resources.h" 21 #include "grit/generated_resources.h"
21 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
22 23
23 #if defined(OS_CHROMEOS) 24 #if defined(OS_CHROMEOS)
24 #include "chrome/browser/chromeos/login/user_manager.h" 25 #include "chrome/browser/chromeos/login/user_manager.h"
25 #endif 26 #endif
26 27
27 namespace profiles { 28 namespace profiles {
28 29
29 bool IsMultipleProfilesEnabled() { 30 bool IsMultipleProfilesEnabled() {
(...skipping 13 matching lines...) Expand all
43 default_profile_dir.AppendASCII(chrome::kInitialProfile); 44 default_profile_dir.AppendASCII(chrome::kInitialProfile);
44 return default_profile_dir; 45 return default_profile_dir;
45 } 46 }
46 47
47 void RegisterPrefs(PrefRegistrySimple* registry) { 48 void RegisterPrefs(PrefRegistrySimple* registry) {
48 registry->RegisterStringPref(prefs::kProfileLastUsed, std::string()); 49 registry->RegisterStringPref(prefs::kProfileLastUsed, std::string());
49 registry->RegisterIntegerPref(prefs::kProfilesNumCreated, 1); 50 registry->RegisterIntegerPref(prefs::kProfilesNumCreated, 1);
50 registry->RegisterListPref(prefs::kProfilesLastActive); 51 registry->RegisterListPref(prefs::kProfilesLastActive);
51 } 52 }
52 53
54 void RegisterTutorialPrefs(user_prefs::PrefRegistrySyncable* registry) {
55 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
56 registry->RegisterIntegerPref(
57 prefs::kProfileAvatarTutorialShown,
58 0,
59 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
60 registry->RegisterBooleanPref(
61 prefs::kProfileUserManagerTutorialShown,
62 false,
63 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
64 #endif
65 }
66
53 base::string16 GetAvatarNameForProfile(Profile* profile) { 67 base::string16 GetAvatarNameForProfile(Profile* profile) {
54 base::string16 display_name; 68 base::string16 display_name;
55 69
56 if (profile->IsGuestSession()) { 70 if (profile->IsGuestSession()) {
57 display_name = l10n_util::GetStringUTF16(IDS_GUEST_PROFILE_NAME); 71 display_name = l10n_util::GetStringUTF16(IDS_GUEST_PROFILE_NAME);
58 } else { 72 } else {
59 ProfileInfoCache& cache = 73 ProfileInfoCache& cache =
60 g_browser_process->profile_manager()->GetProfileInfoCache(); 74 g_browser_process->profile_manager()->GetProfileInfoCache();
61 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); 75 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath());
62 76
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 142
129 return accounts; 143 return accounts;
130 } 144 }
131 145
132 bool IsRegularOrGuestSession(Browser* browser) { 146 bool IsRegularOrGuestSession(Browser* browser) {
133 Profile* profile = browser->profile(); 147 Profile* profile = browser->profile();
134 return profile->IsGuestSession() || !profile->IsOffTheRecord(); 148 return profile->IsGuestSession() || !profile->IsOffTheRecord();
135 } 149 }
136 150
137 } // namespace profiles 151 } // namespace profiles
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698