OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
8 #include "app/theme_provider.h" | 8 #include "app/theme_provider.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/env_var.h" | 10 #include "base/env_var.h" |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile | 295 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile |
296 // to make it suitable for the off the record mode. | 296 // to make it suitable for the off the record mode. |
297 // | 297 // |
298 //////////////////////////////////////////////////////////////////////////////// | 298 //////////////////////////////////////////////////////////////////////////////// |
299 class OffTheRecordProfileImpl : public Profile, | 299 class OffTheRecordProfileImpl : public Profile, |
300 public NotificationObserver { | 300 public NotificationObserver { |
301 public: | 301 public: |
302 explicit OffTheRecordProfileImpl(Profile* real_profile) | 302 explicit OffTheRecordProfileImpl(Profile* real_profile) |
303 : profile_(real_profile), | 303 : profile_(real_profile), |
304 start_time_(Time::Now()) { | 304 start_time_(Time::Now()) { |
| 305 ssl_config_service_manager_.reset( |
| 306 SSLConfigServiceManager::CreateDefaultManager(this)); |
| 307 |
305 request_context_ = ChromeURLRequestContextGetter::CreateOffTheRecord(this); | 308 request_context_ = ChromeURLRequestContextGetter::CreateOffTheRecord(this); |
306 | 309 |
307 // Register for browser close notifications so we can detect when the last | 310 // Register for browser close notifications so we can detect when the last |
308 // off-the-record window is closed, in which case we can clean our states | 311 // off-the-record window is closed, in which case we can clean our states |
309 // (cookies, downloads...). | 312 // (cookies, downloads...). |
310 registrar_.Add(this, NotificationType::BROWSER_CLOSED, | 313 registrar_.Add(this, NotificationType::BROWSER_CLOSED, |
311 NotificationService::AllSources()); | 314 NotificationService::AllSources()); |
312 background_contents_service_.reset( | 315 background_contents_service_.reset( |
313 new BackgroundContentsService(this, CommandLine::ForCurrentProcess())); | 316 new BackgroundContentsService(this, CommandLine::ForCurrentProcess())); |
314 } | 317 } |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 virtual URLRequestContextGetter* GetRequestContextForMedia() { | 512 virtual URLRequestContextGetter* GetRequestContextForMedia() { |
510 // In OTR mode, media request context is the same as the original one. | 513 // In OTR mode, media request context is the same as the original one. |
511 return request_context_; | 514 return request_context_; |
512 } | 515 } |
513 | 516 |
514 URLRequestContextGetter* GetRequestContextForExtensions() { | 517 URLRequestContextGetter* GetRequestContextForExtensions() { |
515 return GetOriginalProfile()->GetRequestContextForExtensions(); | 518 return GetOriginalProfile()->GetRequestContextForExtensions(); |
516 } | 519 } |
517 | 520 |
518 virtual net::SSLConfigService* GetSSLConfigService() { | 521 virtual net::SSLConfigService* GetSSLConfigService() { |
519 return profile_->GetSSLConfigService(); | 522 return ssl_config_service_manager_->Get(); |
520 } | 523 } |
521 | 524 |
522 virtual HostContentSettingsMap* GetHostContentSettingsMap() { | 525 virtual HostContentSettingsMap* GetHostContentSettingsMap() { |
523 // Retrieve the host content settings map of the parent profile in order to | 526 // Retrieve the host content settings map of the parent profile in order to |
524 // ensure the preferences have been migrated. | 527 // ensure the preferences have been migrated. |
525 profile_->GetHostContentSettingsMap(); | 528 profile_->GetHostContentSettingsMap(); |
526 if (!host_content_settings_map_.get()) | 529 if (!host_content_settings_map_.get()) |
527 host_content_settings_map_ = new HostContentSettingsMap(this); | 530 host_content_settings_map_ = new HostContentSettingsMap(this); |
528 return host_content_settings_map_.get(); | 531 return host_content_settings_map_.get(); |
529 } | 532 } |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 scoped_refptr<net::TransportSecurityState> | 721 scoped_refptr<net::TransportSecurityState> |
719 transport_security_state_; | 722 transport_security_state_; |
720 | 723 |
721 // Time we were started. | 724 // Time we were started. |
722 Time start_time_; | 725 Time start_time_; |
723 | 726 |
724 // The main database tracker for this profile. | 727 // The main database tracker for this profile. |
725 // Should be used only on the file thread. | 728 // Should be used only on the file thread. |
726 scoped_refptr<webkit_database::DatabaseTracker> db_tracker_; | 729 scoped_refptr<webkit_database::DatabaseTracker> db_tracker_; |
727 | 730 |
| 731 scoped_ptr<SSLConfigServiceManager> ssl_config_service_manager_; |
| 732 |
728 FilePath last_selected_directory_; | 733 FilePath last_selected_directory_; |
729 | 734 |
730 // Tracks all BackgroundContents running under this profile. | 735 // Tracks all BackgroundContents running under this profile. |
731 scoped_ptr<BackgroundContentsService> background_contents_service_; | 736 scoped_ptr<BackgroundContentsService> background_contents_service_; |
732 | 737 |
733 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl); | 738 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl); |
734 }; | 739 }; |
735 | 740 |
736 ProfileImpl::ProfileImpl(const FilePath& path) | 741 ProfileImpl::ProfileImpl(const FilePath& path) |
737 : path_(path), | 742 : path_(path), |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 new ProfileSyncFactoryImpl(this, CommandLine::ForCurrentProcess())); | 1680 new ProfileSyncFactoryImpl(this, CommandLine::ForCurrentProcess())); |
1676 sync_service_.reset( | 1681 sync_service_.reset( |
1677 profile_sync_factory_->CreateProfileSyncService()); | 1682 profile_sync_factory_->CreateProfileSyncService()); |
1678 sync_service_->Initialize(); | 1683 sync_service_->Initialize(); |
1679 } | 1684 } |
1680 | 1685 |
1681 void ProfileImpl::InitCloudPrintProxyService() { | 1686 void ProfileImpl::InitCloudPrintProxyService() { |
1682 cloud_print_proxy_service_.reset(new CloudPrintProxyService(this)); | 1687 cloud_print_proxy_service_.reset(new CloudPrintProxyService(this)); |
1683 cloud_print_proxy_service_->Initialize(); | 1688 cloud_print_proxy_service_->Initialize(); |
1684 } | 1689 } |
OLD | NEW |