OLD | NEW |
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/renderer/safe_browsing/phishing_term_feature_extractor.h" | 5 #include "chrome/renderer/safe_browsing/phishing_term_feature_extractor.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/i18n/break_iterator.h" | 12 #include "base/i18n/break_iterator.h" |
13 #include "base/i18n/case_conversion.h" | 13 #include "base/i18n/case_conversion.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
20 #include "chrome/renderer/safe_browsing/feature_extractor_clock.h" | 20 #include "chrome/renderer/safe_browsing/feature_extractor_clock.h" |
21 #include "chrome/renderer/safe_browsing/features.h" | 21 #include "chrome/renderer/safe_browsing/features.h" |
22 #include "chrome/renderer/safe_browsing/murmurhash3_util.h" | 22 #include "chrome/renderer/safe_browsing/murmurhash3_util.h" |
23 #include "crypto/sha2.h" | 23 #include "crypto/sha2.h" |
24 #include "ui/base/l10n/l10n_util.h" | |
25 | 24 |
26 namespace safe_browsing { | 25 namespace safe_browsing { |
27 | 26 |
28 // This time should be short enough that it doesn't noticeably disrupt the | 27 // This time should be short enough that it doesn't noticeably disrupt the |
29 // user's interaction with the page. | 28 // user's interaction with the page. |
30 const int PhishingTermFeatureExtractor::kMaxTimePerChunkMs = 10; | 29 const int PhishingTermFeatureExtractor::kMaxTimePerChunkMs = 10; |
31 | 30 |
32 // Experimenting shows that we get a reasonable gain in performance by | 31 // Experimenting shows that we get a reasonable gain in performance by |
33 // increasing this up to around 10, but there's not much benefit in | 32 // increasing this up to around 10, but there's not much benefit in |
34 // increasing it past that. | 33 // increasing it past that. |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 288 |
290 void PhishingTermFeatureExtractor::Clear() { | 289 void PhishingTermFeatureExtractor::Clear() { |
291 page_text_ = NULL; | 290 page_text_ = NULL; |
292 features_ = NULL; | 291 features_ = NULL; |
293 shingle_hashes_ = NULL; | 292 shingle_hashes_ = NULL; |
294 done_callback_.Reset(); | 293 done_callback_.Reset(); |
295 state_.reset(NULL); | 294 state_.reset(NULL); |
296 } | 295 } |
297 | 296 |
298 } // namespace safe_browsing | 297 } // namespace safe_browsing |
OLD | NEW |