summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-07 01:58:42 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-07 01:58:42 +0000
commit2b2830a2e1d94bd353e6a8b16f3572c4ae36c436 (patch)
tree118e60cb40ea252e143b273ad1407bf194730b1a /chrome
parent0a836048108542bb8d10fe399b1ee08f6615501c (diff)
downloadchromium_src-2b2830a2e1d94bd353e6a8b16f3572c4ae36c436.zip
chromium_src-2b2830a2e1d94bd353e6a8b16f3572c4ae36c436.tar.gz
chromium_src-2b2830a2e1d94bd353e6a8b16f3572c4ae36c436.tar.bz2
Adds a command line switch to allow the user to specify the location
of the disk cache, rather than in the profile directory. The command line switch overrides the cache location regardless the chosen profile. In this implementation, the supplied directory name must should not contain spaces. BUG=6688 submitted by bekkra. original code review http://codereview.chromium.org/21094/show git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9375 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/profile.cc9
-rw-r--r--chrome/common/chrome_switches.cc4
-rw-r--r--chrome/common/chrome_switches.h1
3 files changed, 14 insertions, 0 deletions
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 95b0afc..158a9e1 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -532,6 +532,15 @@ URLRequestContext* ProfileImpl::GetRequestContext() {
FilePath cookie_path = GetPath();
cookie_path = cookie_path.Append(chrome::kCookieFilename);
FilePath cache_path = GetPath();
+
+ // Override the cache location if specified by the user.
+ const std::wstring user_cache_dir(
+ CommandLine::ForCurrentProcess()->GetSwitchValue(
+ switches::kDiskCacheDir));
+ if (!user_cache_dir.empty()) {
+ cache_path = FilePath::FromWStringHack(user_cache_dir);
+ }
+
cache_path = cache_path.Append(chrome::kCacheDirname);
request_context_ = ChromeURLRequestContext::CreateOriginal(
this, cookie_path, cache_path);
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 00e7f11..1e5a622 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -116,6 +116,10 @@ const wchar_t kUserDataDir[] = L"user-data-dir";
// specifically) will store its state.
const wchar_t kPluginDataDir[] = L"plugin-data-dir";
+// Use a specific disk cache location, rather than one derived from the
+// UserDatadir.
+const wchar_t kDiskCacheDir[] = L"disk-cache-dir";
+
// Specifies the path to the user data folder for the parent profile.
const wchar_t kParentProfile[] = L"parent-profile";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 4305374..a64f632 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -40,6 +40,7 @@ extern const wchar_t kTrustedPlugins[];
extern const wchar_t kTestSandbox[];
extern const wchar_t kUserDataDir[];
extern const wchar_t kPluginDataDir[];
+extern const wchar_t kDiskCacheDir[];
extern const wchar_t kParentProfile[];
extern const wchar_t kApp[];
extern const wchar_t kAppUploadFile[];