OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/browser_state/chrome_browser_state_io_data.h" | 5 #include "ios/chrome/browser/browser_state/chrome_browser_state_io_data.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
17 #include "base/debug/alias.h" | 17 #include "base/debug/alias.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/macros.h" | 19 #include "base/macros.h" |
| 20 #include "base/memory/ptr_util.h" |
20 #include "base/path_service.h" | 21 #include "base/path_service.h" |
21 #include "base/stl_util.h" | 22 #include "base/stl_util.h" |
22 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
23 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
24 #include "base/thread_task_runner_handle.h" | 25 #include "base/thread_task_runner_handle.h" |
25 #include "base/threading/sequenced_worker_pool.h" | 26 #include "base/threading/sequenced_worker_pool.h" |
26 #include "components/about_handler/about_protocol_handler.h" | 27 #include "components/about_handler/about_protocol_handler.h" |
27 #include "components/content_settings/core/browser/content_settings_provider.h" | 28 #include "components/content_settings/core/browser/content_settings_provider.h" |
28 #include "components/content_settings/core/browser/cookie_settings.h" | 29 #include "components/content_settings/core/browser/cookie_settings.h" |
29 #include "components/content_settings/core/browser/host_content_settings_map.h" | 30 #include "components/content_settings/core/browser/host_content_settings_map.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 #include "net/url_request/url_request_context_builder.h" | 65 #include "net/url_request/url_request_context_builder.h" |
65 #include "net/url_request/url_request_intercepting_job_factory.h" | 66 #include "net/url_request/url_request_intercepting_job_factory.h" |
66 #include "net/url_request/url_request_interceptor.h" | 67 #include "net/url_request/url_request_interceptor.h" |
67 #include "net/url_request/url_request_job_factory_impl.h" | 68 #include "net/url_request/url_request_job_factory_impl.h" |
68 | 69 |
69 namespace { | 70 namespace { |
70 | 71 |
71 // For safe shutdown, must be called before the ChromeBrowserStateIOData is | 72 // For safe shutdown, must be called before the ChromeBrowserStateIOData is |
72 // destroyed. | 73 // destroyed. |
73 void NotifyContextGettersOfShutdownOnIO( | 74 void NotifyContextGettersOfShutdownOnIO( |
74 scoped_ptr<ChromeBrowserStateIOData::IOSChromeURLRequestContextGetterVector> | 75 std::unique_ptr< |
| 76 ChromeBrowserStateIOData::IOSChromeURLRequestContextGetterVector> |
75 getters) { | 77 getters) { |
76 DCHECK_CURRENTLY_ON(web::WebThread::IO); | 78 DCHECK_CURRENTLY_ON(web::WebThread::IO); |
77 ChromeBrowserStateIOData::IOSChromeURLRequestContextGetterVector::iterator | 79 ChromeBrowserStateIOData::IOSChromeURLRequestContextGetterVector::iterator |
78 iter; | 80 iter; |
79 for (auto& chrome_context_getter : *getters) | 81 for (auto& chrome_context_getter : *getters) |
80 chrome_context_getter->NotifyContextShuttingDown(); | 82 chrome_context_getter->NotifyContextShuttingDown(); |
81 } | 83 } |
82 | 84 |
83 } // namespace | 85 } // namespace |
84 | 86 |
85 void ChromeBrowserStateIOData::InitializeOnUIThread( | 87 void ChromeBrowserStateIOData::InitializeOnUIThread( |
86 ios::ChromeBrowserState* browser_state) { | 88 ios::ChromeBrowserState* browser_state) { |
87 DCHECK_CURRENTLY_ON(web::WebThread::UI); | 89 DCHECK_CURRENTLY_ON(web::WebThread::UI); |
88 PrefService* pref_service = browser_state->GetPrefs(); | 90 PrefService* pref_service = browser_state->GetPrefs(); |
89 scoped_ptr<ProfileParams> params(new ProfileParams); | 91 std::unique_ptr<ProfileParams> params(new ProfileParams); |
90 params->path = browser_state->GetOriginalChromeBrowserState()->GetStatePath(); | 92 params->path = browser_state->GetOriginalChromeBrowserState()->GetStatePath(); |
91 | 93 |
92 params->io_thread = GetApplicationContext()->GetIOSChromeIOThread(); | 94 params->io_thread = GetApplicationContext()->GetIOSChromeIOThread(); |
93 | 95 |
94 params->cookie_settings = | 96 params->cookie_settings = |
95 ios::CookieSettingsFactory::GetForBrowserState(browser_state); | 97 ios::CookieSettingsFactory::GetForBrowserState(browser_state); |
96 params->host_content_settings_map = | 98 params->host_content_settings_map = |
97 ios::HostContentSettingsMapFactory::GetForBrowserState(browser_state); | 99 ios::HostContentSettingsMapFactory::GetForBrowserState(browser_state); |
98 params->ssl_config_service = browser_state->GetSSLConfigService(); | 100 params->ssl_config_service = browser_state->GetSSLConfigService(); |
99 | 101 |
(...skipping 26 matching lines...) Expand all Loading... |
126 signin_allowed_.Init(prefs::kSigninAllowed, pref_service); | 128 signin_allowed_.Init(prefs::kSigninAllowed, pref_service); |
127 signin_allowed_.MoveToThread(io_task_runner); | 129 signin_allowed_.MoveToThread(io_task_runner); |
128 } | 130 } |
129 | 131 |
130 initialized_on_UI_thread_ = true; | 132 initialized_on_UI_thread_ = true; |
131 } | 133 } |
132 | 134 |
133 ChromeBrowserStateIOData::AppRequestContext::AppRequestContext() {} | 135 ChromeBrowserStateIOData::AppRequestContext::AppRequestContext() {} |
134 | 136 |
135 void ChromeBrowserStateIOData::AppRequestContext::SetCookieStore( | 137 void ChromeBrowserStateIOData::AppRequestContext::SetCookieStore( |
136 scoped_ptr<net::CookieStore> cookie_store) { | 138 std::unique_ptr<net::CookieStore> cookie_store) { |
137 cookie_store_ = std::move(cookie_store); | 139 cookie_store_ = std::move(cookie_store); |
138 set_cookie_store(cookie_store_.get()); | 140 set_cookie_store(cookie_store_.get()); |
139 } | 141 } |
140 | 142 |
141 void ChromeBrowserStateIOData::AppRequestContext::SetHttpTransactionFactory( | 143 void ChromeBrowserStateIOData::AppRequestContext::SetHttpTransactionFactory( |
142 scoped_ptr<net::HttpTransactionFactory> http_factory) { | 144 std::unique_ptr<net::HttpTransactionFactory> http_factory) { |
143 http_factory_ = std::move(http_factory); | 145 http_factory_ = std::move(http_factory); |
144 set_http_transaction_factory(http_factory_.get()); | 146 set_http_transaction_factory(http_factory_.get()); |
145 } | 147 } |
146 | 148 |
147 void ChromeBrowserStateIOData::AppRequestContext::SetJobFactory( | 149 void ChromeBrowserStateIOData::AppRequestContext::SetJobFactory( |
148 scoped_ptr<net::URLRequestJobFactory> job_factory) { | 150 std::unique_ptr<net::URLRequestJobFactory> job_factory) { |
149 job_factory_ = std::move(job_factory); | 151 job_factory_ = std::move(job_factory); |
150 set_job_factory(job_factory_.get()); | 152 set_job_factory(job_factory_.get()); |
151 } | 153 } |
152 | 154 |
153 ChromeBrowserStateIOData::AppRequestContext::~AppRequestContext() { | 155 ChromeBrowserStateIOData::AppRequestContext::~AppRequestContext() { |
154 AssertNoURLRequests(); | 156 AssertNoURLRequests(); |
155 } | 157 } |
156 | 158 |
157 ChromeBrowserStateIOData::ProfileParams::ProfileParams() | 159 ChromeBrowserStateIOData::ProfileParams::ProfileParams() |
158 : io_thread(nullptr), browser_state(nullptr) {} | 160 : io_thread(nullptr), browser_state(nullptr) {} |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 return net::URLRequest::IsHandledProtocol(scheme); | 236 return net::URLRequest::IsHandledProtocol(scheme); |
235 } | 237 } |
236 | 238 |
237 // static | 239 // static |
238 void ChromeBrowserStateIOData::InstallProtocolHandlers( | 240 void ChromeBrowserStateIOData::InstallProtocolHandlers( |
239 net::URLRequestJobFactoryImpl* job_factory, | 241 net::URLRequestJobFactoryImpl* job_factory, |
240 ProtocolHandlerMap* protocol_handlers) { | 242 ProtocolHandlerMap* protocol_handlers) { |
241 for (ProtocolHandlerMap::iterator it = protocol_handlers->begin(); | 243 for (ProtocolHandlerMap::iterator it = protocol_handlers->begin(); |
242 it != protocol_handlers->end(); ++it) { | 244 it != protocol_handlers->end(); ++it) { |
243 bool set_protocol = job_factory->SetProtocolHandler( | 245 bool set_protocol = job_factory->SetProtocolHandler( |
244 it->first, make_scoped_ptr(it->second.release())); | 246 it->first, base::WrapUnique(it->second.release())); |
245 DCHECK(set_protocol); | 247 DCHECK(set_protocol); |
246 } | 248 } |
247 protocol_handlers->clear(); | 249 protocol_handlers->clear(); |
248 } | 250 } |
249 | 251 |
250 net::URLRequestContext* ChromeBrowserStateIOData::GetMainRequestContext() | 252 net::URLRequestContext* ChromeBrowserStateIOData::GetMainRequestContext() |
251 const { | 253 const { |
252 DCHECK(initialized_); | 254 DCHECK(initialized_); |
253 return main_request_context_.get(); | 255 return main_request_context_.get(); |
254 } | 256 } |
255 | 257 |
256 net::URLRequestContext* ChromeBrowserStateIOData::GetIsolatedAppRequestContext( | 258 net::URLRequestContext* ChromeBrowserStateIOData::GetIsolatedAppRequestContext( |
257 net::URLRequestContext* main_context, | 259 net::URLRequestContext* main_context, |
258 const base::FilePath& partition_path) const { | 260 const base::FilePath& partition_path) const { |
259 DCHECK(initialized_); | 261 DCHECK(initialized_); |
260 AppRequestContext* context = nullptr; | 262 AppRequestContext* context = nullptr; |
261 if (ContainsKey(app_request_context_map_, partition_path)) { | 263 if (ContainsKey(app_request_context_map_, partition_path)) { |
262 context = app_request_context_map_[partition_path]; | 264 context = app_request_context_map_[partition_path]; |
263 } else { | 265 } else { |
264 context = AcquireIsolatedAppRequestContext(main_context); | 266 context = AcquireIsolatedAppRequestContext(main_context); |
265 app_request_context_map_[partition_path] = context; | 267 app_request_context_map_[partition_path] = context; |
266 } | 268 } |
267 DCHECK(context); | 269 DCHECK(context); |
268 return context; | 270 return context; |
269 } | 271 } |
270 | 272 |
271 void ChromeBrowserStateIOData::SetCookieStoreForPartitionPath( | 273 void ChromeBrowserStateIOData::SetCookieStoreForPartitionPath( |
272 scoped_ptr<net::CookieStore> cookie_store, | 274 std::unique_ptr<net::CookieStore> cookie_store, |
273 const base::FilePath& partition_path) { | 275 const base::FilePath& partition_path) { |
274 DCHECK(ContainsKey(app_request_context_map_, partition_path)); | 276 DCHECK(ContainsKey(app_request_context_map_, partition_path)); |
275 app_request_context_map_[partition_path]->SetCookieStore( | 277 app_request_context_map_[partition_path]->SetCookieStore( |
276 std::move(cookie_store)); | 278 std::move(cookie_store)); |
277 } | 279 } |
278 | 280 |
279 content_settings::CookieSettings* ChromeBrowserStateIOData::GetCookieSettings() | 281 content_settings::CookieSettings* ChromeBrowserStateIOData::GetCookieSettings() |
280 const { | 282 const { |
281 DCHECK(initialized_); | 283 DCHECK(initialized_); |
282 return cookie_settings_.get(); | 284 return cookie_settings_.get(); |
(...skipping 24 matching lines...) Expand all Loading... |
307 DCHECK_CURRENTLY_ON(web::WebThread::IO); | 309 DCHECK_CURRENTLY_ON(web::WebThread::IO); |
308 return enable_metrics_.GetValue(); | 310 return enable_metrics_.GetValue(); |
309 } | 311 } |
310 | 312 |
311 base::WeakPtr<net::HttpServerProperties> | 313 base::WeakPtr<net::HttpServerProperties> |
312 ChromeBrowserStateIOData::http_server_properties() const { | 314 ChromeBrowserStateIOData::http_server_properties() const { |
313 return http_server_properties_->GetWeakPtr(); | 315 return http_server_properties_->GetWeakPtr(); |
314 } | 316 } |
315 | 317 |
316 void ChromeBrowserStateIOData::set_http_server_properties( | 318 void ChromeBrowserStateIOData::set_http_server_properties( |
317 scoped_ptr<net::HttpServerProperties> http_server_properties) const { | 319 std::unique_ptr<net::HttpServerProperties> http_server_properties) const { |
318 http_server_properties_ = std::move(http_server_properties); | 320 http_server_properties_ = std::move(http_server_properties); |
319 } | 321 } |
320 | 322 |
321 void ChromeBrowserStateIOData::Init( | 323 void ChromeBrowserStateIOData::Init( |
322 ProtocolHandlerMap* protocol_handlers) const { | 324 ProtocolHandlerMap* protocol_handlers) const { |
323 // The basic logic is implemented here. The specific initialization | 325 // The basic logic is implemented here. The specific initialization |
324 // is done in InitializeInternal(), implemented by subtypes. Static helper | 326 // is done in InitializeInternal(), implemented by subtypes. Static helper |
325 // functions have been provided to assist in common operations. | 327 // functions have been provided to assist in common operations. |
326 DCHECK_CURRENTLY_ON(web::WebThread::IO); | 328 DCHECK_CURRENTLY_ON(web::WebThread::IO); |
327 DCHECK(!initialized_); | 329 DCHECK(!initialized_); |
328 | 330 |
329 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. | 331 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. |
330 CHECK(initialized_on_UI_thread_); | 332 CHECK(initialized_on_UI_thread_); |
331 | 333 |
332 // TODO(jhawkins): Return to DCHECK once crbug.com/102004 is fixed. | 334 // TODO(jhawkins): Return to DCHECK once crbug.com/102004 is fixed. |
333 CHECK(profile_params_.get()); | 335 CHECK(profile_params_.get()); |
334 | 336 |
335 IOSChromeIOThread* const io_thread = profile_params_->io_thread; | 337 IOSChromeIOThread* const io_thread = profile_params_->io_thread; |
336 IOSChromeIOThread::Globals* const io_thread_globals = io_thread->globals(); | 338 IOSChromeIOThread::Globals* const io_thread_globals = io_thread->globals(); |
337 | 339 |
338 // Create the common request contexts. | 340 // Create the common request contexts. |
339 main_request_context_.reset(new net::URLRequestContext()); | 341 main_request_context_.reset(new net::URLRequestContext()); |
340 | 342 |
341 scoped_ptr<IOSChromeNetworkDelegate> network_delegate( | 343 std::unique_ptr<IOSChromeNetworkDelegate> network_delegate( |
342 new IOSChromeNetworkDelegate()); | 344 new IOSChromeNetworkDelegate()); |
343 | 345 |
344 network_delegate->set_cookie_settings(profile_params_->cookie_settings.get()); | 346 network_delegate->set_cookie_settings(profile_params_->cookie_settings.get()); |
345 network_delegate->set_enable_do_not_track(&enable_do_not_track_); | 347 network_delegate->set_enable_do_not_track(&enable_do_not_track_); |
346 | 348 |
347 // NOTE: Proxy service uses the default io thread network delegate, not the | 349 // NOTE: Proxy service uses the default io thread network delegate, not the |
348 // delegate just created. | 350 // delegate just created. |
349 proxy_service_ = ios::ProxyServiceFactory::CreateProxyService( | 351 proxy_service_ = ios::ProxyServiceFactory::CreateProxyService( |
350 io_thread->net_log(), nullptr, | 352 io_thread->net_log(), nullptr, |
351 io_thread_globals->system_network_delegate.get(), | 353 io_thread_globals->system_network_delegate.get(), |
(...skipping 25 matching lines...) Expand all Loading... |
377 profile_params_.reset(); | 379 profile_params_.reset(); |
378 initialized_ = true; | 380 initialized_ = true; |
379 } | 381 } |
380 | 382 |
381 void ChromeBrowserStateIOData::ApplyProfileParamsToContext( | 383 void ChromeBrowserStateIOData::ApplyProfileParamsToContext( |
382 net::URLRequestContext* context) const { | 384 net::URLRequestContext* context) const { |
383 context->set_http_user_agent_settings(chrome_http_user_agent_settings_.get()); | 385 context->set_http_user_agent_settings(chrome_http_user_agent_settings_.get()); |
384 context->set_ssl_config_service(profile_params_->ssl_config_service.get()); | 386 context->set_ssl_config_service(profile_params_->ssl_config_service.get()); |
385 } | 387 } |
386 | 388 |
387 scoped_ptr<net::URLRequestJobFactory> | 389 std::unique_ptr<net::URLRequestJobFactory> |
388 ChromeBrowserStateIOData::SetUpJobFactoryDefaults( | 390 ChromeBrowserStateIOData::SetUpJobFactoryDefaults( |
389 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory, | 391 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory, |
390 URLRequestInterceptorScopedVector request_interceptors, | 392 URLRequestInterceptorScopedVector request_interceptors, |
391 net::NetworkDelegate* network_delegate) const { | 393 net::NetworkDelegate* network_delegate) const { |
392 // NOTE(willchan): Keep these protocol handlers in sync with | 394 // NOTE(willchan): Keep these protocol handlers in sync with |
393 // ChromeBrowserStateIOData::IsHandledProtocol(). | 395 // ChromeBrowserStateIOData::IsHandledProtocol(). |
394 bool set_protocol = job_factory->SetProtocolHandler( | 396 bool set_protocol = job_factory->SetProtocolHandler( |
395 url::kFileScheme, | 397 url::kFileScheme, |
396 make_scoped_ptr(new net::FileProtocolHandler( | 398 base::WrapUnique(new net::FileProtocolHandler( |
397 web::WebThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( | 399 web::WebThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( |
398 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)))); | 400 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)))); |
399 DCHECK(set_protocol); | 401 DCHECK(set_protocol); |
400 | 402 |
401 set_protocol = job_factory->SetProtocolHandler( | 403 set_protocol = job_factory->SetProtocolHandler( |
402 url::kDataScheme, make_scoped_ptr(new net::DataProtocolHandler())); | 404 url::kDataScheme, base::WrapUnique(new net::DataProtocolHandler())); |
403 DCHECK(set_protocol); | 405 DCHECK(set_protocol); |
404 | 406 |
405 job_factory->SetProtocolHandler( | 407 job_factory->SetProtocolHandler( |
406 url::kAboutScheme, | 408 url::kAboutScheme, |
407 make_scoped_ptr(new about_handler::AboutProtocolHandler())); | 409 base::WrapUnique(new about_handler::AboutProtocolHandler())); |
408 | 410 |
409 // Set up interceptors in the reverse order. | 411 // Set up interceptors in the reverse order. |
410 scoped_ptr<net::URLRequestJobFactory> top_job_factory = | 412 std::unique_ptr<net::URLRequestJobFactory> top_job_factory = |
411 std::move(job_factory); | 413 std::move(job_factory); |
412 for (URLRequestInterceptorScopedVector::reverse_iterator i = | 414 for (URLRequestInterceptorScopedVector::reverse_iterator i = |
413 request_interceptors.rbegin(); | 415 request_interceptors.rbegin(); |
414 i != request_interceptors.rend(); ++i) { | 416 i != request_interceptors.rend(); ++i) { |
415 top_job_factory.reset(new net::URLRequestInterceptingJobFactory( | 417 top_job_factory.reset(new net::URLRequestInterceptingJobFactory( |
416 std::move(top_job_factory), make_scoped_ptr(*i))); | 418 std::move(top_job_factory), base::WrapUnique(*i))); |
417 } | 419 } |
418 request_interceptors.weak_clear(); | 420 request_interceptors.weak_clear(); |
419 return top_job_factory; | 421 return top_job_factory; |
420 } | 422 } |
421 | 423 |
422 void ChromeBrowserStateIOData::ShutdownOnUIThread( | 424 void ChromeBrowserStateIOData::ShutdownOnUIThread( |
423 scoped_ptr<IOSChromeURLRequestContextGetterVector> context_getters) { | 425 std::unique_ptr<IOSChromeURLRequestContextGetterVector> context_getters) { |
424 DCHECK_CURRENTLY_ON(web::WebThread::UI); | 426 DCHECK_CURRENTLY_ON(web::WebThread::UI); |
425 | 427 |
426 google_services_user_account_id_.Destroy(); | 428 google_services_user_account_id_.Destroy(); |
427 enable_referrers_.Destroy(); | 429 enable_referrers_.Destroy(); |
428 enable_do_not_track_.Destroy(); | 430 enable_do_not_track_.Destroy(); |
429 enable_metrics_.Destroy(); | 431 enable_metrics_.Destroy(); |
430 sync_disabled_.Destroy(); | 432 sync_disabled_.Destroy(); |
431 signin_allowed_.Destroy(); | 433 signin_allowed_.Destroy(); |
432 if (chrome_http_user_agent_settings_) | 434 if (chrome_http_user_agent_settings_) |
433 chrome_http_user_agent_settings_->CleanupOnUIThread(); | 435 chrome_http_user_agent_settings_->CleanupOnUIThread(); |
434 | 436 |
435 if (!context_getters->empty()) { | 437 if (!context_getters->empty()) { |
436 if (web::WebThread::IsMessageLoopValid(web::WebThread::IO)) { | 438 if (web::WebThread::IsMessageLoopValid(web::WebThread::IO)) { |
437 web::WebThread::PostTask(web::WebThread::IO, FROM_HERE, | 439 web::WebThread::PostTask(web::WebThread::IO, FROM_HERE, |
438 base::Bind(&NotifyContextGettersOfShutdownOnIO, | 440 base::Bind(&NotifyContextGettersOfShutdownOnIO, |
439 base::Passed(&context_getters))); | 441 base::Passed(&context_getters))); |
440 } | 442 } |
441 } | 443 } |
442 | 444 |
443 bool posted = web::WebThread::DeleteSoon(web::WebThread::IO, FROM_HERE, this); | 445 bool posted = web::WebThread::DeleteSoon(web::WebThread::IO, FROM_HERE, this); |
444 if (!posted) | 446 if (!posted) |
445 delete this; | 447 delete this; |
446 } | 448 } |
447 | 449 |
448 void ChromeBrowserStateIOData::set_channel_id_service( | 450 void ChromeBrowserStateIOData::set_channel_id_service( |
449 net::ChannelIDService* channel_id_service) const { | 451 net::ChannelIDService* channel_id_service) const { |
450 channel_id_service_.reset(channel_id_service); | 452 channel_id_service_.reset(channel_id_service); |
451 } | 453 } |
452 | 454 |
453 scoped_ptr<net::HttpNetworkSession> | 455 std::unique_ptr<net::HttpNetworkSession> |
454 ChromeBrowserStateIOData::CreateHttpNetworkSession( | 456 ChromeBrowserStateIOData::CreateHttpNetworkSession( |
455 const ProfileParams& profile_params) const { | 457 const ProfileParams& profile_params) const { |
456 net::HttpNetworkSession::Params params; | 458 net::HttpNetworkSession::Params params; |
457 net::URLRequestContext* context = main_request_context(); | 459 net::URLRequestContext* context = main_request_context(); |
458 | 460 |
459 IOSChromeIOThread* const io_thread = profile_params.io_thread; | 461 IOSChromeIOThread* const io_thread = profile_params.io_thread; |
460 | 462 |
461 io_thread->InitializeNetworkSessionParams(¶ms); | 463 io_thread->InitializeNetworkSessionParams(¶ms); |
462 net::URLRequestContextBuilder::SetHttpNetworkSessionComponents(context, | 464 net::URLRequestContextBuilder::SetHttpNetworkSessionComponents(context, |
463 ¶ms); | 465 ¶ms); |
464 if (!IsOffTheRecord()) { | 466 if (!IsOffTheRecord()) { |
465 params.socket_performance_watcher_factory = | 467 params.socket_performance_watcher_factory = |
466 io_thread->globals()->network_quality_estimator.get(); | 468 io_thread->globals()->network_quality_estimator.get(); |
467 } | 469 } |
468 | 470 |
469 return scoped_ptr<net::HttpNetworkSession>( | 471 return std::unique_ptr<net::HttpNetworkSession>( |
470 new net::HttpNetworkSession(params)); | 472 new net::HttpNetworkSession(params)); |
471 } | 473 } |
472 | 474 |
473 scoped_ptr<net::HttpCache> ChromeBrowserStateIOData::CreateMainHttpFactory( | 475 std::unique_ptr<net::HttpCache> ChromeBrowserStateIOData::CreateMainHttpFactory( |
474 net::HttpNetworkSession* session, | 476 net::HttpNetworkSession* session, |
475 scoped_ptr<net::HttpCache::BackendFactory> main_backend) const { | 477 std::unique_ptr<net::HttpCache::BackendFactory> main_backend) const { |
476 return scoped_ptr<net::HttpCache>( | 478 return std::unique_ptr<net::HttpCache>( |
477 new net::HttpCache(session, std::move(main_backend), true)); | 479 new net::HttpCache(session, std::move(main_backend), true)); |
478 } | 480 } |
479 | 481 |
480 scoped_ptr<net::HttpCache> ChromeBrowserStateIOData::CreateHttpFactory( | 482 std::unique_ptr<net::HttpCache> ChromeBrowserStateIOData::CreateHttpFactory( |
481 net::HttpNetworkSession* shared_session, | 483 net::HttpNetworkSession* shared_session, |
482 scoped_ptr<net::HttpCache::BackendFactory> backend) const { | 484 std::unique_ptr<net::HttpCache::BackendFactory> backend) const { |
483 return scoped_ptr<net::HttpCache>( | 485 return std::unique_ptr<net::HttpCache>( |
484 new net::HttpCache(shared_session, std::move(backend), true)); | 486 new net::HttpCache(shared_session, std::move(backend), true)); |
485 } | 487 } |
OLD | NEW |