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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 base::UTF16ToUTF8(cache.ChooseNameForNewProfile(avatar_index)); | 785 base::UTF16ToUTF8(cache.ChooseNameForNewProfile(avatar_index)); |
786 } | 786 } |
787 } | 787 } |
788 | 788 |
789 if (!profile->GetPrefs()->HasPrefPath(prefs::kProfileAvatarIndex)) | 789 if (!profile->GetPrefs()->HasPrefPath(prefs::kProfileAvatarIndex)) |
790 profile->GetPrefs()->SetInteger(prefs::kProfileAvatarIndex, avatar_index); | 790 profile->GetPrefs()->SetInteger(prefs::kProfileAvatarIndex, avatar_index); |
791 | 791 |
792 if (!profile->GetPrefs()->HasPrefPath(prefs::kProfileName)) | 792 if (!profile->GetPrefs()->HasPrefPath(prefs::kProfileName)) |
793 profile->GetPrefs()->SetString(prefs::kProfileName, profile_name); | 793 profile->GetPrefs()->SetString(prefs::kProfileName, profile_name); |
794 | 794 |
795 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 795 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
796 bool force_supervised_user_id = | 796 bool force_supervised_user_id = |
797 command_line->HasSwitch(switches::kSupervisedUserId); | 797 command_line->HasSwitch(switches::kSupervisedUserId); |
798 if (force_supervised_user_id) { | 798 if (force_supervised_user_id) { |
799 supervised_user_id = | 799 supervised_user_id = |
800 command_line->GetSwitchValueASCII(switches::kSupervisedUserId); | 800 command_line->GetSwitchValueASCII(switches::kSupervisedUserId); |
801 } | 801 } |
802 if (force_supervised_user_id || | 802 if (force_supervised_user_id || |
803 !profile->GetPrefs()->HasPrefPath(prefs::kSupervisedUserId)) { | 803 !profile->GetPrefs()->HasPrefPath(prefs::kSupervisedUserId)) { |
804 profile->GetPrefs()->SetString(prefs::kSupervisedUserId, | 804 profile->GetPrefs()->SetString(prefs::kSupervisedUserId, |
805 supervised_user_id); | 805 supervised_user_id); |
(...skipping 21 matching lines...) Expand all Loading... |
827 } | 827 } |
828 | 828 |
829 void ProfileManager::Observe( | 829 void ProfileManager::Observe( |
830 int type, | 830 int type, |
831 const content::NotificationSource& source, | 831 const content::NotificationSource& source, |
832 const content::NotificationDetails& details) { | 832 const content::NotificationDetails& details) { |
833 #if defined(OS_CHROMEOS) | 833 #if defined(OS_CHROMEOS) |
834 if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) { | 834 if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) { |
835 logged_in_ = true; | 835 logged_in_ = true; |
836 | 836 |
837 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 837 const base::CommandLine& command_line = |
| 838 *base::CommandLine::ForCurrentProcess(); |
838 if (!command_line.HasSwitch(switches::kTestType)) { | 839 if (!command_line.HasSwitch(switches::kTestType)) { |
839 // If we don't have a mounted profile directory we're in trouble. | 840 // If we don't have a mounted profile directory we're in trouble. |
840 // TODO(davemoore) Once we have better api this check should ensure that | 841 // TODO(davemoore) Once we have better api this check should ensure that |
841 // our profile directory is the one that's mounted, and that it's mounted | 842 // our profile directory is the one that's mounted, and that it's mounted |
842 // as the current user. | 843 // as the current user. |
843 chromeos::DBusThreadManager::Get()->GetCryptohomeClient()->IsMounted( | 844 chromeos::DBusThreadManager::Get()->GetCryptohomeClient()->IsMounted( |
844 base::Bind(&CheckCryptohomeIsMounted)); | 845 base::Bind(&CheckCryptohomeIsMounted)); |
845 | 846 |
846 // Confirm that we hadn't loaded the new profile previously. | 847 // Confirm that we hadn't loaded the new profile previously. |
847 base::FilePath default_profile_dir = user_data_dir_.Append( | 848 base::FilePath default_profile_dir = user_data_dir_.Append( |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 last_non_supervised_profile_path.BaseName().MaybeAsASCII()); | 1353 last_non_supervised_profile_path.BaseName().MaybeAsASCII()); |
1353 FinishDeletingProfile(profile_to_delete_path); | 1354 FinishDeletingProfile(profile_to_delete_path); |
1354 } | 1355 } |
1355 } | 1356 } |
1356 } | 1357 } |
1357 #endif | 1358 #endif |
1358 | 1359 |
1359 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 1360 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
1360 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 1361 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
1361 } | 1362 } |
OLD | NEW |