Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/browser/url_request_context_factory.h" | 5 #include "chromecast/browser/url_request_context_factory.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/threading/worker_pool.h" | 10 #include "base/threading/worker_pool.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 231 main_transaction_factory_.reset(transaction_factory); | 231 main_transaction_factory_.reset(transaction_factory); |
| 232 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( | 232 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( |
| 233 new net::URLRequestJobFactoryImpl()); | 233 new net::URLRequestJobFactoryImpl()); |
| 234 // Keep ProtocolHandlers added in sync with | 234 // Keep ProtocolHandlers added in sync with |
| 235 // CastContentBrowserClient::IsHandledURL(). | 235 // CastContentBrowserClient::IsHandledURL(). |
| 236 bool set_protocol = false; | 236 bool set_protocol = false; |
| 237 for (content::ProtocolHandlerMap::iterator it = protocol_handlers->begin(); | 237 for (content::ProtocolHandlerMap::iterator it = protocol_handlers->begin(); |
| 238 it != protocol_handlers->end(); | 238 it != protocol_handlers->end(); |
| 239 ++it) { | 239 ++it) { |
| 240 set_protocol = job_factory->SetProtocolHandler( | 240 set_protocol = job_factory->SetProtocolHandler( |
| 241 it->first, it->second.release()); | 241 it->first, make_scoped_ptr(it->second.release())); |
|
davidben
2015/08/18 20:40:37
[Hrmf. If it->second were a scoped_ptr rather than
svaldez
2015/08/18 22:12:44
Acknowledged.
| |
| 242 DCHECK(set_protocol); | 242 DCHECK(set_protocol); |
| 243 } | 243 } |
| 244 set_protocol = job_factory->SetProtocolHandler( | 244 set_protocol = job_factory->SetProtocolHandler( |
| 245 url::kDataScheme, | 245 url::kDataScheme, make_scoped_ptr(new net::DataProtocolHandler)); |
| 246 new net::DataProtocolHandler); | |
| 247 DCHECK(set_protocol); | 246 DCHECK(set_protocol); |
| 248 | 247 |
| 249 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 248 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 250 switches::kEnableLocalFileAccesses)) { | 249 switches::kEnableLocalFileAccesses)) { |
| 251 set_protocol = job_factory->SetProtocolHandler( | 250 set_protocol = job_factory->SetProtocolHandler( |
| 252 url::kFileScheme, | 251 url::kFileScheme, |
| 253 new net::FileProtocolHandler( | 252 make_scoped_ptr(new net::FileProtocolHandler( |
| 254 content::BrowserThread::GetBlockingPool()-> | 253 content::BrowserThread::GetBlockingPool() |
| 255 GetTaskRunnerWithShutdownBehavior( | 254 ->GetTaskRunnerWithShutdownBehavior( |
| 256 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); | 255 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)))); |
| 257 DCHECK(set_protocol); | 256 DCHECK(set_protocol); |
| 258 } | 257 } |
| 259 | 258 |
| 260 // Set up interceptors in the reverse order. | 259 // Set up interceptors in the reverse order. |
| 261 scoped_ptr<net::URLRequestJobFactory> top_job_factory = job_factory.Pass(); | 260 scoped_ptr<net::URLRequestJobFactory> top_job_factory = job_factory.Pass(); |
| 262 for (content::URLRequestInterceptorScopedVector::reverse_iterator i = | 261 for (content::URLRequestInterceptorScopedVector::reverse_iterator i = |
| 263 request_interceptors.rbegin(); | 262 request_interceptors.rbegin(); |
| 264 i != request_interceptors.rend(); | 263 i != request_interceptors.rend(); |
| 265 ++i) { | 264 ++i) { |
| 266 top_job_factory.reset(new net::URLRequestInterceptingJobFactory( | 265 top_job_factory.reset(new net::URLRequestInterceptingJobFactory( |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 409 | 408 |
| 410 void URLRequestContextFactory::InitializeNetworkDelegates() { | 409 void URLRequestContextFactory::InitializeNetworkDelegates() { |
| 411 app_network_delegate_->Initialize(false); | 410 app_network_delegate_->Initialize(false); |
| 412 LOG(INFO) << "Initialized app network delegate."; | 411 LOG(INFO) << "Initialized app network delegate."; |
| 413 system_network_delegate_->Initialize(false); | 412 system_network_delegate_->Initialize(false); |
| 414 LOG(INFO) << "Initialized system network delegate."; | 413 LOG(INFO) << "Initialized system network delegate."; |
| 415 } | 414 } |
| 416 | 415 |
| 417 } // namespace shell | 416 } // namespace shell |
| 418 } // namespace chromecast | 417 } // namespace chromecast |
| OLD | NEW |