Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: android_webview/browser/net/aw_url_request_context_getter.cc

Issue 1295523006: Using scoped_ptr for URLRequestJobFactoryImpl::SetProtocolHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing un-modified file Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "android_webview/browser/net/aw_url_request_context_getter.h" 5 #include "android_webview/browser/net/aw_url_request_context_getter.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "android_webview/browser/aw_browser_context.h" 9 #include "android_webview/browser/aw_browser_context.h"
10 #include "android_webview/browser/aw_content_browser_client.h" 10 #include "android_webview/browser/aw_content_browser_client.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 110
111 scoped_ptr<net::URLRequestJobFactory> CreateJobFactory( 111 scoped_ptr<net::URLRequestJobFactory> CreateJobFactory(
112 content::ProtocolHandlerMap* protocol_handlers, 112 content::ProtocolHandlerMap* protocol_handlers,
113 content::URLRequestInterceptorScopedVector request_interceptors) { 113 content::URLRequestInterceptorScopedVector request_interceptors) {
114 scoped_ptr<AwURLRequestJobFactory> aw_job_factory(new AwURLRequestJobFactory); 114 scoped_ptr<AwURLRequestJobFactory> aw_job_factory(new AwURLRequestJobFactory);
115 // Note that the registered schemes must also be specified in 115 // Note that the registered schemes must also be specified in
116 // AwContentBrowserClient::IsHandledURL. 116 // AwContentBrowserClient::IsHandledURL.
117 bool set_protocol = aw_job_factory->SetProtocolHandler( 117 bool set_protocol = aw_job_factory->SetProtocolHandler(
118 url::kFileScheme, 118 url::kFileScheme,
119 new net::FileProtocolHandler( 119 make_scoped_ptr(new net::FileProtocolHandler(
120 content::BrowserThread::GetBlockingPool()-> 120 content::BrowserThread::GetBlockingPool()
121 GetTaskRunnerWithShutdownBehavior( 121 ->GetTaskRunnerWithShutdownBehavior(
122 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); 122 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))));
123 DCHECK(set_protocol); 123 DCHECK(set_protocol);
124 set_protocol = aw_job_factory->SetProtocolHandler( 124 set_protocol = aw_job_factory->SetProtocolHandler(
125 url::kDataScheme, new net::DataProtocolHandler()); 125 url::kDataScheme, make_scoped_ptr(new net::DataProtocolHandler()));
126 DCHECK(set_protocol); 126 DCHECK(set_protocol);
127 set_protocol = aw_job_factory->SetProtocolHandler( 127 set_protocol = aw_job_factory->SetProtocolHandler(
128 url::kBlobScheme, 128 url::kBlobScheme,
129 (*protocol_handlers)[url::kBlobScheme].release()); 129 make_scoped_ptr((*protocol_handlers)[url::kBlobScheme].release()));
130 DCHECK(set_protocol); 130 DCHECK(set_protocol);
131 set_protocol = aw_job_factory->SetProtocolHandler( 131 set_protocol = aw_job_factory->SetProtocolHandler(
132 url::kFileSystemScheme, 132 url::kFileSystemScheme,
133 (*protocol_handlers)[url::kFileSystemScheme].release()); 133 make_scoped_ptr((*protocol_handlers)[url::kFileSystemScheme].release()));
134 DCHECK(set_protocol); 134 DCHECK(set_protocol);
135 set_protocol = aw_job_factory->SetProtocolHandler( 135 set_protocol = aw_job_factory->SetProtocolHandler(
136 content::kChromeUIScheme, 136 content::kChromeUIScheme,
137 (*protocol_handlers)[content::kChromeUIScheme].release()); 137 make_scoped_ptr(
138 (*protocol_handlers)[content::kChromeUIScheme].release()));
138 DCHECK(set_protocol); 139 DCHECK(set_protocol);
139 set_protocol = aw_job_factory->SetProtocolHandler( 140 set_protocol = aw_job_factory->SetProtocolHandler(
140 content::kChromeDevToolsScheme, 141 content::kChromeDevToolsScheme,
141 (*protocol_handlers)[content::kChromeDevToolsScheme].release()); 142 make_scoped_ptr(
143 (*protocol_handlers)[content::kChromeDevToolsScheme].release()));
142 DCHECK(set_protocol); 144 DCHECK(set_protocol);
143 protocol_handlers->clear(); 145 protocol_handlers->clear();
144 146
145 // Note that even though the content:// scheme handler is created here, 147 // Note that even though the content:// scheme handler is created here,
146 // it cannot be used by child processes until access to it is granted via 148 // it cannot be used by child processes until access to it is granted via
147 // ChildProcessSecurityPolicy::GrantScheme(). This is done in 149 // ChildProcessSecurityPolicy::GrantScheme(). This is done in
148 // AwContentBrowserClient. 150 // AwContentBrowserClient.
149 request_interceptors.push_back( 151 request_interceptors.push_back(
150 CreateAndroidContentRequestInterceptor().release()); 152 CreateAndroidContentRequestInterceptor().release());
151 request_interceptors.push_back( 153 request_interceptors.push_back(
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 return net_log_.get(); 277 return net_log_.get();
276 } 278 }
277 279
278 void AwURLRequestContextGetter::SetKeyOnIO(const std::string& key) { 280 void AwURLRequestContextGetter::SetKeyOnIO(const std::string& key) {
279 DCHECK(AwBrowserContext::GetDefault()->GetDataReductionProxyIOData()); 281 DCHECK(AwBrowserContext::GetDefault()->GetDataReductionProxyIOData());
280 AwBrowserContext::GetDefault()->GetDataReductionProxyIOData()-> 282 AwBrowserContext::GetDefault()->GetDataReductionProxyIOData()->
281 request_options()->SetKeyOnIO(key); 283 request_options()->SetKeyOnIO(key);
282 } 284 }
283 285
284 } // namespace android_webview 286 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698