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 <set> | 5 #include <set> |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile_manager.h" | 7 #include "chrome/browser/profiles/profile_manager.h" |
| 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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 QueueProfileDirectoryForDeletion(profile_dir); | 1020 QueueProfileDirectoryForDeletion(profile_dir); |
| 1021 cache.DeleteProfileFromCache(profile_dir); | 1021 cache.DeleteProfileFromCache(profile_dir); |
| 1022 | 1022 |
| 1023 ProfileMetrics::LogNumberOfProfiles(this, | 1023 ProfileMetrics::LogNumberOfProfiles(this, |
| 1024 ProfileMetrics::DELETE_PROFILE_EVENT); | 1024 ProfileMetrics::DELETE_PROFILE_EVENT); |
| 1025 } | 1025 } |
| 1026 | 1026 |
| 1027 // static | 1027 // static |
| 1028 void ProfileManager::ForceMultipleProfilesForTests(bool forcedValue) { | |
| 1029 is_multiple_profiles_forced_ = true; | |
| 1030 multiple_profiles_forced_value_ = forcedValue; | |
| 1031 } | |
| 1032 | |
| 1033 // static | |
| 1034 void ProfileManager::UnforceMultipleProfilesForTests() { | |
| 1035 is_multiple_profiles_forced_ = false; | |
| 1036 } | |
| 1037 | |
| 1038 // static | |
| 1028 bool ProfileManager::IsMultipleProfilesEnabled() { | 1039 bool ProfileManager::IsMultipleProfilesEnabled() { |
| 1040 if (is_multiple_profiles_forced_) | |
|
sail
2013/01/31 17:15:23
I think this should move to the very bottom
jwd
2013/01/31 19:26:11
See new comment and response.
| |
| 1041 return multiple_profiles_forced_value_; | |
| 1042 | |
| 1029 #if defined(OS_ANDROID) | 1043 #if defined(OS_ANDROID) |
| 1030 return false; | 1044 return false; |
| 1031 #endif | 1045 #endif |
| 1032 #if defined(OS_CHROMEOS) | 1046 #if defined(OS_CHROMEOS) |
| 1033 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles)) | 1047 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles)) |
| 1034 return false; | 1048 return false; |
| 1035 #endif | 1049 #endif |
| 1036 #if defined(ENABLE_MANAGED_USERS) | 1050 #if defined(ENABLE_MANAGED_USERS) |
| 1037 if (ManagedMode::IsInManagedMode()) | 1051 if (ManagedMode::IsInManagedMode()) |
| 1038 return false; | 1052 return false; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1087 ProfileManager::ProfileInfo::ProfileInfo( | 1101 ProfileManager::ProfileInfo::ProfileInfo( |
| 1088 Profile* profile, | 1102 Profile* profile, |
| 1089 bool created) | 1103 bool created) |
| 1090 : profile(profile), | 1104 : profile(profile), |
| 1091 created(created) { | 1105 created(created) { |
| 1092 } | 1106 } |
| 1093 | 1107 |
| 1094 ProfileManager::ProfileInfo::~ProfileInfo() { | 1108 ProfileManager::ProfileInfo::~ProfileInfo() { |
| 1095 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); | 1109 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); |
| 1096 } | 1110 } |
| 1111 | |
| 1112 // static | |
| 1113 bool ProfileManager::is_multiple_profiles_forced_ = false; | |
| 1114 | |
| 1115 // static | |
| 1116 bool ProfileManager::multiple_profiles_forced_value_ = true; | |
| OLD | NEW |