| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/files/file_path.h" | 10 #include "base/files/file_path.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/prefs/json_pref_store.h" | 13 #include "base/prefs/json_pref_store.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "chrome/browser/background/background_contents_service_factory.h" | 17 #include "chrome/browser/background/background_contents_service_factory.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.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/chrome_download_manager_delegate.h" | 20 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 21 #include "chrome/browser/download/download_service.h" | 21 #include "chrome/browser/download/download_service.h" |
| 22 #include "chrome/browser/download/download_service_factory.h" | 22 #include "chrome/browser/download/download_service_factory.h" |
| 23 #include "chrome/browser/extensions/extension_service.h" | |
| 24 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 23 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 25 #include "chrome/browser/io_thread.h" | 24 #include "chrome/browser/io_thread.h" |
| 26 #include "chrome/browser/net/pref_proxy_config_tracker.h" | 25 #include "chrome/browser/net/pref_proxy_config_tracker.h" |
| 27 #include "chrome/browser/net/proxy_service_factory.h" | 26 #include "chrome/browser/net/proxy_service_factory.h" |
| 28 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 27 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
| 29 #include "chrome/browser/plugins/plugin_prefs.h" | 28 #include "chrome/browser/plugins/plugin_prefs.h" |
| 30 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 29 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 31 #include "chrome/browser/prefs/pref_service_syncable.h" | 30 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 32 #include "chrome/browser/themes/theme_service.h" | 31 #include "chrome/browser/themes/theme_service.h" |
| 33 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 32 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 34 #include "chrome/common/chrome_constants.h" | 33 #include "chrome/common/chrome_constants.h" |
| 35 #include "chrome/common/chrome_paths.h" | 34 #include "chrome/common/chrome_paths.h" |
| 36 #include "chrome/common/chrome_switches.h" | 35 #include "chrome/common/chrome_switches.h" |
| 37 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
| 38 #include "chrome/common/render_messages.h" | 37 #include "chrome/common/render_messages.h" |
| 39 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 38 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 40 #include "components/user_prefs/user_prefs.h" | 39 #include "components/user_prefs/user_prefs.h" |
| 41 #include "content/public/browser/browser_thread.h" | 40 #include "content/public/browser/browser_thread.h" |
| 42 #include "content/public/browser/host_zoom_map.h" | 41 #include "content/public/browser/host_zoom_map.h" |
| 43 #include "content/public/browser/render_process_host.h" | 42 #include "content/public/browser/render_process_host.h" |
| 44 #include "content/public/browser/storage_partition.h" | 43 #include "content/public/browser/storage_partition.h" |
| 45 #include "content/public/browser/url_data_source.h" | 44 #include "content/public/browser/url_data_source.h" |
| 46 #include "content/public/browser/web_contents.h" | 45 #include "content/public/browser/web_contents.h" |
| 47 #include "extensions/browser/extension_system.h" | |
| 48 #include "extensions/common/extension.h" | |
| 49 #include "net/http/http_server_properties.h" | 46 #include "net/http/http_server_properties.h" |
| 50 #include "net/http/transport_security_state.h" | 47 #include "net/http/transport_security_state.h" |
| 51 #include "webkit/browser/database/database_tracker.h" | 48 #include "webkit/browser/database/database_tracker.h" |
| 52 | 49 |
| 53 #if defined(OS_ANDROID) | 50 #if defined(OS_ANDROID) |
| 54 #include "chrome/browser/media/protected_media_identifier_permission_context.h" | 51 #include "chrome/browser/media/protected_media_identifier_permission_context.h" |
| 55 #include "chrome/browser/media/protected_media_identifier_permission_context_fac
tory.h" | 52 #include "chrome/browser/media/protected_media_identifier_permission_context_fac
tory.h" |
| 56 #endif // defined(OS_ANDROID) | 53 #endif // defined(OS_ANDROID) |
| 57 | 54 |
| 58 #if defined(OS_ANDROID) || defined(OS_IOS) | 55 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 59 #include "base/prefs/scoped_user_pref_update.h" | 56 #include "base/prefs/scoped_user_pref_update.h" |
| 60 #include "chrome/browser/prefs/proxy_prefs.h" | 57 #include "chrome/browser/prefs/proxy_prefs.h" |
| 61 #endif // defined(OS_ANDROID) || defined(OS_IOS) | 58 #endif // defined(OS_ANDROID) || defined(OS_IOS) |
| 62 | 59 |
| 63 #if defined(OS_CHROMEOS) | 60 #if defined(OS_CHROMEOS) |
| 64 #include "chrome/browser/chromeos/preferences.h" | 61 #include "chrome/browser/chromeos/preferences.h" |
| 65 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 62 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 66 #endif | 63 #endif |
| 67 | 64 |
| 68 #if defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS) | 65 #if defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS) |
| 69 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 66 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| 70 #endif | 67 #endif |
| 71 | 68 |
| 72 #if defined(ENABLE_EXTENSIONS) | 69 #if defined(ENABLE_EXTENSIONS) |
| 73 #include "chrome/browser/guest_view/guest_view_manager.h" | |
| 74 #endif | |
| 75 | |
| 76 #if defined(ENABLE_EXTENSIONS) | |
| 77 #include "chrome/browser/extensions/api/web_request/web_request_api.h" | 70 #include "chrome/browser/extensions/api/web_request/web_request_api.h" |
| 71 #include "chrome/browser/guest_view/guest_view_manager.h" |
| 72 #include "extensions/browser/extension_system.h" |
| 73 #include "extensions/common/extension.h" |
| 78 #endif | 74 #endif |
| 79 | 75 |
| 80 using content::BrowserThread; | 76 using content::BrowserThread; |
| 81 using content::DownloadManagerDelegate; | 77 using content::DownloadManagerDelegate; |
| 82 using content::HostZoomMap; | 78 using content::HostZoomMap; |
| 83 | 79 |
| 84 #if defined(ENABLE_EXTENSIONS) | 80 #if defined(ENABLE_EXTENSIONS) |
| 85 namespace { | 81 namespace { |
| 86 | 82 |
| 87 void NotifyOTRProfileCreatedOnIOThread(void* original_profile, | 83 void NotifyOTRProfileCreatedOnIOThread(void* original_profile, |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 } | 248 } |
| 253 | 249 |
| 254 bool OffTheRecordProfileImpl::HasOffTheRecordProfile() { | 250 bool OffTheRecordProfileImpl::HasOffTheRecordProfile() { |
| 255 return true; | 251 return true; |
| 256 } | 252 } |
| 257 | 253 |
| 258 Profile* OffTheRecordProfileImpl::GetOriginalProfile() { | 254 Profile* OffTheRecordProfileImpl::GetOriginalProfile() { |
| 259 return profile_; | 255 return profile_; |
| 260 } | 256 } |
| 261 | 257 |
| 262 ExtensionService* OffTheRecordProfileImpl::GetExtensionService() { | |
| 263 return extensions::ExtensionSystem::Get(this)->extension_service(); | |
| 264 } | |
| 265 | |
| 266 ExtensionSpecialStoragePolicy* | 258 ExtensionSpecialStoragePolicy* |
| 267 OffTheRecordProfileImpl::GetExtensionSpecialStoragePolicy() { | 259 OffTheRecordProfileImpl::GetExtensionSpecialStoragePolicy() { |
| 268 return GetOriginalProfile()->GetExtensionSpecialStoragePolicy(); | 260 return GetOriginalProfile()->GetExtensionSpecialStoragePolicy(); |
| 269 } | 261 } |
| 270 | 262 |
| 271 bool OffTheRecordProfileImpl::IsSupervised() { | 263 bool OffTheRecordProfileImpl::IsSupervised() { |
| 272 return GetOriginalProfile()->IsSupervised(); | 264 return GetOriginalProfile()->IsSupervised(); |
| 273 } | 265 } |
| 274 | 266 |
| 275 PrefService* OffTheRecordProfileImpl::GetPrefs() { | 267 PrefService* OffTheRecordProfileImpl::GetPrefs() { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 return profile_->GetSSLConfigService(); | 343 return profile_->GetSSLConfigService(); |
| 352 } | 344 } |
| 353 | 345 |
| 354 HostContentSettingsMap* OffTheRecordProfileImpl::GetHostContentSettingsMap() { | 346 HostContentSettingsMap* OffTheRecordProfileImpl::GetHostContentSettingsMap() { |
| 355 // Retrieve the host content settings map of the parent profile in order to | 347 // Retrieve the host content settings map of the parent profile in order to |
| 356 // ensure the preferences have been migrated. | 348 // ensure the preferences have been migrated. |
| 357 profile_->GetHostContentSettingsMap(); | 349 profile_->GetHostContentSettingsMap(); |
| 358 if (!host_content_settings_map_.get()) { | 350 if (!host_content_settings_map_.get()) { |
| 359 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), true); | 351 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), true); |
| 360 #if defined(ENABLE_EXTENSIONS) | 352 #if defined(ENABLE_EXTENSIONS) |
| 361 ExtensionService* extension_service = GetExtensionService(); | 353 ExtensionService* extension_service = |
| 354 extensions::ExtensionSystem::Get(this)->extension_service(); |
| 362 if (extension_service) | 355 if (extension_service) |
| 363 host_content_settings_map_->RegisterExtensionService(extension_service); | 356 host_content_settings_map_->RegisterExtensionService(extension_service); |
| 364 #endif | 357 #endif |
| 365 } | 358 } |
| 366 return host_content_settings_map_.get(); | 359 return host_content_settings_map_.get(); |
| 367 } | 360 } |
| 368 | 361 |
| 369 content::BrowserPluginGuestManager* | 362 content::BrowserPluginGuestManager* |
| 370 OffTheRecordProfileImpl::GetGuestManager() { | 363 OffTheRecordProfileImpl::GetGuestManager() { |
| 371 #if defined(ENABLE_EXTENSIONS) | 364 #if defined(ENABLE_EXTENSIONS) |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 PrefProxyConfigTracker* OffTheRecordProfileImpl::CreateProxyConfigTracker() { | 524 PrefProxyConfigTracker* OffTheRecordProfileImpl::CreateProxyConfigTracker() { |
| 532 #if defined(OS_CHROMEOS) | 525 #if defined(OS_CHROMEOS) |
| 533 if (chromeos::ProfileHelper::IsSigninProfile(this)) { | 526 if (chromeos::ProfileHelper::IsSigninProfile(this)) { |
| 534 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( | 527 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( |
| 535 g_browser_process->local_state()); | 528 g_browser_process->local_state()); |
| 536 } | 529 } |
| 537 #endif // defined(OS_CHROMEOS) | 530 #endif // defined(OS_CHROMEOS) |
| 538 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( | 531 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( |
| 539 GetPrefs(), g_browser_process->local_state()); | 532 GetPrefs(), g_browser_process->local_state()); |
| 540 } | 533 } |
| OLD | NEW |