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

Side by Side Diff: chrome/browser/profiles/profile_impl.cc

Issue 7013046: Implemented a policy for centralized setting of the --disk-cache-dir flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Protected the policy from hitting ChromeOS. Created 9 years, 7 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 | Annotate | Revision Log
OLDNEW
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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 void GetCacheParameters(ContextType type, FilePath* cache_path, 145 void GetCacheParameters(ContextType type, FilePath* cache_path,
146 int* max_size) { 146 int* max_size) {
147 DCHECK(cache_path); 147 DCHECK(cache_path);
148 DCHECK(max_size); 148 DCHECK(max_size);
149 149
150 // Override the cache location if specified by the user. 150 // Override the cache location if specified by the user.
151 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDiskCacheDir)) { 151 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDiskCacheDir)) {
152 *cache_path = CommandLine::ForCurrentProcess()->GetSwitchValuePath( 152 *cache_path = CommandLine::ForCurrentProcess()->GetSwitchValuePath(
153 switches::kDiskCacheDir); 153 switches::kDiskCacheDir);
154 } 154 }
155 #if !defined(OS_CHROMEOS)
156 // And if a policy is set this should have even higher precedence.
157 PrefService* prefs = g_browser_process->local_state();
158 if (prefs && prefs->IsManagedPreference(prefs::kDiskCacheDir))
159 *cache_path = prefs->GetFilePath(prefs::kDiskCacheDir);
160 #endif
155 161
156 const char* arg = kNormalContext == type ? switches::kDiskCacheSize : 162 const char* arg = kNormalContext == type ? switches::kDiskCacheSize :
157 switches::kMediaCacheSize; 163 switches::kMediaCacheSize;
158 std::string value = 164 std::string value =
159 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(arg); 165 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(arg);
160 166
161 // By default we let the cache determine the right size. 167 // By default we let the cache determine the right size.
162 *max_size = 0; 168 *max_size = 0;
163 if (!base::StringToInt(value, max_size)) { 169 if (!base::StringToInt(value, max_size)) {
164 *max_size = 0; 170 *max_size = 0;
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 return pref_proxy_config_tracker_; 1591 return pref_proxy_config_tracker_;
1586 } 1592 }
1587 1593
1588 prerender::PrerenderManager* ProfileImpl::GetPrerenderManager() { 1594 prerender::PrerenderManager* ProfileImpl::GetPrerenderManager() {
1589 if (!prerender::PrerenderManager::IsPrerenderingPossible()) 1595 if (!prerender::PrerenderManager::IsPrerenderingPossible())
1590 return NULL; 1596 return NULL;
1591 if (!prerender_manager_.get()) 1597 if (!prerender_manager_.get())
1592 prerender_manager_.reset(new prerender::PrerenderManager(this)); 1598 prerender_manager_.reset(new prerender::PrerenderManager(this));
1593 return prerender_manager_.get(); 1599 return prerender_manager_.get();
1594 } 1600 }
OLDNEW
« no previous file with comments | « chrome/browser/policy/configuration_policy_provider_win_unittest.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698