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

Side by Side Diff: chrome/browser/safe_browsing/browser_feature_extractor.cc

Issue 1098983003: Switch SchemeIsSecure to SchemeIsCryptographic for referrer-related code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | components/sessions/ios/ios_serialized_navigation_driver.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) 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/safe_browsing/browser_feature_extractor.h" 5 #include "chrome/browser/safe_browsing/browser_feature_extractor.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 DVLOG(2) << "Added url info for bad ip: " << ip; 101 DVLOG(2) << "Added url info for bad ip: " << ip;
102 } 102 }
103 103
104 static void AddNavigationFeatures( 104 static void AddNavigationFeatures(
105 const std::string& feature_prefix, 105 const std::string& feature_prefix,
106 const NavigationController& controller, 106 const NavigationController& controller,
107 int index, 107 int index,
108 const std::vector<GURL>& redirect_chain, 108 const std::vector<GURL>& redirect_chain,
109 ClientPhishingRequest* request) { 109 ClientPhishingRequest* request) {
110 NavigationEntry* entry = controller.GetEntryAtIndex(index); 110 NavigationEntry* entry = controller.GetEntryAtIndex(index);
111 bool is_secure_referrer = entry->GetReferrer().url.SchemeIsSecure(); 111 bool is_secure_referrer = entry->GetReferrer().url.SchemeIsCryptographic();
112 if (!is_secure_referrer) { 112 if (!is_secure_referrer) {
113 AddFeature(base::StringPrintf("%s%s=%s", 113 AddFeature(base::StringPrintf("%s%s=%s",
114 feature_prefix.c_str(), 114 feature_prefix.c_str(),
115 features::kReferrer, 115 features::kReferrer,
116 entry->GetReferrer().url.spec().c_str()), 116 entry->GetReferrer().url.spec().c_str()),
117 1.0, 117 1.0,
118 request); 118 request);
119 } 119 }
120 AddFeature(feature_prefix + features::kHasSSLReferrer, 120 AddFeature(feature_prefix + features::kHasSSLReferrer,
121 is_secure_referrer ? 1.0 : 0.0, 121 is_secure_referrer ? 1.0 : 0.0,
(...skipping 21 matching lines...) Expand all
143 DLOG(WARNING) << "Expected:" << entry->GetURL() 143 DLOG(WARNING) << "Expected:" << entry->GetURL()
144 << " Actual:" << redirect_chain.back(); 144 << " Actual:" << redirect_chain.back();
145 AddFeature(feature_prefix + features::kRedirectUrlMismatch, 145 AddFeature(feature_prefix + features::kRedirectUrlMismatch,
146 1.0, 146 1.0,
147 request); 147 request);
148 return; 148 return;
149 } 149 }
150 // We skip the last element since it should just be the current url. 150 // We skip the last element since it should just be the current url.
151 for (size_t i = 0; i < redirect_chain.size() - 1; i++) { 151 for (size_t i = 0; i < redirect_chain.size() - 1; i++) {
152 std::string printable_redirect = redirect_chain[i].spec(); 152 std::string printable_redirect = redirect_chain[i].spec();
153 if (redirect_chain[i].SchemeIsSecure()) { 153 if (redirect_chain[i].SchemeIsCryptographic()) {
154 printable_redirect = features::kSecureRedirectValue; 154 printable_redirect = features::kSecureRedirectValue;
155 } 155 }
156 AddFeature(base::StringPrintf("%s%s[%" PRIuS "]=%s", 156 AddFeature(base::StringPrintf("%s%s[%" PRIuS "]=%s",
157 feature_prefix.c_str(), 157 feature_prefix.c_str(),
158 features::kRedirect, 158 features::kRedirect,
159 i, 159 i,
160 printable_redirect.c_str()), 160 printable_redirect.c_str()),
161 1.0, 161 1.0,
162 request); 162 request);
163 } 163 }
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 // Limit the number of matched bad IPs in one request to control 482 // Limit the number of matched bad IPs in one request to control
483 // the request's size 483 // the request's size
484 if (matched_bad_ips >= kMaxMalwareIPPerRequest) { 484 if (matched_bad_ips >= kMaxMalwareIPPerRequest) {
485 break; 485 break;
486 } 486 }
487 } 487 }
488 callback.Run(true, request.Pass()); 488 callback.Run(true, request.Pass());
489 } 489 }
490 490
491 } // namespace safe_browsing 491 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | components/sessions/ios/ios_serialized_navigation_driver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698