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_io_data.h" | 5 #include "chrome/browser/profiles/off_the_record_profile_io_data.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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 scoped_refptr<ChromeURLRequestContextGetter> | 71 scoped_refptr<ChromeURLRequestContextGetter> |
72 OffTheRecordProfileIOData::Handle::CreateMainRequestContextGetter( | 72 OffTheRecordProfileIOData::Handle::CreateMainRequestContextGetter( |
73 content::ProtocolHandlerMap* protocol_handlers) const { | 73 content::ProtocolHandlerMap* protocol_handlers) const { |
74 // TODO(oshima): Re-enable when ChromeOS only accesses the profile on the UI | 74 // TODO(oshima): Re-enable when ChromeOS only accesses the profile on the UI |
75 // thread. | 75 // thread. |
76 #if !defined(OS_CHROMEOS) | 76 #if !defined(OS_CHROMEOS) |
77 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 77 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
78 #endif // defined(OS_CHROMEOS) | 78 #endif // defined(OS_CHROMEOS) |
79 LazyInitialize(); | 79 LazyInitialize(); |
80 DCHECK(!main_request_context_getter_); | 80 DCHECK(!main_request_context_getter_.get()); |
81 main_request_context_getter_ = | 81 main_request_context_getter_ = |
82 ChromeURLRequestContextGetter::CreateOffTheRecord( | 82 ChromeURLRequestContextGetter::CreateOffTheRecord( |
83 profile_, io_data_, protocol_handlers); | 83 profile_, io_data_, protocol_handlers); |
84 return main_request_context_getter_; | 84 return main_request_context_getter_; |
85 } | 85 } |
86 | 86 |
87 scoped_refptr<ChromeURLRequestContextGetter> | 87 scoped_refptr<ChromeURLRequestContextGetter> |
88 OffTheRecordProfileIOData::Handle::GetExtensionsRequestContextGetter() const { | 88 OffTheRecordProfileIOData::Handle::GetExtensionsRequestContextGetter() const { |
89 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 89 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
90 LazyInitialize(); | 90 LazyInitialize(); |
91 if (!extensions_request_context_getter_) { | 91 if (!extensions_request_context_getter_.get()) { |
92 extensions_request_context_getter_ = | 92 extensions_request_context_getter_ = |
93 ChromeURLRequestContextGetter::CreateOffTheRecordForExtensions( | 93 ChromeURLRequestContextGetter::CreateOffTheRecordForExtensions( |
94 profile_, io_data_); | 94 profile_, io_data_); |
95 } | 95 } |
96 return extensions_request_context_getter_; | 96 return extensions_request_context_getter_; |
97 } | 97 } |
98 | 98 |
99 scoped_refptr<ChromeURLRequestContextGetter> | 99 scoped_refptr<ChromeURLRequestContextGetter> |
100 OffTheRecordProfileIOData::Handle::GetIsolatedAppRequestContextGetter( | 100 OffTheRecordProfileIOData::Handle::GetIsolatedAppRequestContextGetter( |
101 const base::FilePath& partition_path, | 101 const base::FilePath& partition_path, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 main_context->set_http_server_properties(http_server_properties()); | 194 main_context->set_http_server_properties(http_server_properties()); |
195 | 195 |
196 // For incognito, we use a non-persistent server bound cert store. | 196 // For incognito, we use a non-persistent server bound cert store. |
197 net::ServerBoundCertService* server_bound_cert_service = | 197 net::ServerBoundCertService* server_bound_cert_service = |
198 new net::ServerBoundCertService( | 198 new net::ServerBoundCertService( |
199 new net::DefaultServerBoundCertStore(NULL), | 199 new net::DefaultServerBoundCertStore(NULL), |
200 base::WorkerPool::GetTaskRunner(true)); | 200 base::WorkerPool::GetTaskRunner(true)); |
201 set_server_bound_cert_service(server_bound_cert_service); | 201 set_server_bound_cert_service(server_bound_cert_service); |
202 main_context->set_server_bound_cert_service(server_bound_cert_service); | 202 main_context->set_server_bound_cert_service(server_bound_cert_service); |
203 | 203 |
204 main_context->set_cookie_store( | 204 main_context->set_cookie_store(new net::CookieMonster( |
205 new net::CookieMonster(NULL, profile_params->cookie_monster_delegate)); | 205 NULL, profile_params->cookie_monster_delegate.get())); |
206 | 206 |
207 net::HttpCache::BackendFactory* main_backend = | 207 net::HttpCache::BackendFactory* main_backend = |
208 net::HttpCache::DefaultBackend::InMemory(0); | 208 net::HttpCache::DefaultBackend::InMemory(0); |
209 net::HttpNetworkSession::Params network_session_params; | 209 net::HttpNetworkSession::Params network_session_params; |
210 PopulateNetworkSessionParams(profile_params, &network_session_params); | 210 PopulateNetworkSessionParams(profile_params, &network_session_params); |
211 net::HttpCache* cache = new net::HttpCache( | 211 net::HttpCache* cache = new net::HttpCache( |
212 network_session_params, main_backend); | 212 network_session_params, main_backend); |
213 | 213 |
214 main_http_factory_.reset(cache); | 214 main_http_factory_.reset(cache); |
215 main_context->set_http_transaction_factory(cache); | 215 main_context->set_http_transaction_factory(cache); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 ChromeURLRequestContext* app_context, | 350 ChromeURLRequestContext* app_context, |
351 const StoragePartitionDescriptor& partition_descriptor) const { | 351 const StoragePartitionDescriptor& partition_descriptor) const { |
352 NOTREACHED(); | 352 NOTREACHED(); |
353 return NULL; | 353 return NULL; |
354 } | 354 } |
355 | 355 |
356 chrome_browser_net::LoadTimeStats* OffTheRecordProfileIOData::GetLoadTimeStats( | 356 chrome_browser_net::LoadTimeStats* OffTheRecordProfileIOData::GetLoadTimeStats( |
357 IOThread::Globals* io_thread_globals) const { | 357 IOThread::Globals* io_thread_globals) const { |
358 return NULL; | 358 return NULL; |
359 } | 359 } |
OLD | NEW |