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

Side by Side Diff: chrome/renderer/safe_browsing/phishing_classifier.cc

Issue 2649413002: Use explicit WebString conversions in chrome/renderer/safe_browsing (Closed)
Patch Set: addressed comments Created 3 years, 11 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 | chrome/renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/renderer/safe_browsing/phishing_classifier.h" 5 #include "chrome/renderer/safe_browsing/phishing_classifier.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // Check whether the URL is one that we should classify. 128 // Check whether the URL is one that we should classify.
129 // Currently, we only classify http: URLs that are GET requests. 129 // Currently, we only classify http: URLs that are GET requests.
130 GURL url(frame->document().url()); 130 GURL url(frame->document().url());
131 if (!url.SchemeIs(url::kHttpScheme)) { 131 if (!url.SchemeIs(url::kHttpScheme)) {
132 RecordReasonForSkippingClassificationToUMA(SKIP_HTTPS); 132 RecordReasonForSkippingClassificationToUMA(SKIP_HTTPS);
133 RunFailureCallback(); 133 RunFailureCallback();
134 return; 134 return;
135 } 135 }
136 136
137 blink::WebDataSource* ds = frame->dataSource(); 137 blink::WebDataSource* ds = frame->dataSource();
138 if (!ds || 138 if (!ds || ds->getRequest().httpMethod().ascii() != "GET") {
139 !base::EqualsASCII(base::StringPiece16(ds->getRequest().httpMethod()),
140 "GET")) {
141 if (ds) 139 if (ds)
142 RecordReasonForSkippingClassificationToUMA(SKIP_NONE_GET); 140 RecordReasonForSkippingClassificationToUMA(SKIP_NONE_GET);
143 RunFailureCallback(); 141 RunFailureCallback();
144 return; 142 return;
145 } 143 }
146 144
147 RecordReasonForSkippingClassificationToUMA(CLASSIFICATION_PROCEED); 145 RecordReasonForSkippingClassificationToUMA(CLASSIFICATION_PROCEED);
148 features_.reset(new FeatureMap); 146 features_.reset(new FeatureMap);
149 if (!url_extractor_->ExtractFeatures(url, features_.get())) { 147 if (!url_extractor_->ExtractFeatures(url, features_.get())) {
150 RunFailureCallback(); 148 RunFailureCallback();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 } 242 }
245 243
246 void PhishingClassifier::Clear() { 244 void PhishingClassifier::Clear() {
247 page_text_ = NULL; 245 page_text_ = NULL;
248 done_callback_.Reset(); 246 done_callback_.Reset();
249 features_.reset(NULL); 247 features_.reset(NULL);
250 shingle_hashes_.reset(NULL); 248 shingle_hashes_.reset(NULL);
251 } 249 }
252 250
253 } // namespace safe_browsing 251 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698