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

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: Sync to head 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 PrefService* prefs = g_browser_process->local_state(); 128 PrefService* prefs = g_browser_process->local_state();
129 if (!prefs) 129 if (!prefs)
130 return; 130 return;
131 131
132 // Ignore off-the-record data. 132 // Ignore off-the-record data.
133 if (!g_browser_process->profile_manager()->IsValidProfile(profile) || 133 if (!g_browser_process->profile_manager()->IsValidProfile(profile) ||
134 profile->IsOffTheRecord()) { 134 profile->IsOffTheRecord()) {
135 return; 135 return;
136 } 136 }
137 #if defined(OS_ANDROID) && defined(SPDY_PROXY_AUTH_ORIGIN)
138 // If Android ever goes multi profile, the profile should be passed so that
139 // the browser preference will be taken.
140 bool with_data_reduction_proxy_enabled = 137 bool with_data_reduction_proxy_enabled =
141 ProfileManager::GetActiveUserProfile()->GetPrefs()->GetBoolean( 138 profile->GetPrefs()->GetBoolean(
142 data_reduction_proxy::prefs::kDataReductionProxyEnabled); 139 data_reduction_proxy::prefs::kDataReductionProxyEnabled);
143 #else
144 bool with_data_reduction_proxy_enabled = false;
145 #endif
146 140
147 data_reduction_proxy::UpdateContentLengthPrefs(received_content_length, 141 data_reduction_proxy::UpdateContentLengthPrefs(received_content_length,
148 original_content_length, 142 original_content_length,
149 with_data_reduction_proxy_enabled, 143 with_data_reduction_proxy_enabled,
150 request_type, prefs); 144 request_type, prefs);
151 } 145 }
152 146
153 void StoreAccumulatedContentLength( 147 void StoreAccumulatedContentLength(
154 int received_content_length, 148 int received_content_length,
155 int original_content_length, 149 int original_content_length,
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 data_reduction_proxy::DataReductionProxyRequestType request_type) { 815 data_reduction_proxy::DataReductionProxyRequestType request_type) {
822 DCHECK_GE(received_content_length, 0); 816 DCHECK_GE(received_content_length, 0);
823 DCHECK_GE(original_content_length, 0); 817 DCHECK_GE(original_content_length, 0);
824 StoreAccumulatedContentLength(received_content_length, 818 StoreAccumulatedContentLength(received_content_length,
825 original_content_length, 819 original_content_length,
826 request_type, 820 request_type,
827 reinterpret_cast<Profile*>(profile_)); 821 reinterpret_cast<Profile*>(profile_));
828 received_content_length_ += received_content_length; 822 received_content_length_ += received_content_length;
829 original_content_length_ += original_content_length; 823 original_content_length_ += original_content_length;
830 } 824 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698