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

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

Issue 16104008: First try at a user management screen for the desktop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and review comments Created 7 years, 5 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 (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/profiles/profile_manager.h" 5 #include "chrome/browser/profiles/profile_manager.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 void QueueProfileDirectoryForDeletion(const base::FilePath& path) { 160 void QueueProfileDirectoryForDeletion(const base::FilePath& path) {
161 ProfilesToDelete().push_back(path); 161 ProfilesToDelete().push_back(path);
162 } 162 }
163 163
164 bool IsProfileMarkedForDeletion(const base::FilePath& profile_path) { 164 bool IsProfileMarkedForDeletion(const base::FilePath& profile_path) {
165 return std::find(ProfilesToDelete().begin(), ProfilesToDelete().end(), 165 return std::find(ProfilesToDelete().begin(), ProfilesToDelete().end(),
166 profile_path) != ProfilesToDelete().end(); 166 profile_path) != ProfilesToDelete().end();
167 } 167 }
168 168
169 void OpenBrowserWindowForProfile(bool always_create,
170 chrome::HostDesktopType desktop_type,
171 Profile* profile,
172 Profile::CreateStatus status) {
173 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
174
175 if (status == Profile::CREATE_STATUS_INITIALIZED) {
176 ProfileManager::FindOrCreateNewWindowForProfile(
177 profile,
178 chrome::startup::IS_NOT_PROCESS_STARTUP,
179 chrome::startup::IS_NOT_FIRST_RUN,
180 desktop_type,
181 always_create);
182 }
183 }
184
169 #if defined(OS_CHROMEOS) 185 #if defined(OS_CHROMEOS)
170 void CheckCryptohomeIsMounted(chromeos::DBusMethodCallStatus call_status, 186 void CheckCryptohomeIsMounted(chromeos::DBusMethodCallStatus call_status,
171 bool is_mounted) { 187 bool is_mounted) {
172 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS) { 188 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS) {
173 LOG(ERROR) << "IsMounted call failed."; 189 LOG(ERROR) << "IsMounted call failed.";
174 return; 190 return;
175 } 191 }
176 if (!is_mounted) 192 if (!is_mounted)
177 LOG(ERROR) << "Cryptohome is not mounted."; 193 LOG(ERROR) << "Cryptohome is not mounted.";
178 } 194 }
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 637
622 content::RecordAction(UserMetricsAction("NewWindow")); 638 content::RecordAction(UserMetricsAction("NewWindow"));
623 CommandLine command_line(CommandLine::NO_PROGRAM); 639 CommandLine command_line(CommandLine::NO_PROGRAM);
624 int return_code; 640 int return_code;
625 StartupBrowserCreator browser_creator; 641 StartupBrowserCreator browser_creator;
626 browser_creator.LaunchBrowser(command_line, profile, base::FilePath(), 642 browser_creator.LaunchBrowser(command_line, profile, base::FilePath(),
627 process_startup, is_first_run, &return_code); 643 process_startup, is_first_run, &return_code);
628 #endif // defined(OS_IOS) 644 #endif // defined(OS_IOS)
629 } 645 }
630 646
647 // static
648 void ProfileManager::SwitchToProfile(
sail 2013/07/02 21:46:40 I don't think there's any value in having this in
noms 2013/07/03 17:11:35 The reason I moved it here is that the user choose
sail 2013/07/03 18:18:04 Adding this to profile manager is a bad idea. The
noms 2013/07/05 17:39:27 As discussed offline, this is ok because it's only
649 const base::FilePath& path,
650 chrome::HostDesktopType desktop_type,
651 bool always_create) {
652 g_browser_process->profile_manager()->CreateProfileAsync(
653 path,
654 base::Bind(&OpenBrowserWindowForProfile,
655 always_create,
656 desktop_type),
657 string16(),
658 string16(),
659 false);
660 }
661
631 void ProfileManager::Observe( 662 void ProfileManager::Observe(
632 int type, 663 int type,
633 const content::NotificationSource& source, 664 const content::NotificationSource& source,
634 const content::NotificationDetails& details) { 665 const content::NotificationDetails& details) {
635 #if defined(OS_CHROMEOS) 666 #if defined(OS_CHROMEOS)
636 if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) { 667 if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) {
637 logged_in_ = true; 668 logged_in_ = true;
638 669
639 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 670 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
640 if (!command_line.HasSwitch(switches::kTestType)) { 671 if (!command_line.HasSwitch(switches::kTestType)) {
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 ProfileManager::ProfileInfo::ProfileInfo( 1244 ProfileManager::ProfileInfo::ProfileInfo(
1214 Profile* profile, 1245 Profile* profile,
1215 bool created) 1246 bool created)
1216 : profile(profile), 1247 : profile(profile),
1217 created(created) { 1248 created(created) {
1218 } 1249 }
1219 1250
1220 ProfileManager::ProfileInfo::~ProfileInfo() { 1251 ProfileManager::ProfileInfo::~ProfileInfo() {
1221 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); 1252 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release());
1222 } 1253 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698