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

Side by Side Diff: chrome/browser/chromeos/login/user_manager.cc

Issue 271533004: Turning on MultiProfile by default for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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/chromeos/login/user_manager.h" 5 #include "chrome/browser/chromeos/login/user_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_registry_simple.h" 8 #include "base/prefs/pref_registry_simple.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/browser_process_platform_part_chromeos.h" 10 #include "chrome/browser/browser_process_platform_part_chromeos.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 const std::string& hash) { 51 const std::string& hash) {
52 } 52 }
53 53
54 void UserManager::UserSessionStateObserver:: 54 void UserManager::UserSessionStateObserver::
55 PendingUserSessionsRestoreFinished() { 55 PendingUserSessionsRestoreFinished() {
56 } 56 }
57 57
58 UserManager::UserSessionStateObserver::~UserSessionStateObserver() { 58 UserManager::UserSessionStateObserver::~UserSessionStateObserver() {
59 } 59 }
60 60
61 UserManager::UserAccountData::UserAccountData(const base::string16& display_name , 61 UserManager::UserAccountData::UserAccountData(
62 const base::string16& given_name, 62 const base::string16& display_name,
63 const std::string& locale) 63 const base::string16& given_name,
64 const std::string& locale)
64 : display_name_(display_name), 65 : display_name_(display_name),
65 given_name_(given_name), 66 given_name_(given_name),
66 locale_(locale) { 67 locale_(locale) {
67 } 68 }
68 69
69 UserManager::UserAccountData::~UserAccountData() {} 70 UserManager::UserAccountData::~UserAccountData() {}
70 71
71 // static 72 // static
72 void UserManager::Initialize() { 73 void UserManager::Initialize() {
73 CHECK(!g_user_manager); 74 CHECK(!g_user_manager);
(...skipping 10 matching lines...) Expand all
84 delete g_user_manager; 85 delete g_user_manager;
85 g_user_manager = NULL; 86 g_user_manager = NULL;
86 } 87 }
87 88
88 // static 89 // static
89 UserManager* UserManager::Get() { 90 UserManager* UserManager::Get() {
90 CHECK(g_user_manager); 91 CHECK(g_user_manager);
91 return g_user_manager; 92 return g_user_manager;
92 } 93 }
93 94
94 // static
95 bool UserManager::IsMultipleProfilesAllowed() {
96 return CommandLine::ForCurrentProcess()->HasSwitch(
97 ::switches::kMultiProfiles);
98 }
99
100 UserManager::~UserManager() { 95 UserManager::~UserManager() {
101 } 96 }
102 97
103 // static 98 // static
104 UserManager* UserManager::SetForTesting(UserManager* user_manager) { 99 UserManager* UserManager::SetForTesting(UserManager* user_manager) {
105 UserManager* previous_user_manager = g_user_manager; 100 UserManager* previous_user_manager = g_user_manager;
101 if (previous_user_manager)
102 previous_user_manager->Shutdown();
103
106 g_user_manager = user_manager; 104 g_user_manager = user_manager;
107 return previous_user_manager; 105 return previous_user_manager;
108 } 106 }
109 107
110 ScopedUserManagerEnabler::ScopedUserManagerEnabler(UserManager* user_manager) 108 ScopedUserManagerEnabler::ScopedUserManagerEnabler(UserManager* user_manager)
111 : previous_user_manager_(UserManager::SetForTesting(user_manager)) { 109 : previous_user_manager_(UserManager::SetForTesting(user_manager)) {
112 } 110 }
113 111
114 ScopedUserManagerEnabler::~ScopedUserManagerEnabler() { 112 ScopedUserManagerEnabler::~ScopedUserManagerEnabler() {
115 UserManager::Get()->Shutdown(); 113 UserManager::Get()->Shutdown();
116 UserManager::Destroy(); 114 UserManager::Destroy();
117 UserManager::SetForTesting(previous_user_manager_); 115 UserManager::SetForTesting(previous_user_manager_);
118 } 116 }
119 117
120 ScopedTestUserManager::ScopedTestUserManager() { 118 ScopedTestUserManager::ScopedTestUserManager() {
121 UserManager::Initialize(); 119 UserManager::Initialize();
122 120
123 // ProfileHelper has to be initialized after UserManager instance is created. 121 // ProfileHelper has to be initialized after UserManager instance is created.
124 g_browser_process->platform_part()->profile_helper()->Initialize(); 122 g_browser_process->platform_part()->profile_helper()->Initialize();
125 } 123 }
126 124
127 ScopedTestUserManager::~ScopedTestUserManager() { 125 ScopedTestUserManager::~ScopedTestUserManager() {
128 UserManager::Get()->Shutdown(); 126 UserManager::Get()->Shutdown();
129 UserManager::Destroy(); 127 UserManager::Destroy();
130 } 128 }
131 129
132 } // namespace chromeos 130 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_manager.h ('k') | chrome/browser/chromeos/login/user_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698