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

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

Issue 7408001: If we show a SafeBrowsing warning we always send the client-side detection (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Merge Created 9 years, 5 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
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_delegate.h" 5 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 IPC_END_MESSAGE_MAP() 192 IPC_END_MESSAGE_MAP()
193 return handled; 193 return handled;
194 } 194 }
195 195
196 void PhishingClassifierDelegate::ClassificationDone( 196 void PhishingClassifierDelegate::ClassificationDone(
197 const ClientPhishingRequest& verdict) { 197 const ClientPhishingRequest& verdict) {
198 // We no longer need the page text. 198 // We no longer need the page text.
199 classifier_page_text_.clear(); 199 classifier_page_text_.clear();
200 VLOG(2) << "Phishy verdict = " << verdict.is_phishing() 200 VLOG(2) << "Phishy verdict = " << verdict.is_phishing()
201 << " score = " << verdict.client_score(); 201 << " score = " << verdict.client_score();
202 if (!verdict.is_phishing()) { 202 if (verdict.client_score() != PhishingClassifier::kInvalidScore) {
203 return; 203 DCHECK_EQ(last_url_sent_to_classifier_.spec(), verdict.url());
204 Send(new SafeBrowsingHostMsg_PhishingDetectionDone(
205 routing_id(), verdict.SerializeAsString()));
204 } 206 }
205 DCHECK(last_url_sent_to_classifier_.spec() == verdict.url());
206 Send(new SafeBrowsingHostMsg_DetectedPhishingSite(
207 routing_id(), verdict.SerializeAsString()));
208 } 207 }
209 208
210 GURL PhishingClassifierDelegate::GetToplevelUrl() { 209 GURL PhishingClassifierDelegate::GetToplevelUrl() {
211 return render_view()->webview()->mainFrame()->document().url(); 210 return render_view()->webview()->mainFrame()->document().url();
212 } 211 }
213 212
214 void PhishingClassifierDelegate::MaybeStartClassification() { 213 void PhishingClassifierDelegate::MaybeStartClassification() {
215 // We can begin phishing classification when the following conditions are 214 // We can begin phishing classification when the following conditions are
216 // met: 215 // met:
217 // 1. A Scorer has been created 216 // 1. A Scorer has been created
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 271
273 VLOG(2) << "Starting classification for " << last_finished_load_url_; 272 VLOG(2) << "Starting classification for " << last_finished_load_url_;
274 last_url_sent_to_classifier_ = last_finished_load_url_; 273 last_url_sent_to_classifier_ = last_finished_load_url_;
275 is_classifying_ = true; 274 is_classifying_ = true;
276 classifier_->BeginClassification( 275 classifier_->BeginClassification(
277 &classifier_page_text_, 276 &classifier_page_text_,
278 NewCallback(this, &PhishingClassifierDelegate::ClassificationDone)); 277 NewCallback(this, &PhishingClassifierDelegate::ClassificationDone));
279 } 278 }
280 279
281 } // namespace safe_browsing 280 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698