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

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

Issue 651443005: Use no-op statistics collecting object for WebView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor2
Patch Set: Selim and Ben's comments Created 6 years, 2 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 26 matching lines...) Expand all
37 #include "net/ssl/default_channel_id_store.h" 37 #include "net/ssl/default_channel_id_store.h"
38 #include "net/url_request/data_protocol_handler.h" 38 #include "net/url_request/data_protocol_handler.h"
39 #include "net/url_request/file_protocol_handler.h" 39 #include "net/url_request/file_protocol_handler.h"
40 #include "net/url_request/url_request_context_builder.h" 40 #include "net/url_request/url_request_context_builder.h"
41 #include "net/url_request/url_request_context.h" 41 #include "net/url_request/url_request_context.h"
42 #include "net/url_request/url_request_intercepting_job_factory.h" 42 #include "net/url_request/url_request_intercepting_job_factory.h"
43 #include "net/url_request/url_request_interceptor.h" 43 #include "net/url_request/url_request_interceptor.h"
44 44
45 using content::BrowserThread; 45 using content::BrowserThread;
46 using data_reduction_proxy::DataReductionProxySettings; 46 using data_reduction_proxy::DataReductionProxySettings;
47 using data_reduction_proxy::DataReductionProxyStatisticsPrefs;
sgurun-gerrit only 2014/10/17 20:29:38 stale?
hush (inactive) 2014/10/17 21:19:47 Done.
47 48
48 namespace android_webview { 49 namespace android_webview {
49 50
50
51 namespace { 51 namespace {
52 52
53 void ApplyCmdlineOverridesToURLRequestContextBuilder( 53 void ApplyCmdlineOverridesToURLRequestContextBuilder(
54 net::URLRequestContextBuilder* builder) { 54 net::URLRequestContextBuilder* builder) {
55 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 55 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
56 if (command_line.HasSwitch(switches::kHostResolverRules)) { 56 if (command_line.HasSwitch(switches::kHostResolverRules)) {
57 // If hostname remappings were specified on the command-line, layer these 57 // If hostname remappings were specified on the command-line, layer these
58 // rules on top of the real host resolver. This allows forwarding all 58 // rules on top of the real host resolver. This allows forwarding all
59 // requests through a designated test server. 59 // requests through a designated test server.
60 scoped_ptr<net::MappedHostResolver> host_resolver( 60 scoped_ptr<net::MappedHostResolver> host_resolver(
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 job_factory.Pass(), make_scoped_ptr(*i))); 165 job_factory.Pass(), make_scoped_ptr(*i)));
166 } 166 }
167 request_interceptors.weak_clear(); 167 request_interceptors.weak_clear();
168 168
169 return job_factory.Pass(); 169 return job_factory.Pass();
170 } 170 }
171 171
172 } // namespace 172 } // namespace
173 173
174 AwURLRequestContextGetter::AwURLRequestContextGetter( 174 AwURLRequestContextGetter::AwURLRequestContextGetter(
175 const base::FilePath& partition_path, net::CookieStore* cookie_store, 175 const base::FilePath& partition_path,
176 net::CookieStore* cookie_store,
176 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigService> 177 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigService>
177 config_service) 178 config_service)
178 : partition_path_(partition_path), 179 : partition_path_(partition_path),
179 cookie_store_(cookie_store), 180 cookie_store_(cookie_store),
180 net_log_(new net::NetLog()) { 181 net_log_(new net::NetLog()) {
181 data_reduction_proxy_config_service_ = config_service.Pass(); 182 data_reduction_proxy_config_service_ = config_service.Pass();
182 // CreateSystemProxyConfigService for Android must be called on main thread. 183 // CreateSystemProxyConfigService for Android must be called on main thread.
183 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 184 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
184 } 185 }
185 186
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 DCHECK(browser_context); 231 DCHECK(browser_context);
231 DataReductionProxySettings* data_reduction_proxy_settings = 232 DataReductionProxySettings* data_reduction_proxy_settings =
232 browser_context->GetDataReductionProxySettings(); 233 browser_context->GetDataReductionProxySettings();
233 DCHECK(data_reduction_proxy_settings); 234 DCHECK(data_reduction_proxy_settings);
234 data_reduction_proxy_auth_request_handler_.reset( 235 data_reduction_proxy_auth_request_handler_.reset(
235 new data_reduction_proxy::DataReductionProxyAuthRequestHandler( 236 new data_reduction_proxy::DataReductionProxyAuthRequestHandler(
236 data_reduction_proxy::Client::WEBVIEW_ANDROID, 237 data_reduction_proxy::Client::WEBVIEW_ANDROID,
237 data_reduction_proxy_settings->params(), 238 data_reduction_proxy_settings->params(),
238 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); 239 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
239 240
240 // Compression statistics are not gathered for WebView, so 241 // Compression statistics are not gathered for WebView. We don't set it here,
241 // DataReductionProxyStatisticsPrefs is not instantiated and passed to the 242 // which means a default dummy DataReductionProxyStatistics will be used.
sgurun-gerrit only 2014/10/17 20:29:38 I don't think we will need this comment anymore, s
hush (inactive) 2014/10/18 02:09:15 Done.
242 // network delegate. 243
243 aw_network_delegate->set_data_reduction_proxy_params( 244 aw_network_delegate->set_data_reduction_proxy_params(
244 data_reduction_proxy_settings->params()); 245 data_reduction_proxy_settings->params());
245 aw_network_delegate->set_data_reduction_proxy_auth_request_handler( 246 aw_network_delegate->set_data_reduction_proxy_auth_request_handler(
246 data_reduction_proxy_auth_request_handler_.get()); 247 data_reduction_proxy_auth_request_handler_.get());
247 248
248 main_http_factory_.reset(main_cache); 249 main_http_factory_.reset(main_cache);
249 url_request_context_->set_http_transaction_factory(main_cache); 250 url_request_context_->set_http_transaction_factory(main_cache);
250 url_request_context_->set_cookie_store(cookie_store_.get()); 251 url_request_context_->set_cookie_store(cookie_store_.get());
251 252
252 job_factory_ = CreateJobFactory(&protocol_handlers_, 253 job_factory_ = CreateJobFactory(&protocol_handlers_,
(...skipping 29 matching lines...) Expand all
282 net::NetLog* AwURLRequestContextGetter::GetNetLog() { 283 net::NetLog* AwURLRequestContextGetter::GetNetLog() {
283 return net_log_.get(); 284 return net_log_.get();
284 } 285 }
285 286
286 void AwURLRequestContextGetter::SetKeyOnIO(const std::string& key) { 287 void AwURLRequestContextGetter::SetKeyOnIO(const std::string& key) {
287 DCHECK(data_reduction_proxy_auth_request_handler_); 288 DCHECK(data_reduction_proxy_auth_request_handler_);
288 data_reduction_proxy_auth_request_handler_->InitAuthentication(key); 289 data_reduction_proxy_auth_request_handler_->InitAuthentication(key);
289 } 290 }
290 291
291 } // namespace android_webview 292 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698