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

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

Issue 382313003: Add data reduction functionality to all platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove incorrect DCHECK from drp_statistics_prefs.cc Created 6 years, 3 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 // Can be NULL in a unit test. 126 // Can be NULL in a unit test.
127 if (!g_browser_process) 127 if (!g_browser_process)
128 return; 128 return;
129 129
130 // Ignore off-the-record data. 130 // Ignore off-the-record data.
131 if (!g_browser_process->profile_manager()->IsValidProfile(profile) || 131 if (!g_browser_process->profile_manager()->IsValidProfile(profile) ||
132 profile->IsOffTheRecord()) { 132 profile->IsOffTheRecord()) {
133 return; 133 return;
134 } 134 }
135 #if defined(OS_ANDROID) && defined(SPDY_PROXY_AUTH_ORIGIN)
136 // If Android ever goes multi profile, the profile should be passed so that
137 // the browser preference will be taken.
138 bool with_data_reduction_proxy_enabled =
139 ProfileManager::GetActiveUserProfile()->GetPrefs()->GetBoolean(
140 data_reduction_proxy::prefs::kDataReductionProxyEnabled);
141 #else
142 bool with_data_reduction_proxy_enabled = false;
143 #endif
144
145 data_reduction_proxy::UpdateContentLengthPrefs( 135 data_reduction_proxy::UpdateContentLengthPrefs(
146 received_content_length, 136 received_content_length,
147 original_content_length, 137 original_content_length,
148 with_data_reduction_proxy_enabled, 138 profile->GetPrefs(),
149 request_type, 139 request_type, statistics_prefs);
150 statistics_prefs);
151 } 140 }
152 141
153 void StoreAccumulatedContentLength( 142 void StoreAccumulatedContentLength(
154 int received_content_length, 143 int received_content_length,
155 int original_content_length, 144 int original_content_length,
156 data_reduction_proxy::DataReductionProxyRequestType request_type, 145 data_reduction_proxy::DataReductionProxyRequestType request_type,
157 Profile* profile, 146 Profile* profile,
158 data_reduction_proxy::DataReductionProxyStatisticsPrefs* statistics_prefs) { 147 data_reduction_proxy::DataReductionProxyStatisticsPrefs* statistics_prefs) {
159 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 148 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
160 base::Bind(&UpdateContentLengthPrefs, 149 base::Bind(&UpdateContentLengthPrefs,
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 if (data_reduction_proxy_statistics_prefs_) { 832 if (data_reduction_proxy_statistics_prefs_) {
844 StoreAccumulatedContentLength(received_content_length, 833 StoreAccumulatedContentLength(received_content_length,
845 original_content_length, 834 original_content_length,
846 request_type, 835 request_type,
847 reinterpret_cast<Profile*>(profile_), 836 reinterpret_cast<Profile*>(profile_),
848 data_reduction_proxy_statistics_prefs_); 837 data_reduction_proxy_statistics_prefs_);
849 } 838 }
850 received_content_length_ += received_content_length; 839 received_content_length_ += received_content_length;
851 original_content_length_ += original_content_length; 840 original_content_length_ += original_content_length;
852 } 841 }
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698