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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 new_parameters.push_back(safe_parameter); | 129 new_parameters.push_back(safe_parameter); |
130 new_parameters.push_back(ssui_parameter); | 130 new_parameters.push_back(ssui_parameter); |
131 return JoinString(new_parameters, '&'); | 131 return JoinString(new_parameters, '&'); |
132 } | 132 } |
133 | 133 |
134 // If |request| is a request to Google Web Search the function | 134 // If |request| is a request to Google Web Search the function |
135 // enforces that the SafeSearch query parameters are set to active. | 135 // enforces that the SafeSearch query parameters are set to active. |
136 // Sets the query part of |new_url| with the new value of the parameters. | 136 // Sets the query part of |new_url| with the new value of the parameters. |
137 void ForceGoogleSafeSearch(net::URLRequest* request, | 137 void ForceGoogleSafeSearch(net::URLRequest* request, |
138 GURL* new_url) { | 138 GURL* new_url) { |
139 if (!google_util::IsGoogleSearchUrl(request->url().spec()) && | 139 if (!google_util::IsGoogleSearchUrl(request->url()) && |
140 !google_util::IsGoogleHomePageUrl(request->url().spec())) | 140 !google_util::IsGoogleHomePageUrl(request->url())) |
141 return; | 141 return; |
142 | 142 |
143 std::string query = request->url().query(); | 143 std::string query = request->url().query(); |
144 std::string new_query = AddSafeSearchParameters(query); | 144 std::string new_query = AddSafeSearchParameters(query); |
145 if (query == new_query) | 145 if (query == new_query) |
146 return; | 146 return; |
147 | 147 |
148 GURL::Replacements replacements; | 148 GURL::Replacements replacements; |
149 replacements.SetQueryStr(new_query); | 149 replacements.SetQueryStr(new_query); |
150 *new_url = request->url().ReplaceComponents(replacements); | 150 *new_url = request->url().ReplaceComponents(replacements); |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 | 799 |
800 void ChromeNetworkDelegate::AccumulateContentLength( | 800 void ChromeNetworkDelegate::AccumulateContentLength( |
801 int64 received_content_length, int64 original_content_length) { | 801 int64 received_content_length, int64 original_content_length) { |
802 DCHECK_GE(received_content_length, 0); | 802 DCHECK_GE(received_content_length, 0); |
803 DCHECK_GE(original_content_length, 0); | 803 DCHECK_GE(original_content_length, 0); |
804 StoreAccumulatedContentLength(received_content_length, | 804 StoreAccumulatedContentLength(received_content_length, |
805 original_content_length); | 805 original_content_length); |
806 received_content_length_ += received_content_length; | 806 received_content_length_ += received_content_length; |
807 original_content_length_ += original_content_length; | 807 original_content_length_ += original_content_length; |
808 } | 808 } |
OLD | NEW |