Chromium Code Reviews| Index: chrome/browser/profile.cc |
| =================================================================== |
| --- chrome/browser/profile.cc (revision 8504) |
| +++ chrome/browser/profile.cc (working copy) |
| @@ -493,6 +493,33 @@ |
| std::wstring cookie_path = GetPath(); |
| file_util::AppendToPath(&cookie_path, chrome::kCookieFilename); |
| std::wstring cache_path = GetPath(); |
| + |
| + // Override the cache location if specified so |
|
rvargas (doing something else)
2009/01/27 03:55:20
nit: Each comment has to be a complete sentence (a
|
| + const std::wstring user_cache_dir( |
| + CommandLine::ForCurrentProcess()->GetSwitchValue( |
|
rvargas (doing something else)
2009/01/27 03:55:20
nit: wrong indentation. See http://dev.chromium.or
|
| + switches::kDiskCacheLocation)); |
| + if (!user_cache_dir.empty()) { |
| + // Create the directory if necessary. The browser needs it to |
| + // exist to populate it. |
| + if (file_util::DirectoryExists(user_cache_dir) || |
|
rvargas (doing something else)
2009/01/27 03:55:20
Remove all the code that creates the folder. That
|
| + file_util::CreateDirectory(user_cache_dir)) { |
| + // This last check reflects the real need - we need a directory |
| + // that we can add content to |
| + if (file_util::PathIsWritable(user_cache_dir)) { |
| + cache_path = user_cache_dir; |
| + } else { |
| + // Failing silently is the idea here, since this functionality is |
| + // simply not important. If the user has specified an unusable |
| + // path, the user can figure out how to make it work. If he cannot, |
| + // he is probably not the kind of user who would care about moving |
| + // the cache anyway. Command line options will eventually have |
| + // to be documented somewhere, and then we can document the |
| + // condition that the path must exist or its immediate parent |
| + // must be writable. |
| + } |
| + } |
| + } |
| + |
| file_util::AppendToPath(&cache_path, chrome::kCacheDirname); |
| request_context_ = ChromeURLRequestContext::CreateOriginal( |
| this, cookie_path, cache_path); |
| @@ -511,6 +538,7 @@ |
| DCHECK(request_context_->cookie_store()); |
| } |
|
rvargas (doing something else)
2009/01/27 03:55:20
nit: remove
|
| + |
| return request_context_; |
| } |