summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profile.cc
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-23 18:57:14 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-23 18:57:14 +0000
commite3edeba811a05e3a87606b672182e8c106dbc3e9 (patch)
treed718f78bce96c1d71c80fa38a6661d46fccb324e /chrome/browser/profile.cc
parent3dac4560bd1ceb6abe94aaabc0bbee7ac7a87236 (diff)
downloadchromium_src-e3edeba811a05e3a87606b672182e8c106dbc3e9.zip
chromium_src-e3edeba811a05e3a87606b672182e8c106dbc3e9.tar.gz
chromium_src-e3edeba811a05e3a87606b672182e8c106dbc3e9.tar.bz2
BUG=9094
GetRequestContextForMedia() in ProfileImpl and OffTheRecordProfileImpl now respect --disk-cache-dir. Since the snippet for getting the path from --disk-cache-dir is very short, it's not necessary to keep it in a separate method so I duplicated the snippet and used it in both classes. Review URL: http://codereview.chromium.org/42517 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12298 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profile.cc')
-rw-r--r--chrome/browser/profile.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 352d96582..224dd8d 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -214,6 +214,15 @@ class OffTheRecordProfileImpl : public Profile,
virtual URLRequestContext* GetRequestContextForMedia() {
if (!media_request_context_) {
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.Append(chrome::kOffTheRecordMediaCacheDirname);
media_request_context_ =
ChromeURLRequestContext::CreateOffTheRecordForMedia(
@@ -617,6 +626,15 @@ URLRequestContext* ProfileImpl::GetRequestContext() {
URLRequestContext* ProfileImpl::GetRequestContextForMedia() {
if (!media_request_context_) {
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.Append(chrome::kMediaCacheDirname);
media_request_context_ = ChromeURLRequestContext::CreateOriginalForMedia(
this, cache_path);