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.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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 dom_extractor_.reset(); | 71 dom_extractor_.reset(); |
72 term_extractor_.reset(); | 72 term_extractor_.reset(); |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 bool PhishingClassifier::is_ready() const { | 76 bool PhishingClassifier::is_ready() const { |
77 return scorer_ != NULL; | 77 return scorer_ != NULL; |
78 } | 78 } |
79 | 79 |
80 void PhishingClassifier::BeginClassification( | 80 void PhishingClassifier::BeginClassification( |
81 const string16* page_text, | 81 const base::string16* page_text, |
82 const DoneCallback& done_callback) { | 82 const DoneCallback& done_callback) { |
83 DCHECK(is_ready()); | 83 DCHECK(is_ready()); |
84 | 84 |
85 // The RenderView should have called CancelPendingClassification() before | 85 // The RenderView should have called CancelPendingClassification() before |
86 // starting a new classification, so DCHECK this. | 86 // starting a new classification, so DCHECK this. |
87 CheckNoPendingClassification(); | 87 CheckNoPendingClassification(); |
88 // However, in an opt build, we will go ahead and clean up the pending | 88 // However, in an opt build, we will go ahead and clean up the pending |
89 // classification so that we can start in a known state. | 89 // classification so that we can start in a known state. |
90 CancelPendingClassification(); | 90 CancelPendingClassification(); |
91 | 91 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 RunCallback(verdict); | 232 RunCallback(verdict); |
233 } | 233 } |
234 | 234 |
235 void PhishingClassifier::Clear() { | 235 void PhishingClassifier::Clear() { |
236 page_text_ = NULL; | 236 page_text_ = NULL; |
237 done_callback_.Reset(); | 237 done_callback_.Reset(); |
238 features_.reset(NULL); | 238 features_.reset(NULL); |
239 } | 239 } |
240 | 240 |
241 } // namespace safe_browsing | 241 } // namespace safe_browsing |
OLD | NEW |