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/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 PrefServiceSyncable* OffTheRecordProfileImpl::GetOffTheRecordPrefs() { | 247 PrefServiceSyncable* OffTheRecordProfileImpl::GetOffTheRecordPrefs() { |
248 return prefs_; | 248 return prefs_; |
249 } | 249 } |
250 | 250 |
251 DownloadManagerDelegate* OffTheRecordProfileImpl::GetDownloadManagerDelegate() { | 251 DownloadManagerDelegate* OffTheRecordProfileImpl::GetDownloadManagerDelegate() { |
252 return DownloadServiceFactory::GetForProfile(this)-> | 252 return DownloadServiceFactory::GetForProfile(this)-> |
253 GetDownloadManagerDelegate(); | 253 GetDownloadManagerDelegate(); |
254 } | 254 } |
255 | 255 |
256 net::URLRequestContextGetter* OffTheRecordProfileImpl::GetRequestContext() { | 256 net::URLRequestContextGetter* OffTheRecordProfileImpl::GetRequestContext() { |
257 return io_data_.GetMainRequestContextGetter(); | 257 return GetDefaultStoragePartition(this)->GetURLRequestContext(); |
| 258 } |
| 259 |
| 260 net::URLRequestContextGetter* OffTheRecordProfileImpl::CreateRequestContext( |
| 261 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 262 blob_protocol_handler, |
| 263 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 264 file_system_protocol_handler, |
| 265 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 266 developer_protocol_handler, |
| 267 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 268 chrome_protocol_handler, |
| 269 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 270 chrome_devtools_protocol_handler) { |
| 271 return io_data_.CreateMainRequestContextGetter(blob_protocol_handler.Pass(), |
| 272 file_system_protocol_handler.Pass(), developer_protocol_handler.Pass(), |
| 273 chrome_protocol_handler.Pass(), chrome_devtools_protocol_handler.Pass()); |
258 } | 274 } |
259 | 275 |
260 net::URLRequestContextGetter* | 276 net::URLRequestContextGetter* |
261 OffTheRecordProfileImpl::GetRequestContextForRenderProcess( | 277 OffTheRecordProfileImpl::GetRequestContextForRenderProcess( |
262 int renderer_child_id) { | 278 int renderer_child_id) { |
263 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 279 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
264 renderer_child_id); | 280 renderer_child_id); |
265 return rph->GetStoragePartition()->GetURLRequestContext(); | 281 return rph->GetStoragePartition()->GetURLRequestContext(); |
266 } | 282 } |
267 | 283 |
268 net::URLRequestContextGetter* | 284 net::URLRequestContextGetter* |
269 OffTheRecordProfileImpl::GetMediaRequestContext() { | 285 OffTheRecordProfileImpl::GetMediaRequestContext() { |
270 // In OTR mode, media request context is the same as the original one. | 286 // In OTR mode, media request context is the same as the original one. |
271 return GetRequestContext(); | 287 return GetRequestContext(); |
272 } | 288 } |
273 | 289 |
274 net::URLRequestContextGetter* | 290 net::URLRequestContextGetter* |
275 OffTheRecordProfileImpl::GetMediaRequestContextForRenderProcess( | 291 OffTheRecordProfileImpl::GetMediaRequestContextForRenderProcess( |
276 int renderer_child_id) { | 292 int renderer_child_id) { |
277 // In OTR mode, media request context is the same as the original one. | 293 // In OTR mode, media request context is the same as the original one. |
278 return GetRequestContextForRenderProcess(renderer_child_id); | 294 return GetRequestContextForRenderProcess(renderer_child_id); |
279 } | 295 } |
280 | 296 |
281 net::URLRequestContextGetter* | 297 net::URLRequestContextGetter* |
282 OffTheRecordProfileImpl::GetMediaRequestContextForStoragePartition( | 298 OffTheRecordProfileImpl::GetMediaRequestContextForStoragePartition( |
283 const FilePath& partition_path, | 299 const FilePath& partition_path, |
284 bool in_memory) { | 300 bool in_memory) { |
285 return GetRequestContextForStoragePartition(partition_path, in_memory); | 301 return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory); |
286 } | 302 } |
287 | 303 |
288 net::URLRequestContextGetter* | 304 net::URLRequestContextGetter* |
289 OffTheRecordProfileImpl::GetRequestContextForExtensions() { | 305 OffTheRecordProfileImpl::GetRequestContextForExtensions() { |
290 return io_data_.GetExtensionsRequestContextGetter(); | 306 return io_data_.GetExtensionsRequestContextGetter(); |
291 } | 307 } |
292 | 308 |
293 net::URLRequestContextGetter* | 309 net::URLRequestContextGetter* |
294 OffTheRecordProfileImpl::GetRequestContextForStoragePartition( | 310 OffTheRecordProfileImpl::CreateRequestContextForStoragePartition( |
295 const FilePath& partition_path, | 311 const FilePath& partition_path, |
296 bool in_memory) { | 312 bool in_memory, |
297 return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory); | 313 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 314 blob_protocol_handler, |
| 315 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 316 file_system_protocol_handler, |
| 317 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 318 developer_protocol_handler, |
| 319 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 320 chrome_protocol_handler, |
| 321 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 322 chrome_devtools_protocol_handler) { |
| 323 return io_data_.CreateIsolatedAppRequestContextGetter( |
| 324 partition_path, in_memory, blob_protocol_handler.Pass(), |
| 325 file_system_protocol_handler.Pass(), developer_protocol_handler.Pass(), |
| 326 chrome_protocol_handler.Pass(), chrome_devtools_protocol_handler.Pass()); |
298 } | 327 } |
299 | 328 |
300 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() { | 329 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() { |
301 return io_data_.GetResourceContext(); | 330 return io_data_.GetResourceContext(); |
302 } | 331 } |
303 | 332 |
304 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() { | 333 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() { |
305 return profile_->GetSSLConfigService(); | 334 return profile_->GetSSLConfigService(); |
306 } | 335 } |
307 | 336 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 void OffTheRecordProfileImpl::OnZoomLevelChanged(const std::string& host) { | 494 void OffTheRecordProfileImpl::OnZoomLevelChanged(const std::string& host) { |
466 if (host.empty()) | 495 if (host.empty()) |
467 return; | 496 return; |
468 | 497 |
469 HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this); | 498 HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this); |
470 HostZoomMap* parent_host_zoom_map = | 499 HostZoomMap* parent_host_zoom_map = |
471 HostZoomMap::GetForBrowserContext(profile_); | 500 HostZoomMap::GetForBrowserContext(profile_); |
472 double level = parent_host_zoom_map->GetZoomLevel(host); | 501 double level = parent_host_zoom_map->GetZoomLevel(host); |
473 host_zoom_map->SetZoomLevel(host, level); | 502 host_zoom_map->SetZoomLevel(host, level); |
474 } | 503 } |
OLD | NEW |