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/browser_feature_extractor.h" |
14 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 14 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
15 #include "content/browser/tab_contents/tab_contents_observer.h" | 15 #include "content/browser/tab_contents/tab_contents_observer.h" |
16 #include "content/common/notification_registrar.h" | 16 #include "content/common/notification_registrar.h" |
17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
18 | 18 |
19 class NotificationDetails; | 19 class NotificationDetails; |
20 class NotificationSource; | 20 class NotificationSource; |
21 class NotificationType; | |
22 class TabContents; | 21 class TabContents; |
23 | 22 |
24 namespace safe_browsing { | 23 namespace safe_browsing { |
25 class ClientPhishingRequest; | 24 class ClientPhishingRequest; |
26 class ClientSideDetectionService; | 25 class ClientSideDetectionService; |
27 | 26 |
28 // This class is used to receive the IPC from the renderer which | 27 // This class is used to receive the IPC from the renderer which |
29 // notifies the browser that a URL was classified as phishing. This | 28 // notifies the browser that a URL was classified as phishing. This |
30 // class relays this information to the client-side detection service | 29 // class relays this information to the client-side detection service |
31 // class which sends a ping to a server to validate the verdict. | 30 // class which sends a ping to a server to validate the verdict. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // Otherwise, we do nothing. Called in UI thread. | 66 // Otherwise, we do nothing. Called in UI thread. |
68 void MaybeShowPhishingWarning(GURL phishing_url, bool is_phishing); | 67 void MaybeShowPhishingWarning(GURL phishing_url, bool is_phishing); |
69 | 68 |
70 // Callback that is called when the browser feature extractor is done. | 69 // Callback that is called when the browser feature extractor is done. |
71 // This method is responsible for deleting the request object. Called on | 70 // This method is responsible for deleting the request object. Called on |
72 // the UI thread. | 71 // the UI thread. |
73 void FeatureExtractionDone(bool success, ClientPhishingRequest* request); | 72 void FeatureExtractionDone(bool success, ClientPhishingRequest* request); |
74 | 73 |
75 // From NotificationObserver. Called when a notification comes in. This | 74 // From NotificationObserver. Called when a notification comes in. This |
76 // method is called in the UI thread. | 75 // method is called in the UI thread. |
77 virtual void Observe(NotificationType type, | 76 virtual void Observe(int type, |
78 const NotificationSource& source, | 77 const NotificationSource& source, |
79 const NotificationDetails& details); | 78 const NotificationDetails& details); |
80 | 79 |
81 // Used for testing. This function does not take ownership of the service | 80 // Used for testing. This function does not take ownership of the service |
82 // class. | 81 // class. |
83 void set_client_side_detection_service(ClientSideDetectionService* service); | 82 void set_client_side_detection_service(ClientSideDetectionService* service); |
84 | 83 |
85 // Used for testing. This function does not take ownership of the service | 84 // Used for testing. This function does not take ownership of the service |
86 // class. | 85 // class. |
87 void set_safe_browsing_service(SafeBrowsingService* service); | 86 void set_safe_browsing_service(SafeBrowsingService* service); |
(...skipping 16 matching lines...) Expand all Loading... |
104 NotificationRegistrar registrar_; | 103 NotificationRegistrar registrar_; |
105 | 104 |
106 base::ScopedCallbackFactory<ClientSideDetectionHost> cb_factory_; | 105 base::ScopedCallbackFactory<ClientSideDetectionHost> cb_factory_; |
107 | 106 |
108 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionHost); | 107 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionHost); |
109 }; | 108 }; |
110 | 109 |
111 } // namespace safe_browsing | 110 } // namespace safe_browsing |
112 | 111 |
113 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_HOST_H_ | 112 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_HOST_H_ |
OLD | NEW |