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); |
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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 data_reduction_proxy::DataReductionProxyRequestType request_type) { | 811 data_reduction_proxy::DataReductionProxyRequestType request_type) { |
818 DCHECK_GE(received_content_length, 0); | 812 DCHECK_GE(received_content_length, 0); |
819 DCHECK_GE(original_content_length, 0); | 813 DCHECK_GE(original_content_length, 0); |
820 StoreAccumulatedContentLength(received_content_length, | 814 StoreAccumulatedContentLength(received_content_length, |
821 original_content_length, | 815 original_content_length, |
822 request_type, | 816 request_type, |
823 reinterpret_cast<Profile*>(profile_)); | 817 reinterpret_cast<Profile*>(profile_)); |
824 received_content_length_ += received_content_length; | 818 received_content_length_ += received_content_length; |
825 original_content_length_ += original_content_length; | 819 original_content_length_ += original_content_length; |
826 } | 820 } |
OLD | NEW |