| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 } | 200 } |
| 201 | 201 |
| 202 virtual bool HasCreatedDownloadManager() const { | 202 virtual bool HasCreatedDownloadManager() const { |
| 203 return (download_manager_.get() != NULL); | 203 return (download_manager_.get() != NULL); |
| 204 } | 204 } |
| 205 | 205 |
| 206 virtual URLRequestContext* GetRequestContext() { | 206 virtual URLRequestContext* GetRequestContext() { |
| 207 return request_context_; | 207 return request_context_; |
| 208 } | 208 } |
| 209 | 209 |
| 210 virtual URLRequestContext* GetRequestContextForMedia() { |
| 211 if (!media_request_context_) { |
| 212 FilePath cache_path = GetPath(); |
| 213 cache_path.Append(chrome::kOffTheRecordMediaCacheDirname); |
| 214 media_request_context_ = |
| 215 ChromeURLRequestContext::CreateOffTheRecordForMedia( |
| 216 this, cache_path); |
| 217 media_request_context_->AddRef(); |
| 218 |
| 219 DCHECK(media_request_context_->cookie_store()); |
| 220 } |
| 221 return media_request_context_; |
| 222 } |
| 223 |
| 210 virtual SessionService* GetSessionService() { | 224 virtual SessionService* GetSessionService() { |
| 211 // Don't save any sessions when off the record. | 225 // Don't save any sessions when off the record. |
| 212 return NULL; | 226 return NULL; |
| 213 } | 227 } |
| 214 | 228 |
| 215 virtual void ShutdownSessionService() { | 229 virtual void ShutdownSessionService() { |
| 216 // We don't allow a session service, nothing to do. | 230 // We don't allow a session service, nothing to do. |
| 217 } | 231 } |
| 218 | 232 |
| 219 virtual bool HasSessionService() const { | 233 virtual bool HasSessionService() const { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 ExitedOffTheRecordMode(); | 318 ExitedOffTheRecordMode(); |
| 305 } | 319 } |
| 306 | 320 |
| 307 private: | 321 private: |
| 308 // The real underlying profile. | 322 // The real underlying profile. |
| 309 Profile* profile_; | 323 Profile* profile_; |
| 310 | 324 |
| 311 // The context to use for requests made from this OTR session. | 325 // The context to use for requests made from this OTR session. |
| 312 ChromeURLRequestContext* request_context_; | 326 ChromeURLRequestContext* request_context_; |
| 313 | 327 |
| 328 // The context for requests for media resources. |
| 329 ChromeURLRequestContext* media_request_context_; |
| 330 |
| 314 // The download manager that only stores downloaded items in memory. | 331 // The download manager that only stores downloaded items in memory. |
| 315 scoped_refptr<DownloadManager> download_manager_; | 332 scoped_refptr<DownloadManager> download_manager_; |
| 316 | 333 |
| 317 // We don't want SSLHostState from the OTR profile to leak back to the main | 334 // We don't want SSLHostState from the OTR profile to leak back to the main |
| 318 // profile because then the main profile would learn some of the host names | 335 // profile because then the main profile would learn some of the host names |
| 319 // the user visited while OTR. | 336 // the user visited while OTR. |
| 320 scoped_ptr<SSLHostState> ssl_host_state_; | 337 scoped_ptr<SSLHostState> ssl_host_state_; |
| 321 | 338 |
| 322 // Time we were started. | 339 // Time we were started. |
| 323 Time start_time_; | 340 Time start_time_; |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 NotificationType::DEFAULT_REQUEST_CONTEXT_AVAILABLE, | 596 NotificationType::DEFAULT_REQUEST_CONTEXT_AVAILABLE, |
| 580 NotificationService::AllSources(), NotificationService::NoDetails()); | 597 NotificationService::AllSources(), NotificationService::NoDetails()); |
| 581 } | 598 } |
| 582 | 599 |
| 583 DCHECK(request_context_->cookie_store()); | 600 DCHECK(request_context_->cookie_store()); |
| 584 } | 601 } |
| 585 | 602 |
| 586 return request_context_; | 603 return request_context_; |
| 587 } | 604 } |
| 588 | 605 |
| 606 URLRequestContext* ProfileImpl::GetRequestContextForMedia() { |
| 607 if (!media_request_context_) { |
| 608 FilePath cache_path = GetPath(); |
| 609 cache_path.Append(chrome::kMediaCacheDirname); |
| 610 media_request_context_ = ChromeURLRequestContext::CreateOriginalForMedia( |
| 611 this, cache_path); |
| 612 media_request_context_->AddRef(); |
| 613 |
| 614 DCHECK(media_request_context_->cookie_store()); |
| 615 } |
| 616 |
| 617 return media_request_context_; |
| 618 } |
| 619 |
| 589 HistoryService* ProfileImpl::GetHistoryService(ServiceAccessType sat) { | 620 HistoryService* ProfileImpl::GetHistoryService(ServiceAccessType sat) { |
| 590 if (!history_service_created_) { | 621 if (!history_service_created_) { |
| 591 history_service_created_ = true; | 622 history_service_created_ = true; |
| 592 scoped_refptr<HistoryService> history(new HistoryService(this)); | 623 scoped_refptr<HistoryService> history(new HistoryService(this)); |
| 593 if (!history->Init(GetPath(), GetBookmarkModel())) | 624 if (!history->Init(GetPath(), GetBookmarkModel())) |
| 594 return NULL; | 625 return NULL; |
| 595 history_service_.swap(history); | 626 history_service_.swap(history); |
| 596 | 627 |
| 597 // Send out the notification that the history service was created. | 628 // Send out the notification that the history service was created. |
| 598 NotificationService::current()-> | 629 NotificationService::current()-> |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 } | 861 } |
| 831 | 862 |
| 832 #ifdef CHROME_PERSONALIZATION | 863 #ifdef CHROME_PERSONALIZATION |
| 833 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { | 864 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { |
| 834 if (!personalization_.get()) | 865 if (!personalization_.get()) |
| 835 personalization_.reset( | 866 personalization_.reset( |
| 836 Personalization::CreateProfilePersonalization(this)); | 867 Personalization::CreateProfilePersonalization(this)); |
| 837 return personalization_.get(); | 868 return personalization_.get(); |
| 838 } | 869 } |
| 839 #endif | 870 #endif |
| OLD | NEW |