| OLD | NEW |
| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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.client_score() != PhishingClassifier::kInvalidScore) { | 202 if (verdict.client_score() != PhishingClassifier::kInvalidScore) { |
| 203 DCHECK_EQ(last_url_sent_to_classifier_.spec(), verdict.url()); | 203 DCHECK_EQ(last_url_sent_to_classifier_.spec(), verdict.url()); |
| 204 Send(new SafeBrowsingHostMsg_PhishingDetectionDone( | 204 RenderThread::current()->Send(new SafeBrowsingHostMsg_PhishingDetectionDone( |
| 205 routing_id(), verdict.SerializeAsString())); | 205 routing_id(), verdict.SerializeAsString())); |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 | 208 |
| 209 GURL PhishingClassifierDelegate::GetToplevelUrl() { | 209 GURL PhishingClassifierDelegate::GetToplevelUrl() { |
| 210 return render_view()->webview()->mainFrame()->document().url(); | 210 return render_view()->webview()->mainFrame()->document().url(); |
| 211 } | 211 } |
| 212 | 212 |
| 213 void PhishingClassifierDelegate::MaybeStartClassification() { | 213 void PhishingClassifierDelegate::MaybeStartClassification() { |
| 214 // We can begin phishing classification when the following conditions are | 214 // We can begin phishing classification when the following conditions are |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 VLOG(2) << "Starting classification for " << last_finished_load_url_; | 272 VLOG(2) << "Starting classification for " << last_finished_load_url_; |
| 273 last_url_sent_to_classifier_ = last_finished_load_url_; | 273 last_url_sent_to_classifier_ = last_finished_load_url_; |
| 274 is_classifying_ = true; | 274 is_classifying_ = true; |
| 275 classifier_->BeginClassification( | 275 classifier_->BeginClassification( |
| 276 &classifier_page_text_, | 276 &classifier_page_text_, |
| 277 NewCallback(this, &PhishingClassifierDelegate::ClassificationDone)); | 277 NewCallback(this, &PhishingClassifierDelegate::ClassificationDone)); |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace safe_browsing | 280 } // namespace safe_browsing |
| OLD | NEW |