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 // BrowserFeatureExtractor computes various browser features for client-side | 5 // BrowserFeatureExtractor computes various browser features for client-side |
6 // phishing detection. For now it does a bunch of lookups in the history | 6 // phishing detection. For now it does a bunch of lookups in the history |
7 // service to see whether a particular URL has been visited before by the | 7 // service to see whether a particular URL has been visited before by the |
8 // user. | 8 // user. |
9 | 9 |
10 #ifndef CHROME_BROWSER_SAFE_BROWSING_BROWSER_FEATURE_EXTRACTOR_H_ | 10 #ifndef CHROME_BROWSER_SAFE_BROWSING_BROWSER_FEATURE_EXTRACTOR_H_ |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // Begins extraction of the browser features. We take ownership | 67 // Begins extraction of the browser features. We take ownership |
68 // of the request object until |callback| is called (see DoneCallback above) | 68 // of the request object until |callback| is called (see DoneCallback above) |
69 // and will write the extracted features to the feature map. Once the | 69 // and will write the extracted features to the feature map. Once the |
70 // feature extraction is complete, |callback| is run on the UI thread. We | 70 // feature extraction is complete, |callback| is run on the UI thread. We |
71 // take ownership of the |callback| object. |info| may not be valid after | 71 // take ownership of the |callback| object. |info| may not be valid after |
72 // ExtractFeatures returns. This method must run on the UI thread. | 72 // ExtractFeatures returns. This method must run on the UI thread. |
73 virtual void ExtractFeatures(const BrowseInfo* info, | 73 virtual void ExtractFeatures(const BrowseInfo* info, |
74 ClientPhishingRequest* request, | 74 ClientPhishingRequest* request, |
75 DoneCallback* callback); | 75 DoneCallback* callback); |
76 | 76 |
77 // The size of hash prefix to use for | 77 // The size of hash prefix to use for ClientPhishingRequest.hash_prefix. |
78 // ClientPhishingRequest.suffix_prefix_hash. Public for testing. | 78 // Public for testing. |
79 static const int kSuffixPrefixHashLength; | 79 static const int kHashPrefixLength; |
80 | 80 |
81 private: | 81 private: |
82 friend class DeleteTask<BrowserFeatureExtractor>; | 82 friend class DeleteTask<BrowserFeatureExtractor>; |
83 typedef std::pair<ClientPhishingRequest*, DoneCallback*> ExtractionData; | 83 typedef std::pair<ClientPhishingRequest*, DoneCallback*> ExtractionData; |
84 typedef std::map<CancelableRequestProvider::Handle, | 84 typedef std::map<CancelableRequestProvider::Handle, |
85 ExtractionData> PendingQueriesMap; | 85 ExtractionData> PendingQueriesMap; |
86 | 86 |
87 // Synchronous browser feature extraction. | 87 // Synchronous browser feature extraction. |
88 void ExtractBrowseInfoFeatures(const BrowseInfo& info, | 88 void ExtractBrowseInfoFeatures(const BrowseInfo& info, |
89 ClientPhishingRequest* request); | 89 ClientPhishingRequest* request); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 std::set<ExtractionData> pending_extractions_; | 153 std::set<ExtractionData> pending_extractions_; |
154 | 154 |
155 // Set of pending queries (i.e., where history->Query...() was called but | 155 // Set of pending queries (i.e., where history->Query...() was called but |
156 // the history callback hasn't been invoked yet). | 156 // the history callback hasn't been invoked yet). |
157 PendingQueriesMap pending_queries_; | 157 PendingQueriesMap pending_queries_; |
158 | 158 |
159 DISALLOW_COPY_AND_ASSIGN(BrowserFeatureExtractor); | 159 DISALLOW_COPY_AND_ASSIGN(BrowserFeatureExtractor); |
160 }; | 160 }; |
161 } // namespace safe_browsing | 161 } // namespace safe_browsing |
162 #endif // CHROME_BROWSER_SAFE_BROWSING_BROWSER_FEATURE_EXTRACTOR_H_ | 162 #endif // CHROME_BROWSER_SAFE_BROWSING_BROWSER_FEATURE_EXTRACTOR_H_ |
OLD | NEW |