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 #ifndef CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_HOST_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_HOST_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_HOST_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_callback_factory.h" | 11 #include "base/memory/scoped_callback_factory.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "chrome/browser/safe_browsing/browser_feature_extractor.h" |
13 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 14 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
14 #include "content/browser/tab_contents/tab_contents_observer.h" | 15 #include "content/browser/tab_contents/tab_contents_observer.h" |
15 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
16 | 17 |
17 class TabContents; | 18 class TabContents; |
18 | 19 |
19 namespace safe_browsing { | 20 namespace safe_browsing { |
20 class BrowserFeatureExtractor; | |
21 class ClientPhishingRequest; | 21 class ClientPhishingRequest; |
22 class ClientSideDetectionService; | 22 class ClientSideDetectionService; |
23 | 23 |
24 // This class is used to receive the IPC from the renderer which | 24 // This class is used to receive the IPC from the renderer which |
25 // notifies the browser that a URL was classified as phishing. This | 25 // notifies the browser that a URL was classified as phishing. This |
26 // class relays this information to the client-side detection service | 26 // class relays this information to the client-side detection service |
27 // class which sends a ping to a server to validate the verdict. | 27 // class which sends a ping to a server to validate the verdict. |
28 // TODO(noelutz): move all client-side detection IPCs to this class. | 28 // TODO(noelutz): move all client-side detection IPCs to this class. |
29 class ClientSideDetectionHost : public TabContentsObserver { | 29 class ClientSideDetectionHost : public TabContentsObserver { |
30 public: | 30 public: |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 // This pointer may be NULL if client-side phishing detection is disabled. | 78 // This pointer may be NULL if client-side phishing detection is disabled. |
79 ClientSideDetectionService* csd_service_; | 79 ClientSideDetectionService* csd_service_; |
80 // This pointer may be NULL if SafeBrowsing is disabled. | 80 // This pointer may be NULL if SafeBrowsing is disabled. |
81 scoped_refptr<SafeBrowsingService> sb_service_; | 81 scoped_refptr<SafeBrowsingService> sb_service_; |
82 // Keep a handle to the latest classification request so that we can cancel | 82 // Keep a handle to the latest classification request so that we can cancel |
83 // it if necessary. | 83 // it if necessary. |
84 scoped_refptr<ShouldClassifyUrlRequest> classification_request_; | 84 scoped_refptr<ShouldClassifyUrlRequest> classification_request_; |
85 // Browser-side feature extractor. | 85 // Browser-side feature extractor. |
86 scoped_ptr<BrowserFeatureExtractor> feature_extractor_; | 86 scoped_ptr<BrowserFeatureExtractor> feature_extractor_; |
| 87 // Keeps some info about the current page visit while the renderer |
| 88 // classification is going on. Since we cancel classification on |
| 89 // every page load we can simply keep this data around as a member |
| 90 // variable. This information will be passed on to the feature extractor. |
| 91 scoped_ptr<BrowseInfo> browse_info_; |
87 | 92 |
88 base::ScopedCallbackFactory<ClientSideDetectionHost> cb_factory_; | 93 base::ScopedCallbackFactory<ClientSideDetectionHost> cb_factory_; |
89 | 94 |
90 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionHost); | 95 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionHost); |
91 }; | 96 }; |
92 | 97 |
93 } // namespace safe_browsing | 98 } // namespace safe_browsing |
94 | 99 |
95 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_HOST_H_ | 100 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_HOST_H_ |
OLD | NEW |