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

Side by Side Diff: chrome/browser/privacy_blacklist/blacklist.cc

Issue 2865003: Working towards -Wextra... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/cocoa/objc_zombie.mm ('k') | chrome/browser/sessions/tab_restore_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/privacy_blacklist/blacklist.h" 5 #include "chrome/browser/privacy_blacklist/blacklist.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 10
(...skipping 25 matching lines...) Expand all
36 // static 36 // static
37 bool Blacklist::Matches(const std::string& pattern, const std::string& url) { 37 bool Blacklist::Matches(const std::string& pattern, const std::string& url) {
38 if (pattern.size() > url.size()) 38 if (pattern.size() > url.size())
39 return false; 39 return false;
40 40
41 std::string::size_type p = 0; 41 std::string::size_type p = 0;
42 std::string::size_type u = 0; 42 std::string::size_type u = 0;
43 43
44 while (pattern[p] != '\0' && url[u] != '\0') { 44 while (pattern[p] != '\0' && url[u] != '\0') {
45 if (pattern[p] == '@') { 45 if (pattern[p] == '@') {
46 while (pattern[++p] == '@'); // Consecutive @ are redundant. 46 while (pattern[++p] == '@') {} // Consecutive @ are redundant.
47 47
48 if (pattern[p] == '\0') 48 if (pattern[p] == '\0')
49 return true; // Nothing to match after the @. 49 return true; // Nothing to match after the @.
50 50
51 // Look for another wildcard to determine pattern-chunk. 51 // Look for another wildcard to determine pattern-chunk.
52 std::string::size_type tp = pattern.find_first_of("@", p); 52 std::string::size_type tp = pattern.find_first_of("@", p);
53 53
54 // If it must match until the end, compare the last characters. 54 // If it must match until the end, compare the last characters.
55 if (tp == std::string::npos) { 55 if (tp == std::string::npos) {
56 std::string::size_type ur = url.size() - u; 56 std::string::size_type ur = url.size() - u;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 214
215 // static 215 // static
216 void Blacklist::RegisterUserPrefs(PrefService* user_prefs) { 216 void Blacklist::RegisterUserPrefs(PrefService* user_prefs) {
217 user_prefs->RegisterDictionaryPref(prefs::kPrivacyFilterRules); 217 user_prefs->RegisterDictionaryPref(prefs::kPrivacyFilterRules);
218 } 218 }
219 219
220 // static 220 // static
221 std::string Blacklist::StripCookies(const std::string& header) { 221 std::string Blacklist::StripCookies(const std::string& header) {
222 return net::HttpUtil::StripHeaders(header, cookie_headers, 2); 222 return net::HttpUtil::StripHeaders(header, cookie_headers, 2);
223 } 223 }
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/objc_zombie.mm ('k') | chrome/browser/sessions/tab_restore_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698