| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/safe_search_util.h" | 5 #include "chrome/browser/net/safe_search_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 std::vector<std::string>::iterator it; | 56 std::vector<std::string>::iterator it; |
| 57 for (it = parameters.begin(); it < parameters.end(); ++it) { | 57 for (it = parameters.begin(); it < parameters.end(); ++it) { |
| 58 if (!HasSameParameterKey(*it, safe_parameter) && | 58 if (!HasSameParameterKey(*it, safe_parameter) && |
| 59 !HasSameParameterKey(*it, ssui_parameter)) { | 59 !HasSameParameterKey(*it, ssui_parameter)) { |
| 60 new_parameters.push_back(*it); | 60 new_parameters.push_back(*it); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 new_parameters.push_back(safe_parameter); | 64 new_parameters.push_back(safe_parameter); |
| 65 new_parameters.push_back(ssui_parameter); | 65 new_parameters.push_back(ssui_parameter); |
| 66 return base::JoinString(new_parameters, "&"); | 66 return JoinString(new_parameters, '&'); |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace | 69 } // namespace |
| 70 | 70 |
| 71 namespace safe_search_util { | 71 namespace safe_search_util { |
| 72 | 72 |
| 73 // If |request| is a request to Google Web Search the function | 73 // If |request| is a request to Google Web Search the function |
| 74 // enforces that the SafeSearch query parameters are set to active. | 74 // enforces that the SafeSearch query parameters are set to active. |
| 75 // Sets the query part of |new_url| with the new value of the parameters. | 75 // Sets the query part of |new_url| with the new value of the parameters. |
| 76 void ForceGoogleSafeSearch(const net::URLRequest* request, GURL* new_url) { | 76 void ForceGoogleSafeSearch(const net::URLRequest* request, GURL* new_url) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 void ClearForceGoogleSafeSearchCountForTesting() { | 117 void ClearForceGoogleSafeSearchCountForTesting() { |
| 118 g_force_google_safe_search_count_for_test = 0; | 118 g_force_google_safe_search_count_for_test = 0; |
| 119 } | 119 } |
| 120 | 120 |
| 121 void ClearForceYouTubeSafetyModeCountForTesting() { | 121 void ClearForceYouTubeSafetyModeCountForTesting() { |
| 122 g_force_youtube_safety_mode_count_for_test = 0; | 122 g_force_youtube_safety_mode_count_for_test = 0; |
| 123 } | 123 } |
| 124 | 124 |
| 125 } // namespace safe_search_util | 125 } // namespace safe_search_util |
| OLD | NEW |