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

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: fix rebase disaster and some 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 // Count number of extensions in this profile, if we know. 155 // Count number of extensions in this profile, if we know.
156 if (extension_count != -1) 156 if (extension_count != -1)
157 UMA_HISTOGRAM_COUNTS_10000("Profile.AppCount", extension_count); 157 UMA_HISTOGRAM_COUNTS_10000("Profile.AppCount", extension_count);
158 } 158 }
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 void OpenBrowserWindowForProfile(bool always_create,
165 chrome::HostDesktopType desktop_type,
166 Profile* profile,
167 Profile::CreateStatus status) {
168 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
169
170 if (status == Profile::CREATE_STATUS_INITIALIZED) {
171 ProfileManager::FindOrCreateNewWindowForProfile(
172 profile,
173 chrome::startup::IS_NOT_PROCESS_STARTUP,
174 chrome::startup::IS_NOT_FIRST_RUN,
175 desktop_type,
176 always_create);
177 }
178 }
179
164 #if defined(OS_CHROMEOS) 180 #if defined(OS_CHROMEOS)
165 void CheckCryptohomeIsMounted(chromeos::DBusMethodCallStatus call_status, 181 void CheckCryptohomeIsMounted(chromeos::DBusMethodCallStatus call_status,
166 bool is_mounted) { 182 bool is_mounted) {
167 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS) { 183 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS) {
168 LOG(ERROR) << "IsMounted call failed."; 184 LOG(ERROR) << "IsMounted call failed.";
169 return; 185 return;
170 } 186 }
171 if (!is_mounted) 187 if (!is_mounted)
172 LOG(ERROR) << "Cryptohome is not mounted."; 188 LOG(ERROR) << "Cryptohome is not mounted.";
173 } 189 }
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 633
618 content::RecordAction(UserMetricsAction("NewWindow")); 634 content::RecordAction(UserMetricsAction("NewWindow"));
619 CommandLine command_line(CommandLine::NO_PROGRAM); 635 CommandLine command_line(CommandLine::NO_PROGRAM);
620 int return_code; 636 int return_code;
621 StartupBrowserCreator browser_creator; 637 StartupBrowserCreator browser_creator;
622 browser_creator.LaunchBrowser(command_line, profile, base::FilePath(), 638 browser_creator.LaunchBrowser(command_line, profile, base::FilePath(),
623 process_startup, is_first_run, &return_code); 639 process_startup, is_first_run, &return_code);
624 #endif // defined(OS_IOS) 640 #endif // defined(OS_IOS)
625 } 641 }
626 642
643 // static
644 void ProfileManager::SwitchToProfile(
645 const base::FilePath& path,
646 chrome::HostDesktopType desktop_type,
647 bool always_create) {
648 g_browser_process->profile_manager()->CreateProfileAsync(
649 path,
650 base::Bind(&OpenBrowserWindowForProfile,
651 always_create,
652 desktop_type),
653 string16(),
654 string16(),
655 false);
656 }
657
627 void ProfileManager::Observe( 658 void ProfileManager::Observe(
628 int type, 659 int type,
629 const content::NotificationSource& source, 660 const content::NotificationSource& source,
630 const content::NotificationDetails& details) { 661 const content::NotificationDetails& details) {
631 #if defined(OS_CHROMEOS) 662 #if defined(OS_CHROMEOS)
632 if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) { 663 if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) {
633 logged_in_ = true; 664 logged_in_ = true;
634 665
635 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 666 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
636 if (!command_line.HasSwitch(switches::kTestType)) { 667 if (!command_line.HasSwitch(switches::kTestType)) {
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 ProfileManager::ProfileInfo::ProfileInfo( 1186 ProfileManager::ProfileInfo::ProfileInfo(
1156 Profile* profile, 1187 Profile* profile,
1157 bool created) 1188 bool created)
1158 : profile(profile), 1189 : profile(profile),
1159 created(created) { 1190 created(created) {
1160 } 1191 }
1161 1192
1162 ProfileManager::ProfileInfo::~ProfileInfo() { 1193 ProfileManager::ProfileInfo::~ProfileInfo() {
1163 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); 1194 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release());
1164 } 1195 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698