OLD | NEW |
---|---|
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 Loading... | |
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); |
mmenke
2014/09/10 15:16:48
Could we just move this into UpdateContentLengthPr
Not at Google. Contact bengr
2014/09/10 21:38:34
Done.
In the future we want to move off of local
| |
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); |
mmenke
2014/09/10 15:16:48
While you're here, mind fixing the indent here?
Not at Google. Contact bengr
2014/09/10 21:38:34
Done.
| |
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, |
156 data_reduction_proxy::DataReductionProxyRequestType request_type, | 150 data_reduction_proxy::DataReductionProxyRequestType request_type, |
157 Profile* profile) { | 151 Profile* profile) { |
158 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 152 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
159 base::Bind(&UpdateContentLengthPrefs, | 153 base::Bind(&UpdateContentLengthPrefs, |
160 received_content_length, original_content_length, | 154 received_content_length, original_content_length, |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 } |
OLD | NEW |