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

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

Issue 1120013003: Add right-click user switching tutorial bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make the pref per-chrome instead of per-profile. Created 5 years, 7 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
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"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 void RegisterPrefs(PrefRegistrySimple* registry) { 47 void RegisterPrefs(PrefRegistrySimple* registry) {
48 // Preferences about global profile information. 48 // Preferences about global profile information.
49 registry->RegisterStringPref(prefs::kProfileLastUsed, std::string()); 49 registry->RegisterStringPref(prefs::kProfileLastUsed, std::string());
50 registry->RegisterIntegerPref(prefs::kProfilesNumCreated, 1); 50 registry->RegisterIntegerPref(prefs::kProfilesNumCreated, 1);
51 registry->RegisterListPref(prefs::kProfilesLastActive); 51 registry->RegisterListPref(prefs::kProfilesLastActive);
52 52
53 // Preferences about the user manager. 53 // Preferences about the user manager.
54 registry->RegisterBooleanPref(prefs::kBrowserGuestModeEnabled, true); 54 registry->RegisterBooleanPref(prefs::kBrowserGuestModeEnabled, true);
55 registry->RegisterBooleanPref(prefs::kBrowserAddPersonEnabled, true); 55 registry->RegisterBooleanPref(prefs::kBrowserAddPersonEnabled, true);
56
57 registry->RegisterBooleanPref(
Mike Lerman 2015/05/05 01:31:45 Let's register this near where the other tutorial
anthonyvd 2015/05/05 16:19:17 I put it here because the tutorial prefs in profil
Mike Lerman 2015/05/05 17:18:09 So we show it once per Chrome, not one per Profile
58 prefs::kProfileAvatarRightClickTutorialDismissed, false);
56 } 59 }
57 60
58 base::string16 GetAvatarNameForProfile(const base::FilePath& profile_path) { 61 base::string16 GetAvatarNameForProfile(const base::FilePath& profile_path) {
59 base::string16 display_name; 62 base::string16 display_name;
60 63
61 if (profile_path == ProfileManager::GetGuestProfilePath()) { 64 if (profile_path == ProfileManager::GetGuestProfilePath()) {
62 display_name = l10n_util::GetStringUTF16(IDS_GUEST_PROFILE_NAME); 65 display_name = l10n_util::GetStringUTF16(IDS_GUEST_PROFILE_NAME);
63 } else { 66 } else {
64 const ProfileInfoCache& cache = 67 const ProfileInfoCache& cache =
65 g_browser_process->profile_manager()->GetProfileInfoCache(); 68 g_browser_process->profile_manager()->GetProfileInfoCache();
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 233
231 // For guest the browsing data is in the OTR profile. 234 // For guest the browsing data is in the OTR profile.
232 if (profile->IsGuestSession()) 235 if (profile->IsGuestSession())
233 profile = profile->GetOffTheRecordProfile(); 236 profile = profile->GetOffTheRecordProfile();
234 237
235 BrowsingDataRemover::CreateForUnboundedRange(profile)->Remove( 238 BrowsingDataRemover::CreateForUnboundedRange(profile)->Remove(
236 BrowsingDataRemover::REMOVE_ALL, BrowsingDataHelper::ALL); 239 BrowsingDataRemover::REMOVE_ALL, BrowsingDataHelper::ALL);
237 // BrowsingDataRemover deletes itself. 240 // BrowsingDataRemover deletes itself.
238 } 241 }
239 242
243 void SetFastUserSwitchingTutorialDismissedState(bool dismissed) {
Mike Lerman 2015/05/05 01:31:45 We usually just directly access this type of prefe
anthonyvd 2015/05/05 16:19:17 I guess it just... happened. There no need really,
244 PrefService* local_state = g_browser_process->local_state();
245 local_state->SetBoolean(
246 prefs::kProfileAvatarRightClickTutorialDismissed, dismissed);
247 }
248
249 bool GetFastUserSwitchingTutorialDismissedState() {
250 PrefService* local_state = g_browser_process->local_state();
251 return local_state->GetBoolean(
252 prefs::kProfileAvatarRightClickTutorialDismissed);
253 }
254
240 } // namespace profiles 255 } // namespace profiles
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698