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

Side by Side Diff: chrome/browser/net/chrome_network_delegate.cc

Issue 390533003: Bypassed Bytes UMAs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 "chrome/browser/net/chrome_network_delegate.h" 5 #include "chrome/browser/net/chrome_network_delegate.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 18 matching lines...) Expand all
29 #include "chrome/browser/prerender/prerender_tracker.h" 29 #include "chrome/browser/prerender/prerender_tracker.h"
30 #include "chrome/browser/profiles/profile_manager.h" 30 #include "chrome/browser/profiles/profile_manager.h"
31 #include "chrome/browser/task_manager/task_manager.h" 31 #include "chrome/browser/task_manager/task_manager.h"
32 #include "chrome/common/pref_names.h" 32 #include "chrome/common/pref_names.h"
33 #include "chrome/common/url_constants.h" 33 #include "chrome/common/url_constants.h"
34 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h" 34 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h"
35 #include "components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h " 35 #include "components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h "
36 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" 36 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
37 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h" 37 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h"
38 #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_sta ts.h" 38 #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_sta ts.h"
39 #include "components/data_reduction_proxy/common/data_reduction_proxy_pref_names .h"
39 #include "components/domain_reliability/monitor.h" 40 #include "components/domain_reliability/monitor.h"
40 #include "components/google/core/browser/google_util.h" 41 #include "components/google/core/browser/google_util.h"
41 #include "content/public/browser/browser_thread.h" 42 #include "content/public/browser/browser_thread.h"
42 #include "content/public/browser/render_frame_host.h" 43 #include "content/public/browser/render_frame_host.h"
43 #include "content/public/browser/render_view_host.h" 44 #include "content/public/browser/render_view_host.h"
44 #include "content/public/browser/resource_request_info.h" 45 #include "content/public/browser/resource_request_info.h"
45 #include "extensions/common/constants.h" 46 #include "extensions/common/constants.h"
46 #include "net/base/host_port_pair.h" 47 #include "net/base/host_port_pair.h"
47 #include "net/base/net_errors.h" 48 #include "net/base/net_errors.h"
48 #include "net/base/net_log.h" 49 #include "net/base/net_log.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 286
286 } // namespace 287 } // namespace
287 288
288 ChromeNetworkDelegate::ChromeNetworkDelegate( 289 ChromeNetworkDelegate::ChromeNetworkDelegate(
289 extensions::EventRouterForwarder* event_router, 290 extensions::EventRouterForwarder* event_router,
290 BooleanPrefMember* enable_referrers) 291 BooleanPrefMember* enable_referrers)
291 : profile_(NULL), 292 : profile_(NULL),
292 enable_referrers_(enable_referrers), 293 enable_referrers_(enable_referrers),
293 enable_do_not_track_(NULL), 294 enable_do_not_track_(NULL),
294 force_google_safe_search_(NULL), 295 force_google_safe_search_(NULL),
296 spdy_proxy_auth_enabled_(NULL),
295 #if defined(ENABLE_CONFIGURATION_POLICY) 297 #if defined(ENABLE_CONFIGURATION_POLICY)
296 url_blacklist_manager_(NULL), 298 url_blacklist_manager_(NULL),
297 #endif 299 #endif
298 domain_reliability_monitor_(NULL), 300 domain_reliability_monitor_(NULL),
299 received_content_length_(0), 301 received_content_length_(0),
300 original_content_length_(0), 302 original_content_length_(0),
301 first_request_(true), 303 first_request_(true),
302 prerender_tracker_(NULL), 304 prerender_tracker_(NULL),
303 data_reduction_proxy_params_(NULL), 305 data_reduction_proxy_params_(NULL),
304 data_reduction_proxy_usage_stats_(NULL), 306 data_reduction_proxy_usage_stats_(NULL),
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // static 341 // static
340 void ChromeNetworkDelegate::NeverThrottleRequests() { 342 void ChromeNetworkDelegate::NeverThrottleRequests() {
341 g_never_throttle_requests_ = true; 343 g_never_throttle_requests_ = true;
342 } 344 }
343 345
344 // static 346 // static
345 void ChromeNetworkDelegate::InitializePrefsOnUIThread( 347 void ChromeNetworkDelegate::InitializePrefsOnUIThread(
346 BooleanPrefMember* enable_referrers, 348 BooleanPrefMember* enable_referrers,
347 BooleanPrefMember* enable_do_not_track, 349 BooleanPrefMember* enable_do_not_track,
348 BooleanPrefMember* force_google_safe_search, 350 BooleanPrefMember* force_google_safe_search,
351 BooleanPrefMember* spdy_proxy_auth_enabled,
349 PrefService* pref_service) { 352 PrefService* pref_service) {
350 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 353 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
351 enable_referrers->Init(prefs::kEnableReferrers, pref_service); 354 enable_referrers->Init(prefs::kEnableReferrers, pref_service);
352 enable_referrers->MoveToThread( 355 enable_referrers->MoveToThread(
353 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 356 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
354 if (enable_do_not_track) { 357 if (enable_do_not_track) {
355 enable_do_not_track->Init(prefs::kEnableDoNotTrack, pref_service); 358 enable_do_not_track->Init(prefs::kEnableDoNotTrack, pref_service);
356 enable_do_not_track->MoveToThread( 359 enable_do_not_track->MoveToThread(
357 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 360 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
358 } 361 }
359 if (force_google_safe_search) { 362 if (force_google_safe_search) {
360 force_google_safe_search->Init(prefs::kForceSafeSearch, pref_service); 363 force_google_safe_search->Init(prefs::kForceSafeSearch, pref_service);
361 force_google_safe_search->MoveToThread( 364 force_google_safe_search->MoveToThread(
362 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 365 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
363 } 366 }
367 if (spdy_proxy_auth_enabled) {
368 spdy_proxy_auth_enabled->Init(data_reduction_proxy::prefs::
bengr 2014/07/12 00:11:59 Move data_reduction_proxy::prefs to the next line,
megjablon 2014/07/14 19:06:40 Done.
369 kDataReductionProxyEnabled,
370 pref_service);
371 spdy_proxy_auth_enabled->MoveToThread(
372 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
373 }
364 } 374 }
365 375
366 // static 376 // static
367 void ChromeNetworkDelegate::AllowAccessToAllFiles() { 377 void ChromeNetworkDelegate::AllowAccessToAllFiles() {
368 g_allow_file_access_ = true; 378 g_allow_file_access_ = true;
369 } 379 }
370 380
371 // static 381 // static
372 base::Value* ChromeNetworkDelegate::HistoricNetworkStatsInfoToValue() { 382 base::Value* ChromeNetworkDelegate::HistoricNetworkStatsInfoToValue() {
373 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 383 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 } 509 }
500 510
501 int ChromeNetworkDelegate::OnHeadersReceived( 511 int ChromeNetworkDelegate::OnHeadersReceived(
502 net::URLRequest* request, 512 net::URLRequest* request,
503 const net::CompletionCallback& callback, 513 const net::CompletionCallback& callback,
504 const net::HttpResponseHeaders* original_response_headers, 514 const net::HttpResponseHeaders* original_response_headers,
505 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, 515 scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
506 GURL* allowed_unsafe_redirect_url) { 516 GURL* allowed_unsafe_redirect_url) {
507 if (data_reduction_proxy::MaybeBypassProxyAndPrepareToRetry( 517 if (data_reduction_proxy::MaybeBypassProxyAndPrepareToRetry(
508 data_reduction_proxy_params_, 518 data_reduction_proxy_params_,
519 data_reduction_proxy_usage_stats_,
509 request, 520 request,
510 original_response_headers, 521 original_response_headers,
511 override_response_headers)) { 522 override_response_headers)) {
512 return net::OK; 523 return net::OK;
513 } 524 }
514 525
515 return extensions_delegate_->OnHeadersReceived( 526 return extensions_delegate_->OnHeadersReceived(
516 request, 527 request,
517 callback, 528 callback,
518 original_response_headers, 529 original_response_headers,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 int64 adjusted_original_content_length = 602 int64 adjusted_original_content_length =
592 data_reduction_proxy::GetAdjustedOriginalContentLength( 603 data_reduction_proxy::GetAdjustedOriginalContentLength(
593 request_type, original_content_length, 604 request_type, original_content_length,
594 received_content_length); 605 received_content_length);
595 AccumulateContentLength(received_content_length, 606 AccumulateContentLength(received_content_length,
596 adjusted_original_content_length, 607 adjusted_original_content_length,
597 request_type); 608 request_type);
598 RecordContentLengthHistograms(received_content_length, 609 RecordContentLengthHistograms(received_content_length,
599 original_content_length, 610 original_content_length,
600 freshness_lifetime); 611 freshness_lifetime);
612 if (spdy_proxy_auth_enabled_ && spdy_proxy_auth_enabled_->GetValue()) {
bengr 2014/07/12 00:11:59 If you guard this with spdy_proxy_auth_enabled_, t
megjablon 2014/07/14 19:06:41 Would it be helpful for us to know of these bypass
bengr 2014/07/14 22:04:29 It would be helpful, but would require extra work.
613 data_reduction_proxy_usage_stats_->RecordBypassedBytesHistograms(
614 received_content_length,
615 request);
bengr 2014/07/12 00:11:59 |request| can move up a line.
megjablon 2014/07/14 19:06:40 Done.
616 }
601 DVLOG(2) << __FUNCTION__ 617 DVLOG(2) << __FUNCTION__
602 << " received content length: " << received_content_length 618 << " received content length: " << received_content_length
603 << " original content length: " << original_content_length 619 << " original content length: " << original_content_length
604 << " url: " << request->url(); 620 << " url: " << request->url();
605 } 621 }
606 622
607 extensions_delegate_->OnCompleted(request, started); 623 extensions_delegate_->OnCompleted(request, started);
608 } else if (request->status().status() == net::URLRequestStatus::FAILED || 624 } else if (request->status().status() == net::URLRequestStatus::FAILED ||
609 request->status().status() == net::URLRequestStatus::CANCELED) { 625 request->status().status() == net::URLRequestStatus::CANCELED) {
610 extensions_delegate_->OnCompleted(request, started); 626 extensions_delegate_->OnCompleted(request, started);
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 data_reduction_proxy::DataReductionProxyRequestType request_type) { 840 data_reduction_proxy::DataReductionProxyRequestType request_type) {
825 DCHECK_GE(received_content_length, 0); 841 DCHECK_GE(received_content_length, 0);
826 DCHECK_GE(original_content_length, 0); 842 DCHECK_GE(original_content_length, 0);
827 StoreAccumulatedContentLength(received_content_length, 843 StoreAccumulatedContentLength(received_content_length,
828 original_content_length, 844 original_content_length,
829 request_type, 845 request_type,
830 reinterpret_cast<Profile*>(profile_)); 846 reinterpret_cast<Profile*>(profile_));
831 received_content_length_ += received_content_length; 847 received_content_length_ += received_content_length;
832 original_content_length_ += original_content_length; 848 original_content_length_ += original_content_length;
833 } 849 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698