| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 #endif // defined(OS_CHROMEOS) | 113 #endif // defined(OS_CHROMEOS) |
| 114 | 114 |
| 115 InitHostZoomMap(); | 115 InitHostZoomMap(); |
| 116 | 116 |
| 117 // Make the chrome//extension-icon/ resource available. | 117 // Make the chrome//extension-icon/ resource available. |
| 118 ExtensionIconSource* icon_source = new ExtensionIconSource(profile_); | 118 ExtensionIconSource* icon_source = new ExtensionIconSource(profile_); |
| 119 content::URLDataSource::Add(this, icon_source); | 119 content::URLDataSource::Add(this, icon_source); |
| 120 | 120 |
| 121 #if defined(ENABLE_PLUGINS) | 121 #if defined(ENABLE_PLUGINS) |
| 122 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( | 122 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
| 123 PluginPrefs::GetForProfile(this), io_data_.GetResourceContextNoInit()); | 123 PluginPrefs::GetForProfile(this).get(), |
| 124 io_data_.GetResourceContextNoInit()); |
| 124 #endif | 125 #endif |
| 125 | 126 |
| 126 BrowserThread::PostTask( | 127 BrowserThread::PostTask( |
| 127 BrowserThread::IO, FROM_HERE, | 128 BrowserThread::IO, FROM_HERE, |
| 128 base::Bind(&NotifyOTRProfileCreatedOnIOThread, profile_, this)); | 129 base::Bind(&NotifyOTRProfileCreatedOnIOThread, profile_, this)); |
| 129 } | 130 } |
| 130 | 131 |
| 131 OffTheRecordProfileImpl::~OffTheRecordProfileImpl() { | 132 OffTheRecordProfileImpl::~OffTheRecordProfileImpl() { |
| 132 MaybeSendDestroyedNotification(); | 133 MaybeSendDestroyedNotification(); |
| 133 | 134 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 return DownloadServiceFactory::GetForProfile(this)-> | 240 return DownloadServiceFactory::GetForProfile(this)-> |
| 240 GetDownloadManagerDelegate(); | 241 GetDownloadManagerDelegate(); |
| 241 } | 242 } |
| 242 | 243 |
| 243 net::URLRequestContextGetter* OffTheRecordProfileImpl::GetRequestContext() { | 244 net::URLRequestContextGetter* OffTheRecordProfileImpl::GetRequestContext() { |
| 244 return GetDefaultStoragePartition(this)->GetURLRequestContext(); | 245 return GetDefaultStoragePartition(this)->GetURLRequestContext(); |
| 245 } | 246 } |
| 246 | 247 |
| 247 net::URLRequestContextGetter* OffTheRecordProfileImpl::CreateRequestContext( | 248 net::URLRequestContextGetter* OffTheRecordProfileImpl::CreateRequestContext( |
| 248 content::ProtocolHandlerMap* protocol_handlers) { | 249 content::ProtocolHandlerMap* protocol_handlers) { |
| 249 return io_data_.CreateMainRequestContextGetter(protocol_handlers); | 250 return io_data_.CreateMainRequestContextGetter(protocol_handlers).get(); |
| 250 } | 251 } |
| 251 | 252 |
| 252 net::URLRequestContextGetter* | 253 net::URLRequestContextGetter* |
| 253 OffTheRecordProfileImpl::GetRequestContextForRenderProcess( | 254 OffTheRecordProfileImpl::GetRequestContextForRenderProcess( |
| 254 int renderer_child_id) { | 255 int renderer_child_id) { |
| 255 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 256 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
| 256 renderer_child_id); | 257 renderer_child_id); |
| 257 return rph->GetStoragePartition()->GetURLRequestContext(); | 258 return rph->GetStoragePartition()->GetURLRequestContext(); |
| 258 } | 259 } |
| 259 | 260 |
| 260 net::URLRequestContextGetter* | 261 net::URLRequestContextGetter* |
| 261 OffTheRecordProfileImpl::GetMediaRequestContext() { | 262 OffTheRecordProfileImpl::GetMediaRequestContext() { |
| 262 // In OTR mode, media request context is the same as the original one. | 263 // In OTR mode, media request context is the same as the original one. |
| 263 return GetRequestContext(); | 264 return GetRequestContext(); |
| 264 } | 265 } |
| 265 | 266 |
| 266 net::URLRequestContextGetter* | 267 net::URLRequestContextGetter* |
| 267 OffTheRecordProfileImpl::GetMediaRequestContextForRenderProcess( | 268 OffTheRecordProfileImpl::GetMediaRequestContextForRenderProcess( |
| 268 int renderer_child_id) { | 269 int renderer_child_id) { |
| 269 // In OTR mode, media request context is the same as the original one. | 270 // In OTR mode, media request context is the same as the original one. |
| 270 return GetRequestContextForRenderProcess(renderer_child_id); | 271 return GetRequestContextForRenderProcess(renderer_child_id); |
| 271 } | 272 } |
| 272 | 273 |
| 273 net::URLRequestContextGetter* | 274 net::URLRequestContextGetter* |
| 274 OffTheRecordProfileImpl::GetMediaRequestContextForStoragePartition( | 275 OffTheRecordProfileImpl::GetMediaRequestContextForStoragePartition( |
| 275 const base::FilePath& partition_path, | 276 const base::FilePath& partition_path, |
| 276 bool in_memory) { | 277 bool in_memory) { |
| 277 return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory); | 278 return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory) |
| 279 .get(); |
| 278 } | 280 } |
| 279 | 281 |
| 280 net::URLRequestContextGetter* | 282 net::URLRequestContextGetter* |
| 281 OffTheRecordProfileImpl::GetRequestContextForExtensions() { | 283 OffTheRecordProfileImpl::GetRequestContextForExtensions() { |
| 282 return io_data_.GetExtensionsRequestContextGetter(); | 284 return io_data_.GetExtensionsRequestContextGetter().get(); |
| 283 } | 285 } |
| 284 | 286 |
| 285 net::URLRequestContextGetter* | 287 net::URLRequestContextGetter* |
| 286 OffTheRecordProfileImpl::CreateRequestContextForStoragePartition( | 288 OffTheRecordProfileImpl::CreateRequestContextForStoragePartition( |
| 287 const base::FilePath& partition_path, | 289 const base::FilePath& partition_path, |
| 288 bool in_memory, | 290 bool in_memory, |
| 289 content::ProtocolHandlerMap* protocol_handlers) { | 291 content::ProtocolHandlerMap* protocol_handlers) { |
| 290 return io_data_.CreateIsolatedAppRequestContextGetter( | 292 return io_data_.CreateIsolatedAppRequestContextGetter( |
| 291 partition_path, in_memory, protocol_handlers); | 293 partition_path, in_memory, protocol_handlers).get(); |
| 292 } | 294 } |
| 293 | 295 |
| 294 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() { | 296 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() { |
| 295 return io_data_.GetResourceContext(); | 297 return io_data_.GetResourceContext(); |
| 296 } | 298 } |
| 297 | 299 |
| 298 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() { | 300 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() { |
| 299 return profile_->GetSSLConfigService(); | 301 return profile_->GetSSLConfigService(); |
| 300 } | 302 } |
| 301 | 303 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 case HostZoomMap::ZOOM_CHANGED_FOR_HOST: | 463 case HostZoomMap::ZOOM_CHANGED_FOR_HOST: |
| 462 host_zoom_map->SetZoomLevelForHost(change.host, change.zoom_level); | 464 host_zoom_map->SetZoomLevelForHost(change.host, change.zoom_level); |
| 463 return; | 465 return; |
| 464 case HostZoomMap::ZOOM_CHANGED_FOR_SCHEME_AND_HOST: | 466 case HostZoomMap::ZOOM_CHANGED_FOR_SCHEME_AND_HOST: |
| 465 host_zoom_map->SetZoomLevelForHostAndScheme(change.scheme, | 467 host_zoom_map->SetZoomLevelForHostAndScheme(change.scheme, |
| 466 change.host, | 468 change.host, |
| 467 change.zoom_level); | 469 change.zoom_level); |
| 468 return; | 470 return; |
| 469 } | 471 } |
| 470 } | 472 } |
| OLD | NEW |