OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 std::string value = | 191 std::string value = |
192 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(arg); | 192 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(arg); |
193 | 193 |
194 // By default we let the cache determine the right size. | 194 // By default we let the cache determine the right size. |
195 *max_size = 0; | 195 *max_size = 0; |
196 if (!base::StringToInt(value, max_size)) { | 196 if (!base::StringToInt(value, max_size)) { |
197 *max_size = 0; | 197 *max_size = 0; |
198 } else if (*max_size < 0) { | 198 } else if (*max_size < 0) { |
199 *max_size = 0; | 199 *max_size = 0; |
200 } | 200 } |
201 #if !defined(OS_CHROMEOS) | |
202 // If a policy is controlling the cache size it should override any | |
203 // command line flags. | |
204 if (kNormalContext == type) { | |
205 if (prefs && prefs->IsManagedPreference(prefs::kDiskCacheSize)) | |
206 *max_size = prefs->GetInteger(prefs::kDiskCacheSize); | |
207 } else { | |
208 if (prefs && prefs->IsManagedPreference(prefs::kMediaCacheSize)) | |
209 *max_size = prefs->GetInteger(prefs::kMediaCacheSize); | |
210 } | |
Joao da Silva
2011/11/15 14:12:53
I think this policy should be user policy. The cac
| |
211 #endif | |
201 } | 212 } |
202 | 213 |
203 FilePath GetCachePath(const FilePath& base) { | 214 FilePath GetCachePath(const FilePath& base) { |
204 return base.Append(chrome::kCacheDirname); | 215 return base.Append(chrome::kCacheDirname); |
205 } | 216 } |
206 | 217 |
207 FilePath GetMediaCachePath(const FilePath& base) { | 218 FilePath GetMediaCachePath(const FilePath& base) { |
208 return base.Append(chrome::kMediaCacheDirname); | 219 return base.Append(chrome::kMediaCacheDirname); |
209 } | 220 } |
210 | 221 |
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1600 void ProfileImpl::UpdateProfileUserNameCache() { | 1611 void ProfileImpl::UpdateProfileUserNameCache() { |
1601 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1612 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
1602 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); | 1613 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
1603 size_t index = cache.GetIndexOfProfileWithPath(GetPath()); | 1614 size_t index = cache.GetIndexOfProfileWithPath(GetPath()); |
1604 if (index != std::string::npos) { | 1615 if (index != std::string::npos) { |
1605 std::string user_name = | 1616 std::string user_name = |
1606 GetPrefs()->GetString(prefs::kGoogleServicesUsername); | 1617 GetPrefs()->GetString(prefs::kGoogleServicesUsername); |
1607 cache.SetUserNameOfProfileAtIndex(index, UTF8ToUTF16(user_name)); | 1618 cache.SetUserNameOfProfileAtIndex(index, UTF8ToUTF16(user_name)); |
1608 } | 1619 } |
1609 } | 1620 } |
OLD | NEW |