| 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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/extensions/api/web_request/web_request_api.h" | 23 #include "chrome/browser/extensions/api/web_request/web_request_api.h" |
| 24 #include "chrome/browser/extensions/extension_info_map.h" | 24 #include "chrome/browser/extensions/extension_info_map.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_system.h" | 27 #include "chrome/browser/extensions/extension_system.h" |
| 28 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" | 28 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" |
| 29 #include "chrome/browser/geolocation/chrome_geolocation_permission_context_facto
ry.h" | 29 #include "chrome/browser/geolocation/chrome_geolocation_permission_context_facto
ry.h" |
| 30 #include "chrome/browser/io_thread.h" | 30 #include "chrome/browser/io_thread.h" |
| 31 #include "chrome/browser/media/chrome_midi_permission_context.h" | 31 #include "chrome/browser/media/chrome_midi_permission_context.h" |
| 32 #include "chrome/browser/media/chrome_midi_permission_context_factory.h" | 32 #include "chrome/browser/media/chrome_midi_permission_context_factory.h" |
| 33 #include "chrome/browser/net/cookie_store_util.h" |
| 33 #include "chrome/browser/net/pref_proxy_config_tracker.h" | 34 #include "chrome/browser/net/pref_proxy_config_tracker.h" |
| 34 #include "chrome/browser/net/proxy_service_factory.h" | 35 #include "chrome/browser/net/proxy_service_factory.h" |
| 35 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 36 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
| 36 #include "chrome/browser/plugins/plugin_prefs.h" | 37 #include "chrome/browser/plugins/plugin_prefs.h" |
| 37 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 38 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 38 #include "chrome/browser/prefs/pref_service_syncable.h" | 39 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 39 #include "chrome/browser/themes/theme_service.h" | 40 #include "chrome/browser/themes/theme_service.h" |
| 40 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 41 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 41 #include "chrome/common/chrome_constants.h" | 42 #include "chrome/common/chrome_constants.h" |
| 42 #include "chrome/common/chrome_paths.h" | 43 #include "chrome/common/chrome_paths.h" |
| 43 #include "chrome/common/chrome_switches.h" | 44 #include "chrome/common/chrome_switches.h" |
| 44 #include "chrome/common/extensions/extension.h" | 45 #include "chrome/common/extensions/extension.h" |
| 45 #include "chrome/common/pref_names.h" | 46 #include "chrome/common/pref_names.h" |
| 46 #include "chrome/common/render_messages.h" | 47 #include "chrome/common/render_messages.h" |
| 47 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 48 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
| 48 #include "components/user_prefs/user_prefs.h" | 49 #include "components/user_prefs/user_prefs.h" |
| 49 #include "content/public/browser/browser_thread.h" | 50 #include "content/public/browser/browser_thread.h" |
| 51 #include "content/public/browser/cookie_store_factory.h" |
| 50 #include "content/public/browser/host_zoom_map.h" | 52 #include "content/public/browser/host_zoom_map.h" |
| 51 #include "content/public/browser/render_process_host.h" | 53 #include "content/public/browser/render_process_host.h" |
| 52 #include "content/public/browser/storage_partition.h" | 54 #include "content/public/browser/storage_partition.h" |
| 53 #include "content/public/browser/url_data_source.h" | 55 #include "content/public/browser/url_data_source.h" |
| 54 #include "content/public/browser/web_contents.h" | 56 #include "content/public/browser/web_contents.h" |
| 55 #include "net/http/http_server_properties.h" | 57 #include "net/http/http_server_properties.h" |
| 56 #include "net/http/transport_security_state.h" | 58 #include "net/http/transport_security_state.h" |
| 57 #include "webkit/browser/database/database_tracker.h" | 59 #include "webkit/browser/database/database_tracker.h" |
| 58 | 60 |
| 59 #if defined(OS_ANDROID) || defined(OS_IOS) | 61 #if defined(OS_ANDROID) || defined(OS_IOS) |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 245 |
| 244 PrefService* OffTheRecordProfileImpl::GetOffTheRecordPrefs() { | 246 PrefService* OffTheRecordProfileImpl::GetOffTheRecordPrefs() { |
| 245 return prefs_; | 247 return prefs_; |
| 246 } | 248 } |
| 247 | 249 |
| 248 DownloadManagerDelegate* OffTheRecordProfileImpl::GetDownloadManagerDelegate() { | 250 DownloadManagerDelegate* OffTheRecordProfileImpl::GetDownloadManagerDelegate() { |
| 249 return DownloadServiceFactory::GetForBrowserContext(this)-> | 251 return DownloadServiceFactory::GetForBrowserContext(this)-> |
| 250 GetDownloadManagerDelegate(); | 252 GetDownloadManagerDelegate(); |
| 251 } | 253 } |
| 252 | 254 |
| 255 void OffTheRecordProfileImpl::OverrideCookieStoreConfigs( |
| 256 const base::FilePath& partition_path, |
| 257 bool in_memory_partition, |
| 258 bool is_default_partition, |
| 259 CookieSchemeMap* configs) { |
| 260 // The delegate is stateless so it's silly to create more than one per |
| 261 // profile. |
| 262 if (!cookie_delegate_) { |
| 263 cookie_delegate_ = chrome_browser_net::CreateCookieDelegate(this); |
| 264 } |
| 265 |
| 266 // Force everything to be to be in-memory. |
| 267 chrome_browser_net::SetCookieStoreConfigs( |
| 268 base::FilePath(), true, is_default_partition, |
| 269 content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, |
| 270 GetSpecialStoragePolicy(), cookie_delegate_, configs); |
| 271 } |
| 272 |
| 253 net::URLRequestContextGetter* OffTheRecordProfileImpl::GetRequestContext() { | 273 net::URLRequestContextGetter* OffTheRecordProfileImpl::GetRequestContext() { |
| 254 return GetDefaultStoragePartition(this)->GetURLRequestContext(); | 274 return GetDefaultStoragePartition(this)->GetURLRequestContext(); |
| 255 } | 275 } |
| 256 | 276 |
| 257 net::URLRequestContextGetter* OffTheRecordProfileImpl::CreateRequestContext( | 277 net::URLRequestContextGetter* OffTheRecordProfileImpl::CreateRequestContext( |
| 258 content::ProtocolHandlerMap* protocol_handlers) { | 278 content::ProtocolHandlerMap* protocol_handlers) { |
| 259 return io_data_.CreateMainRequestContextGetter(protocol_handlers).get(); | 279 return io_data_.CreateMainRequestContextGetter(protocol_handlers).get(); |
| 260 } | 280 } |
| 261 | 281 |
| 262 net::URLRequestContextGetter* | 282 net::URLRequestContextGetter* |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 const MIDISysExPermissionCallback& callback) { | 315 const MIDISysExPermissionCallback& callback) { |
| 296 ChromeMIDIPermissionContext* context = | 316 ChromeMIDIPermissionContext* context = |
| 297 ChromeMIDIPermissionContextFactory::GetForProfile(this); | 317 ChromeMIDIPermissionContextFactory::GetForProfile(this); |
| 298 context->RequestMIDISysExPermission(render_process_id, | 318 context->RequestMIDISysExPermission(render_process_id, |
| 299 render_view_id, | 319 render_view_id, |
| 300 requesting_frame, | 320 requesting_frame, |
| 301 callback); | 321 callback); |
| 302 } | 322 } |
| 303 | 323 |
| 304 net::URLRequestContextGetter* | 324 net::URLRequestContextGetter* |
| 305 OffTheRecordProfileImpl::GetRequestContextForExtensions() { | |
| 306 return io_data_.GetExtensionsRequestContextGetter().get(); | |
| 307 } | |
| 308 | |
| 309 net::URLRequestContextGetter* | |
| 310 OffTheRecordProfileImpl::CreateRequestContextForStoragePartition( | 325 OffTheRecordProfileImpl::CreateRequestContextForStoragePartition( |
| 311 const base::FilePath& partition_path, | 326 const base::FilePath& partition_path, |
| 312 bool in_memory, | 327 bool in_memory, |
| 313 content::ProtocolHandlerMap* protocol_handlers) { | 328 content::ProtocolHandlerMap* protocol_handlers) { |
| 314 return io_data_.CreateIsolatedAppRequestContextGetter( | 329 return io_data_.CreateIsolatedAppRequestContextGetter( |
| 315 partition_path, in_memory, protocol_handlers).get(); | 330 partition_path, in_memory, protocol_handlers).get(); |
| 316 } | 331 } |
| 317 | 332 |
| 318 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() { | 333 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() { |
| 319 return io_data_.GetResourceContext(); | 334 return io_data_.GetResourceContext(); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 PrefProxyConfigTracker* OffTheRecordProfileImpl::CreateProxyConfigTracker() { | 504 PrefProxyConfigTracker* OffTheRecordProfileImpl::CreateProxyConfigTracker() { |
| 490 #if defined(OS_CHROMEOS) | 505 #if defined(OS_CHROMEOS) |
| 491 if (chromeos::ProfileHelper::IsSigninProfile(this)) { | 506 if (chromeos::ProfileHelper::IsSigninProfile(this)) { |
| 492 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( | 507 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( |
| 493 g_browser_process->local_state()); | 508 g_browser_process->local_state()); |
| 494 } | 509 } |
| 495 #endif // defined(OS_CHROMEOS) | 510 #endif // defined(OS_CHROMEOS) |
| 496 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( | 511 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( |
| 497 GetPrefs(), g_browser_process->local_state()); | 512 GetPrefs(), g_browser_process->local_state()); |
| 498 } | 513 } |
| OLD | NEW |