| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/profiles/off_the_record_profile_impl.h" | 5 #include "chrome/browser/profiles/off_the_record_profile_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "chrome/browser/background/background_contents_service_factory.h" | 15 #include "chrome/browser/background/background_contents_service_factory.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/chrome_plugin_service_filter.h" | 17 #include "chrome/browser/chrome_plugin_service_filter.h" |
| 18 #include "chrome/browser/content_settings/host_content_settings_map.h" | 18 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 19 #include "chrome/browser/download/download_service.h" | 19 #include "chrome/browser/download/download_service.h" |
| 20 #include "chrome/browser/download/download_service_factory.h" | 20 #include "chrome/browser/download/download_service_factory.h" |
| 21 #include "chrome/browser/extensions/extension_info_map.h" | 21 #include "chrome/browser/extensions/extension_info_map.h" |
| 22 #include "chrome/browser/extensions/extension_message_service.h" | 22 #include "chrome/browser/extensions/extension_message_service.h" |
| 23 #include "chrome/browser/extensions/extension_pref_store.h" | 23 #include "chrome/browser/extensions/extension_pref_store.h" |
| 24 #include "chrome/browser/extensions/extension_process_manager.h" | 24 #include "chrome/browser/extensions/extension_process_manager.h" |
| 25 #include "chrome/browser/extensions/extension_service.h" | 25 #include "chrome/browser/extensions/extension_service.h" |
| 26 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 26 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 27 #include "chrome/browser/extensions/extension_webrequest_api.h" | 27 #include "chrome/browser/extensions/extension_webrequest_api.h" |
| 28 #include "chrome/browser/net/pref_proxy_config_service.h" | 28 #include "chrome/browser/net/proxy_service_factory.h" |
| 29 #include "chrome/browser/plugin_prefs.h" | 29 #include "chrome/browser/plugin_prefs.h" |
| 30 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 30 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 31 #include "chrome/browser/prefs/pref_service.h" | 31 #include "chrome/browser/prefs/pref_service.h" |
| 32 #include "chrome/browser/profiles/profile_dependency_manager.h" | 32 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 33 #include "chrome/browser/sync/profile_sync_service.h" | 33 #include "chrome/browser/sync/profile_sync_service.h" |
| 34 #include "chrome/browser/themes/theme_service.h" | 34 #include "chrome/browser/themes/theme_service.h" |
| 35 #include "chrome/browser/transport_security_persister.h" | 35 #include "chrome/browser/transport_security_persister.h" |
| 36 #include "chrome/browser/ui/find_bar/find_bar_state.h" | 36 #include "chrome/browser/ui/find_bar/find_bar_state.h" |
| 37 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 37 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 38 #include "chrome/browser/ui/webui/extension_icon_source.h" | 38 #include "chrome/browser/ui/webui/extension_icon_source.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 53 #include "content/browser/ssl/ssl_host_state.h" | 53 #include "content/browser/ssl/ssl_host_state.h" |
| 54 #include "content/browser/tab_contents/tab_contents.h" | 54 #include "content/browser/tab_contents/tab_contents.h" |
| 55 #include "content/public/browser/notification_service.h" | 55 #include "content/public/browser/notification_service.h" |
| 56 #include "net/base/transport_security_state.h" | 56 #include "net/base/transport_security_state.h" |
| 57 #include "net/http/http_server_properties.h" | 57 #include "net/http/http_server_properties.h" |
| 58 #include "webkit/database/database_tracker.h" | 58 #include "webkit/database/database_tracker.h" |
| 59 #include "webkit/quota/quota_manager.h" | 59 #include "webkit/quota/quota_manager.h" |
| 60 | 60 |
| 61 #if defined(OS_CHROMEOS) | 61 #if defined(OS_CHROMEOS) |
| 62 #include "chrome/browser/chromeos/preferences.h" | 62 #include "chrome/browser/chromeos/preferences.h" |
| 63 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
| 63 #endif | 64 #endif |
| 64 | 65 |
| 65 namespace { | 66 namespace { |
| 66 | 67 |
| 67 void NotifyOTRProfileCreatedOnIOThread(void* original_profile, | 68 void NotifyOTRProfileCreatedOnIOThread(void* original_profile, |
| 68 void* otr_profile) { | 69 void* otr_profile) { |
| 69 ExtensionWebRequestEventRouter::GetInstance()->OnOTRProfileCreated( | 70 ExtensionWebRequestEventRouter::GetInstance()->OnOTRProfileCreated( |
| 70 original_profile, otr_profile); | 71 original_profile, otr_profile); |
| 71 } | 72 } |
| 72 | 73 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 BrowserThread::FILE, FROM_HERE, | 138 BrowserThread::FILE, FROM_HERE, |
| 138 NewRunnableMethod(db_tracker_.get(), | 139 NewRunnableMethod(db_tracker_.get(), |
| 139 &webkit_database::DatabaseTracker::Shutdown)); | 140 &webkit_database::DatabaseTracker::Shutdown)); |
| 140 } | 141 } |
| 141 | 142 |
| 142 BrowserList::RemoveObserver(this); | 143 BrowserList::RemoveObserver(this); |
| 143 | 144 |
| 144 if (host_content_settings_map_) | 145 if (host_content_settings_map_) |
| 145 host_content_settings_map_->ShutdownOnUIThread(); | 146 host_content_settings_map_->ShutdownOnUIThread(); |
| 146 | 147 |
| 147 if (pref_proxy_config_tracker_) | 148 if (pref_proxy_config_tracker_.get()) |
| 148 pref_proxy_config_tracker_->DetachFromPrefService(); | 149 pref_proxy_config_tracker_->DetachFromPrefService(); |
| 149 | 150 |
| 150 ExtensionService* extension_service = GetExtensionService(); | 151 ExtensionService* extension_service = GetExtensionService(); |
| 151 if (extension_service) { | 152 if (extension_service) { |
| 152 ExtensionPrefs* extension_prefs = extension_service->extension_prefs(); | 153 ExtensionPrefs* extension_prefs = extension_service->extension_prefs(); |
| 153 extension_prefs->ClearIncognitoSessionOnlyContentSettings(); | 154 extension_prefs->ClearIncognitoSessionOnlyContentSettings(); |
| 154 } | 155 } |
| 155 } | 156 } |
| 156 | 157 |
| 157 std::string OffTheRecordProfileImpl::GetProfileName() { | 158 std::string OffTheRecordProfileImpl::GetProfileName() { |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 | 542 |
| 542 #if defined(OS_CHROMEOS) | 543 #if defined(OS_CHROMEOS) |
| 543 void OffTheRecordProfileImpl::ChangeAppLocale(const std::string& locale, | 544 void OffTheRecordProfileImpl::ChangeAppLocale(const std::string& locale, |
| 544 AppLocaleChangedVia) { | 545 AppLocaleChangedVia) { |
| 545 } | 546 } |
| 546 | 547 |
| 547 void OffTheRecordProfileImpl::OnLogin() { | 548 void OffTheRecordProfileImpl::OnLogin() { |
| 548 } | 549 } |
| 549 #endif // defined(OS_CHROMEOS) | 550 #endif // defined(OS_CHROMEOS) |
| 550 | 551 |
| 551 PrefProxyConfigTracker* OffTheRecordProfileImpl::GetProxyConfigTracker() { | 552 PrefProxyConfigTrackerType* OffTheRecordProfileImpl::GetProxyConfigTracker() { |
| 552 if (!pref_proxy_config_tracker_) | 553 if (!pref_proxy_config_tracker_.get()) { |
| 553 pref_proxy_config_tracker_ = new PrefProxyConfigTracker(GetPrefs()); | 554 pref_proxy_config_tracker_.reset( |
| 554 return pref_proxy_config_tracker_; | 555 ProxyServiceFactory::CreatePrefProxyConfigTracker(GetPrefs())); |
| 556 } |
| 557 return pref_proxy_config_tracker_.get(); |
| 555 } | 558 } |
| 556 | 559 |
| 557 chrome_browser_net::Predictor* OffTheRecordProfileImpl::GetNetworkPredictor() { | 560 chrome_browser_net::Predictor* OffTheRecordProfileImpl::GetNetworkPredictor() { |
| 558 // We do not store information about websites visited in OTR profiles which | 561 // We do not store information about websites visited in OTR profiles which |
| 559 // is necessary for a Predictor, so we do not have a Predictor at all. | 562 // is necessary for a Predictor, so we do not have a Predictor at all. |
| 560 return NULL; | 563 return NULL; |
| 561 } | 564 } |
| 562 | 565 |
| 563 void OffTheRecordProfileImpl::ClearNetworkingHistorySince(base::Time time) { | 566 void OffTheRecordProfileImpl::ClearNetworkingHistorySince(base::Time time) { |
| 564 // No need to do anything here, our transport security state is read-only. | 567 // No need to do anything here, our transport security state is read-only. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 OffTheRecordProfileImpl* profile = NULL; | 649 OffTheRecordProfileImpl* profile = NULL; |
| 647 #if defined(OS_CHROMEOS) | 650 #if defined(OS_CHROMEOS) |
| 648 if (Profile::IsGuestSession()) | 651 if (Profile::IsGuestSession()) |
| 649 profile = new GuestSessionProfile(this); | 652 profile = new GuestSessionProfile(this); |
| 650 #endif | 653 #endif |
| 651 if (!profile) | 654 if (!profile) |
| 652 profile = new OffTheRecordProfileImpl(this); | 655 profile = new OffTheRecordProfileImpl(this); |
| 653 profile->Init(); | 656 profile->Init(); |
| 654 return profile; | 657 return profile; |
| 655 } | 658 } |
| OLD | NEW |