| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 return (download_manager_.get() != NULL); | 207 return (download_manager_.get() != NULL); |
| 208 } | 208 } |
| 209 | 209 |
| 210 virtual URLRequestContext* GetRequestContext() { | 210 virtual URLRequestContext* GetRequestContext() { |
| 211 return request_context_; | 211 return request_context_; |
| 212 } | 212 } |
| 213 | 213 |
| 214 virtual URLRequestContext* GetRequestContextForMedia() { | 214 virtual URLRequestContext* GetRequestContextForMedia() { |
| 215 if (!media_request_context_) { | 215 if (!media_request_context_) { |
| 216 FilePath cache_path = GetPath(); | 216 FilePath cache_path = GetPath(); |
| 217 |
| 218 // Override the cache location if specified by the user. |
| 219 const std::wstring user_cache_dir( |
| 220 CommandLine::ForCurrentProcess()->GetSwitchValue( |
| 221 switches::kDiskCacheDir)); |
| 222 if (!user_cache_dir.empty()) { |
| 223 cache_path = FilePath::FromWStringHack(user_cache_dir); |
| 224 } |
| 225 |
| 217 cache_path.Append(chrome::kOffTheRecordMediaCacheDirname); | 226 cache_path.Append(chrome::kOffTheRecordMediaCacheDirname); |
| 218 media_request_context_ = | 227 media_request_context_ = |
| 219 ChromeURLRequestContext::CreateOffTheRecordForMedia( | 228 ChromeURLRequestContext::CreateOffTheRecordForMedia( |
| 220 this, cache_path); | 229 this, cache_path); |
| 221 media_request_context_->AddRef(); | 230 media_request_context_->AddRef(); |
| 222 | 231 |
| 223 DCHECK(media_request_context_->cookie_store()); | 232 DCHECK(media_request_context_->cookie_store()); |
| 224 } | 233 } |
| 225 return media_request_context_; | 234 return media_request_context_; |
| 226 } | 235 } |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 | 619 |
| 611 DCHECK(request_context_->cookie_store()); | 620 DCHECK(request_context_->cookie_store()); |
| 612 } | 621 } |
| 613 | 622 |
| 614 return request_context_; | 623 return request_context_; |
| 615 } | 624 } |
| 616 | 625 |
| 617 URLRequestContext* ProfileImpl::GetRequestContextForMedia() { | 626 URLRequestContext* ProfileImpl::GetRequestContextForMedia() { |
| 618 if (!media_request_context_) { | 627 if (!media_request_context_) { |
| 619 FilePath cache_path = GetPath(); | 628 FilePath cache_path = GetPath(); |
| 629 |
| 630 // Override the cache location if specified by the user. |
| 631 const std::wstring user_cache_dir( |
| 632 CommandLine::ForCurrentProcess()->GetSwitchValue( |
| 633 switches::kDiskCacheDir)); |
| 634 if (!user_cache_dir.empty()) { |
| 635 cache_path = FilePath::FromWStringHack(user_cache_dir); |
| 636 } |
| 637 |
| 620 cache_path.Append(chrome::kMediaCacheDirname); | 638 cache_path.Append(chrome::kMediaCacheDirname); |
| 621 media_request_context_ = ChromeURLRequestContext::CreateOriginalForMedia( | 639 media_request_context_ = ChromeURLRequestContext::CreateOriginalForMedia( |
| 622 this, cache_path); | 640 this, cache_path); |
| 623 media_request_context_->AddRef(); | 641 media_request_context_->AddRef(); |
| 624 | 642 |
| 625 DCHECK(media_request_context_->cookie_store()); | 643 DCHECK(media_request_context_->cookie_store()); |
| 626 } | 644 } |
| 627 | 645 |
| 628 return media_request_context_; | 646 return media_request_context_; |
| 629 } | 647 } |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 | 892 |
| 875 #ifdef CHROME_PERSONALIZATION | 893 #ifdef CHROME_PERSONALIZATION |
| 876 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { | 894 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { |
| 877 DCHECK(!Personalization::IsP13NDisabled()); | 895 DCHECK(!Personalization::IsP13NDisabled()); |
| 878 if (!personalization_.get()) | 896 if (!personalization_.get()) |
| 879 personalization_.reset( | 897 personalization_.reset( |
| 880 Personalization::CreateProfilePersonalization(this)); | 898 Personalization::CreateProfilePersonalization(this)); |
| 881 return personalization_.get(); | 899 return personalization_.get(); |
| 882 } | 900 } |
| 883 #endif | 901 #endif |
| OLD | NEW |