OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/profile.h" | 5 #include "chrome/browser/profile.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 FilePath pref_file_path = path_; | 525 FilePath pref_file_path = path_; |
526 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); | 526 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); |
527 return pref_file_path; | 527 return pref_file_path; |
528 } | 528 } |
529 | 529 |
530 URLRequestContext* ProfileImpl::GetRequestContext() { | 530 URLRequestContext* ProfileImpl::GetRequestContext() { |
531 if (!request_context_) { | 531 if (!request_context_) { |
532 FilePath cookie_path = GetPath(); | 532 FilePath cookie_path = GetPath(); |
533 cookie_path = cookie_path.Append(chrome::kCookieFilename); | 533 cookie_path = cookie_path.Append(chrome::kCookieFilename); |
534 FilePath cache_path = GetPath(); | 534 FilePath cache_path = GetPath(); |
| 535 |
| 536 // Override the cache location if specified by the user. |
| 537 const std::wstring user_cache_dir( |
| 538 CommandLine::ForCurrentProcess()->GetSwitchValue( |
| 539 switches::kDiskCacheDir)); |
| 540 if (!user_cache_dir.empty()) { |
| 541 cache_path = FilePath::FromWStringHack(user_cache_dir); |
| 542 } |
| 543 |
535 cache_path = cache_path.Append(chrome::kCacheDirname); | 544 cache_path = cache_path.Append(chrome::kCacheDirname); |
536 request_context_ = ChromeURLRequestContext::CreateOriginal( | 545 request_context_ = ChromeURLRequestContext::CreateOriginal( |
537 this, cookie_path, cache_path); | 546 this, cookie_path, cache_path); |
538 request_context_->AddRef(); | 547 request_context_->AddRef(); |
539 | 548 |
540 // The first request context is always a normal (non-OTR) request context. | 549 // The first request context is always a normal (non-OTR) request context. |
541 // Even when Chromium is started in OTR mode, a normal profile is always | 550 // Even when Chromium is started in OTR mode, a normal profile is always |
542 // created first. | 551 // created first. |
543 if (!default_request_context_) { | 552 if (!default_request_context_) { |
544 default_request_context_ = request_context_; | 553 default_request_context_ = request_context_; |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 } | 806 } |
798 | 807 |
799 #ifdef CHROME_PERSONALIZATION | 808 #ifdef CHROME_PERSONALIZATION |
800 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { | 809 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { |
801 if (!personalization_.get()) | 810 if (!personalization_.get()) |
802 personalization_.reset( | 811 personalization_.reset( |
803 Personalization::CreateProfilePersonalization(this)); | 812 Personalization::CreateProfilePersonalization(this)); |
804 return personalization_.get(); | 813 return personalization_.get(); |
805 } | 814 } |
806 #endif | 815 #endif |
OLD | NEW |