Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 813 } | 813 } |
| 814 } | 814 } |
| 815 | 815 |
| 816 void ProfileManager::Observe( | 816 void ProfileManager::Observe( |
| 817 int type, | 817 int type, |
| 818 const content::NotificationSource& source, | 818 const content::NotificationSource& source, |
| 819 const content::NotificationDetails& details) { | 819 const content::NotificationDetails& details) { |
| 820 #if defined(OS_CHROMEOS) | 820 #if defined(OS_CHROMEOS) |
| 821 if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) { | 821 if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) { |
| 822 logged_in_ = true; | 822 logged_in_ = true; |
| 823 // Find out what the current user is and update it. This has only to be done | |
| 824 // when the profile was already loaded, since otherwise this will be set by | |
| 825 // the profile loading process. | |
| 826 user_manager::UserManager* manager = user_manager::UserManager::Get(); | |
| 827 const user_manager::User* user = manager->GetActiveUser(); | |
| 828 if (user && user->is_profile_created()) { | |
| 829 UpdateLastUser( | |
| 830 chromeos::ProfileHelper::Get()->GetProfileByUser(user)); | |
| 831 } | |
| 832 | 823 |
| 833 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 824 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 834 if (!command_line.HasSwitch(switches::kTestType)) { | 825 if (!command_line.HasSwitch(switches::kTestType)) { |
| 835 // If we don't have a mounted profile directory we're in trouble. | 826 // If we don't have a mounted profile directory we're in trouble. |
| 836 // TODO(davemoore) Once we have better api this check should ensure that | 827 // TODO(davemoore) Once we have better api this check should ensure that |
| 837 // our profile directory is the one that's mounted, and that it's mounted | 828 // our profile directory is the one that's mounted, and that it's mounted |
| 838 // as the current user. | 829 // as the current user. |
| 839 chromeos::DBusThreadManager::Get()->GetCryptohomeClient()->IsMounted( | 830 chromeos::DBusThreadManager::Get()->GetCryptohomeClient()->IsMounted( |
| 840 base::Bind(&CheckCryptohomeIsMounted)); | 831 base::Bind(&CheckCryptohomeIsMounted)); |
| 841 | 832 |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1222 bool created) | 1213 bool created) |
| 1223 : profile(profile), | 1214 : profile(profile), |
| 1224 created(created) { | 1215 created(created) { |
| 1225 } | 1216 } |
| 1226 | 1217 |
| 1227 ProfileManager::ProfileInfo::~ProfileInfo() { | 1218 ProfileManager::ProfileInfo::~ProfileInfo() { |
| 1228 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); | 1219 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); |
| 1229 } | 1220 } |
| 1230 | 1221 |
| 1231 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 1222 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 1232 void ProfileManager::UpdateLastUser(Profile* last_active) { | 1223 void ProfileManager::UpdateLastUser(Profile* last_active) { |
|
Mr4D (OOO till 08-26)
2014/09/25 20:12:30
Since this makes no sense on ChromeOS, you might w
Nikita (slow)
2014/09/26 06:30:53
Done. Added comment in header. On Chrome OS this m
| |
| 1233 PrefService* local_state = g_browser_process->local_state(); | 1224 PrefService* local_state = g_browser_process->local_state(); |
| 1234 DCHECK(local_state); | 1225 DCHECK(local_state); |
| 1235 // Only keep track of profiles that we are managing; tests may create others. | 1226 // Only keep track of profiles that we are managing; tests may create others. |
| 1236 if (profiles_info_.find(last_active->GetPath()) != profiles_info_.end()) { | 1227 if (profiles_info_.find(last_active->GetPath()) != profiles_info_.end()) { |
| 1237 local_state->SetString(prefs::kProfileLastUsed, | 1228 local_state->SetString(prefs::kProfileLastUsed, |
| 1238 last_active->GetPath().BaseName().MaybeAsASCII()); | 1229 last_active->GetPath().BaseName().MaybeAsASCII()); |
| 1239 | 1230 |
| 1240 ProfileInfoCache& cache = GetProfileInfoCache(); | 1231 ProfileInfoCache& cache = GetProfileInfoCache(); |
| 1241 size_t profile_index = | 1232 size_t profile_index = |
| 1242 cache.GetIndexOfProfileWithPath(last_active->GetPath()); | 1233 cache.GetIndexOfProfileWithPath(last_active->GetPath()); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1321 last_non_supervised_profile_path.BaseName().MaybeAsASCII()); | 1312 last_non_supervised_profile_path.BaseName().MaybeAsASCII()); |
| 1322 FinishDeletingProfile(profile_to_delete_path); | 1313 FinishDeletingProfile(profile_to_delete_path); |
| 1323 } | 1314 } |
| 1324 } | 1315 } |
| 1325 } | 1316 } |
| 1326 #endif | 1317 #endif |
| 1327 | 1318 |
| 1328 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 1319 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
| 1329 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 1320 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
| 1330 } | 1321 } |
| OLD | NEW |