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 #include <utility> |
9 | 10 |
10 #include "base/bind.h" | 11 #include "base/bind.h" |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
12 #include "base/i18n/break_iterator.h" | 13 #include "base/i18n/break_iterator.h" |
13 #include "base/i18n/case_conversion.h" | 14 #include "base/i18n/case_conversion.h" |
14 #include "base/location.h" | 15 #include "base/location.h" |
15 #include "base/logging.h" | 16 #include "base/logging.h" |
16 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
17 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
18 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 69 |
69 ExtractionState(const base::string16& text, base::TimeTicks start_time_ticks) | 70 ExtractionState(const base::string16& text, base::TimeTicks start_time_ticks) |
70 : start_time(start_time_ticks), | 71 : start_time(start_time_ticks), |
71 num_iterations(0) { | 72 num_iterations(0) { |
72 | 73 |
73 scoped_ptr<base::i18n::BreakIterator> i( | 74 scoped_ptr<base::i18n::BreakIterator> i( |
74 new base::i18n::BreakIterator( | 75 new base::i18n::BreakIterator( |
75 text, base::i18n::BreakIterator::BREAK_WORD)); | 76 text, base::i18n::BreakIterator::BREAK_WORD)); |
76 | 77 |
77 if (i->Init()) { | 78 if (i->Init()) { |
78 iterator = i.Pass(); | 79 iterator = std::move(i); |
79 } else { | 80 } else { |
80 DLOG(ERROR) << "failed to open iterator"; | 81 DLOG(ERROR) << "failed to open iterator"; |
81 } | 82 } |
82 } | 83 } |
83 }; | 84 }; |
84 | 85 |
85 PhishingTermFeatureExtractor::PhishingTermFeatureExtractor( | 86 PhishingTermFeatureExtractor::PhishingTermFeatureExtractor( |
86 const base::hash_set<std::string>* page_term_hashes, | 87 const base::hash_set<std::string>* page_term_hashes, |
87 const base::hash_set<uint32_t>* page_word_hashes, | 88 const base::hash_set<uint32_t>* page_word_hashes, |
88 size_t max_words_per_term, | 89 size_t max_words_per_term, |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 291 |
291 void PhishingTermFeatureExtractor::Clear() { | 292 void PhishingTermFeatureExtractor::Clear() { |
292 page_text_ = NULL; | 293 page_text_ = NULL; |
293 features_ = NULL; | 294 features_ = NULL; |
294 shingle_hashes_ = NULL; | 295 shingle_hashes_ = NULL; |
295 done_callback_.Reset(); | 296 done_callback_.Reset(); |
296 state_.reset(NULL); | 297 state_.reset(NULL); |
297 } | 298 } |
298 | 299 |
299 } // namespace safe_browsing | 300 } // namespace safe_browsing |
OLD | NEW |