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

Side by Side Diff: chrome/browser/net/safe_search_util.cc

Issue 1569673002: [NOT FOR LANDING] Detailed loading traces Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 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 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
11 #include "base/trace_event/trace_event.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_piece.h" 15 #include "base/strings/string_piece.h"
15 #include "base/strings/string_split.h" 16 #include "base/strings/string_split.h"
16 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
17 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
18 #include "chrome/common/url_constants.h" 19 #include "chrome/common/url_constants.h"
19 #include "components/google/core/browser/google_util.h" 20 #include "components/google/core/browser/google_util.h"
20 #include "net/cookies/cookie_util.h" 21 #include "net/cookies/cookie_util.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 66 }
66 67
67 } // namespace 68 } // namespace
68 69
69 namespace safe_search_util { 70 namespace safe_search_util {
70 71
71 // If |request| is a request to Google Web Search the function 72 // If |request| is a request to Google Web Search the function
72 // enforces that the SafeSearch query parameters are set to active. 73 // enforces that the SafeSearch query parameters are set to active.
73 // Sets the query part of |new_url| with the new value of the parameters. 74 // Sets the query part of |new_url| with the new value of the parameters.
74 void ForceGoogleSafeSearch(const net::URLRequest* request, GURL* new_url) { 75 void ForceGoogleSafeSearch(const net::URLRequest* request, GURL* new_url) {
76 TRACE_EVENT0("toplevel", "SafeSearchUtil ForceGoogleSafeSearch");
77
75 ++g_force_google_safe_search_count_for_test; 78 ++g_force_google_safe_search_count_for_test;
76 79
77 if (!google_util::IsGoogleSearchUrl(request->url()) && 80 if (!google_util::IsGoogleSearchUrl(request->url()) &&
78 !google_util::IsGoogleHomePageUrl(request->url())) 81 !google_util::IsGoogleHomePageUrl(request->url()))
79 return; 82 return;
80 83
81 std::string query = request->url().query(); 84 std::string query = request->url().query();
82 std::string new_query = AddSafeSearchParameters(query); 85 std::string new_query = AddSafeSearchParameters(query);
83 if (query == new_query) 86 if (query == new_query)
84 return; 87 return;
(...skipping 29 matching lines...) Expand all
114 117
115 void ClearForceGoogleSafeSearchCountForTesting() { 118 void ClearForceGoogleSafeSearchCountForTesting() {
116 g_force_google_safe_search_count_for_test = 0; 119 g_force_google_safe_search_count_for_test = 0;
117 } 120 }
118 121
119 void ClearForceYouTubeSafetyModeCountForTesting() { 122 void ClearForceYouTubeSafetyModeCountForTesting() {
120 g_force_youtube_safety_mode_count_for_test = 0; 123 g_force_youtube_safety_mode_count_for_test = 0;
121 } 124 }
122 125
123 } // namespace safe_search_util 126 } // namespace safe_search_util
OLDNEW
« no previous file with comments | « chrome/browser/net/connect_interceptor.cc ('k') | chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698