| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 IPUrlInfo(const std::string& url, | 51 IPUrlInfo(const std::string& url, |
| 52 const std::string& method, | 52 const std::string& method, |
| 53 const std::string& referrer, | 53 const std::string& referrer, |
| 54 const ResourceType::Type& resource_type); | 54 const ResourceType::Type& resource_type); |
| 55 ~IPUrlInfo(); | 55 ~IPUrlInfo(); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 typedef std::map<std::string, std::vector<IPUrlInfo> > IPUrlMap; | 58 typedef std::map<std::string, std::vector<IPUrlInfo> > IPUrlMap; |
| 59 | 59 |
| 60 struct BrowseInfo { | 60 struct BrowseInfo { |
| 61 // The URL we're currently browsing. |
| 62 GURL url; |
| 63 |
| 61 // List of IPv4 and IPv6 addresses from which content was requested | 64 // List of IPv4 and IPv6 addresses from which content was requested |
| 62 // together with the hosts on it, while browsing to the |url|. | 65 // together with the hosts on it, while browsing to the |url|. |
| 63 IPUrlMap ips; | 66 IPUrlMap ips; |
| 64 | 67 |
| 65 // If a SafeBrowsing interstitial was shown for the current URL | 68 // If a SafeBrowsing interstitial was shown for the current URL |
| 66 // this will contain the UnsafeResource struct for that URL. | 69 // this will contain the UnsafeResource struct for that URL. |
| 67 scoped_ptr<SafeBrowsingUIManager::UnsafeResource> unsafe_resource; | 70 scoped_ptr<SafeBrowsingUIManager::UnsafeResource> unsafe_resource; |
| 68 | 71 |
| 69 // List of redirects that lead to the first page on the current host and | 72 // List of redirects that lead to the first page on the current host and |
| 70 // the current url respectively. These may be the same if the current url | 73 // the current url respectively. These may be the same if the current url |
| 71 // is the first page on its host. | 74 // is the first page on its host. |
| 72 std::vector<GURL> host_redirects; | 75 std::vector<GURL> host_redirects; |
| 73 std::vector<GURL> url_redirects; | 76 std::vector<GURL> url_redirects; |
| 74 | 77 |
| 75 // URL of the referrer of this URL load. | 78 // URL of the referrer of this URL load. |
| 76 GURL referrer; | 79 GURL referrer; |
| 77 | 80 |
| 78 // The HTTP status code from this navigation. | 81 // The HTTP status code from this navigation. |
| 79 int http_status_code; | 82 int http_status_code; |
| 80 | 83 |
| 84 // The page ID of the navigation. This comes from FrameNavigateParams. |
| 85 int32 page_id; |
| 86 |
| 81 BrowseInfo(); | 87 BrowseInfo(); |
| 82 ~BrowseInfo(); | 88 ~BrowseInfo(); |
| 83 }; | 89 }; |
| 84 | 90 |
| 85 // All methods of this class must be called on the UI thread (including | 91 // All methods of this class must be called on the UI thread (including |
| 86 // the constructor). | 92 // the constructor). |
| 87 class BrowserFeatureExtractor { | 93 class BrowserFeatureExtractor { |
| 88 public: | 94 public: |
| 89 // Called when feature extraction is done. The first argument will be | 95 // Called when feature extraction is done. The first argument will be |
| 90 // true iff feature extraction succeeded. The second argument is the | 96 // true iff feature extraction succeeded. The second argument is the |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 206 |
| 201 // Set of pending queries (i.e., where history->Query...() was called but | 207 // Set of pending queries (i.e., where history->Query...() was called but |
| 202 // the history callback hasn't been invoked yet). | 208 // the history callback hasn't been invoked yet). |
| 203 PendingQueriesMap pending_queries_; | 209 PendingQueriesMap pending_queries_; |
| 204 | 210 |
| 205 DISALLOW_COPY_AND_ASSIGN(BrowserFeatureExtractor); | 211 DISALLOW_COPY_AND_ASSIGN(BrowserFeatureExtractor); |
| 206 }; | 212 }; |
| 207 | 213 |
| 208 } // namespace safe_browsing | 214 } // namespace safe_browsing |
| 209 #endif // CHROME_BROWSER_SAFE_BROWSING_BROWSER_FEATURE_EXTRACTOR_H_ | 215 #endif // CHROME_BROWSER_SAFE_BROWSING_BROWSER_FEATURE_EXTRACTOR_H_ |
| OLD | NEW |