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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "chrome/browser/background/background_contents_service_factory.h" | 16 #include "chrome/browser/background/background_contents_service_factory.h" |
17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/chrome_plugin_service_filter.h" | 18 #include "chrome/browser/chrome_plugin_service_filter.h" |
19 #include "chrome/browser/content_settings/host_content_settings_map.h" | 19 #include "chrome/browser/content_settings/host_content_settings_map.h" |
20 #include "chrome/browser/download/download_service.h" | 20 #include "chrome/browser/download/download_service.h" |
21 #include "chrome/browser/download/download_service_factory.h" | 21 #include "chrome/browser/download/download_service_factory.h" |
22 #include "chrome/browser/extensions/extension_info_map.h" | 22 #include "chrome/browser/extensions/extension_info_map.h" |
23 #include "chrome/browser/extensions/extension_message_service.h" | 23 #include "chrome/browser/extensions/extension_message_service.h" |
24 #include "chrome/browser/extensions/extension_pref_store.h" | 24 #include "chrome/browser/extensions/extension_pref_store.h" |
25 #include "chrome/browser/extensions/extension_process_manager.h" | 25 #include "chrome/browser/extensions/extension_process_manager.h" |
26 #include "chrome/browser/extensions/extension_service.h" | 26 #include "chrome/browser/extensions/extension_service.h" |
27 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 27 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
28 #include "chrome/browser/extensions/extension_webrequest_api.h" | 28 #include "chrome/browser/extensions/extension_webrequest_api.h" |
29 #include "chrome/browser/net/pref_proxy_config_service.h" | 29 #include "chrome/browser/net/proxy_service_factory.h" |
30 #include "chrome/browser/plugin_prefs.h" | 30 #include "chrome/browser/plugin_prefs.h" |
31 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 31 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
32 #include "chrome/browser/prefs/pref_service.h" | 32 #include "chrome/browser/prefs/pref_service.h" |
33 #include "chrome/browser/profiles/profile_dependency_manager.h" | 33 #include "chrome/browser/profiles/profile_dependency_manager.h" |
34 #include "chrome/browser/sync/profile_sync_service.h" | 34 #include "chrome/browser/sync/profile_sync_service.h" |
35 #include "chrome/browser/themes/theme_service.h" | 35 #include "chrome/browser/themes/theme_service.h" |
36 #include "chrome/browser/transport_security_persister.h" | 36 #include "chrome/browser/transport_security_persister.h" |
37 #include "chrome/browser/ui/find_bar/find_bar_state.h" | 37 #include "chrome/browser/ui/find_bar/find_bar_state.h" |
38 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 38 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
39 #include "chrome/browser/ui/webui/extension_icon_source.h" | 39 #include "chrome/browser/ui/webui/extension_icon_source.h" |
(...skipping 14 matching lines...) Expand all Loading... |
54 #include "content/browser/tab_contents/tab_contents.h" | 54 #include "content/browser/tab_contents/tab_contents.h" |
55 #include "content/public/browser/browser_thread.h" | 55 #include "content/public/browser/browser_thread.h" |
56 #include "content/public/browser/notification_service.h" | 56 #include "content/public/browser/notification_service.h" |
57 #include "net/base/transport_security_state.h" | 57 #include "net/base/transport_security_state.h" |
58 #include "net/http/http_server_properties.h" | 58 #include "net/http/http_server_properties.h" |
59 #include "webkit/database/database_tracker.h" | 59 #include "webkit/database/database_tracker.h" |
60 #include "webkit/quota/quota_manager.h" | 60 #include "webkit/quota/quota_manager.h" |
61 | 61 |
62 #if defined(OS_CHROMEOS) | 62 #if defined(OS_CHROMEOS) |
63 #include "chrome/browser/chromeos/preferences.h" | 63 #include "chrome/browser/chromeos/preferences.h" |
| 64 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
64 #endif | 65 #endif |
65 | 66 |
66 using content::BrowserThread; | 67 using content::BrowserThread; |
67 | 68 |
68 namespace { | 69 namespace { |
69 | 70 |
70 void NotifyOTRProfileCreatedOnIOThread(void* original_profile, | 71 void NotifyOTRProfileCreatedOnIOThread(void* original_profile, |
71 void* otr_profile) { | 72 void* otr_profile) { |
72 ExtensionWebRequestEventRouter::GetInstance()->OnOTRProfileCreated( | 73 ExtensionWebRequestEventRouter::GetInstance()->OnOTRProfileCreated( |
73 original_profile, otr_profile); | 74 original_profile, otr_profile); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 BrowserThread::FILE, FROM_HERE, | 139 BrowserThread::FILE, FROM_HERE, |
139 base::Bind(&webkit_database::DatabaseTracker::Shutdown, | 140 base::Bind(&webkit_database::DatabaseTracker::Shutdown, |
140 db_tracker_.get())); | 141 db_tracker_.get())); |
141 } | 142 } |
142 | 143 |
143 BrowserList::RemoveObserver(this); | 144 BrowserList::RemoveObserver(this); |
144 | 145 |
145 if (host_content_settings_map_) | 146 if (host_content_settings_map_) |
146 host_content_settings_map_->ShutdownOnUIThread(); | 147 host_content_settings_map_->ShutdownOnUIThread(); |
147 | 148 |
148 if (pref_proxy_config_tracker_) | 149 if (pref_proxy_config_tracker_.get()) |
149 pref_proxy_config_tracker_->DetachFromPrefService(); | 150 pref_proxy_config_tracker_->DetachFromPrefService(); |
150 | 151 |
151 ExtensionService* extension_service = GetExtensionService(); | 152 ExtensionService* extension_service = GetExtensionService(); |
152 if (extension_service) { | 153 if (extension_service) { |
153 ExtensionPrefs* extension_prefs = extension_service->extension_prefs(); | 154 ExtensionPrefs* extension_prefs = extension_service->extension_prefs(); |
154 extension_prefs->ClearIncognitoSessionOnlyContentSettings(); | 155 extension_prefs->ClearIncognitoSessionOnlyContentSettings(); |
155 } | 156 } |
156 } | 157 } |
157 | 158 |
158 std::string OffTheRecordProfileImpl::GetProfileName() { | 159 std::string OffTheRecordProfileImpl::GetProfileName() { |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 PrefProxyConfigTracker* 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 OffTheRecordProfileImpl* profile = NULL; | 652 OffTheRecordProfileImpl* profile = NULL; |
650 #if defined(OS_CHROMEOS) | 653 #if defined(OS_CHROMEOS) |
651 if (Profile::IsGuestSession()) | 654 if (Profile::IsGuestSession()) |
652 profile = new GuestSessionProfile(this); | 655 profile = new GuestSessionProfile(this); |
653 #endif | 656 #endif |
654 if (!profile) | 657 if (!profile) |
655 profile = new OffTheRecordProfileImpl(this); | 658 profile = new OffTheRecordProfileImpl(this); |
656 profile->Init(); | 659 profile->Init(); |
657 return profile; | 660 return profile; |
658 } | 661 } |
OLD | NEW |