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 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 // we should classify the new URL. | 45 // we should classify the new URL. |
46 virtual void DidNavigateMainFrame( | 46 virtual void DidNavigateMainFrame( |
47 const content::LoadCommittedDetails& details, | 47 const content::LoadCommittedDetails& details, |
48 const content::FrameNavigateParams& params) OVERRIDE; | 48 const content::FrameNavigateParams& params) OVERRIDE; |
49 | 49 |
50 // Called when the SafeBrowsingService found a hit with one of the | 50 // Called when the SafeBrowsingService found a hit with one of the |
51 // SafeBrowsing lists. This method is called on the UI thread. | 51 // SafeBrowsing lists. This method is called on the UI thread. |
52 virtual void OnSafeBrowsingHit( | 52 virtual void OnSafeBrowsingHit( |
53 const SafeBrowsingUIManager::UnsafeResource& resource) OVERRIDE; | 53 const SafeBrowsingUIManager::UnsafeResource& resource) OVERRIDE; |
54 | 54 |
55 virtual scoped_refptr<SafeBrowsingDatabaseManager> database_manager(); | |
56 | |
55 protected: | 57 protected: |
58 // Used for testing only when we mock out the host. The host object takes | |
59 // ownership of the manager object. | |
mattm
2013/10/29 01:11:47
Not sure it makes sense to say "takes ownership" o
noé
2013/10/31 02:41:12
Done.
| |
60 explicit ClientSideDetectionHost( | |
61 SafeBrowsingDatabaseManager* database_manager); | |
mattm
2013/10/29 01:11:47
Was it not possible to use the other constructor a
noé
2013/10/31 02:41:12
Done.
| |
62 | |
56 // From content::WebContentsObserver. | 63 // From content::WebContentsObserver. |
57 virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE; | 64 virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE; |
58 | 65 |
59 private: | 66 private: |
60 friend class ClientSideDetectionHostTest; | 67 friend class ClientSideDetectionHostTest; |
61 class ShouldClassifyUrlRequest; | 68 class ShouldClassifyUrlRequest; |
62 friend class ShouldClassifyUrlRequest; | 69 friend class ShouldClassifyUrlRequest; |
63 | 70 |
64 explicit ClientSideDetectionHost(content::WebContents* tab); | 71 explicit ClientSideDetectionHost(content::WebContents* tab); |
65 | 72 |
66 // Verdict is an encoded ClientPhishingRequest protocol message. | 73 // Verdict is an encoded ClientPhishingRequest protocol message. |
67 void OnPhishingDetectionDone(const std::string& verdict); | 74 void OnPhishingDetectionDone(const std::string& verdict); |
68 | 75 |
69 // Callback that is called when the server ping back is | 76 // Callback that is called when the server ping back is |
70 // done. Display an interstitial if |is_phishing| is true. | 77 // done. Display an interstitial if |is_phishing| is true. |
71 // Otherwise, we do nothing. Called in UI thread. | 78 // Otherwise, we do nothing. Called in UI thread. |
72 void MaybeShowPhishingWarning(GURL phishing_url, bool is_phishing); | 79 void MaybeShowPhishingWarning(GURL phishing_url, bool is_phishing); |
73 | 80 |
74 // Callback that is called when the malware IP server ping back is | 81 // Callback that is called when the malware IP server ping back is |
75 // done. Display an interstitial if |is_malware| is true. | 82 // done. Display an interstitial if |is_malware| is true. |
76 // Otherwise, we do nothing. Called in UI thread. | 83 // Otherwise, we do nothing. Called in UI thread. |
77 void MaybeShowMalwareWarning(GURL original_url, GURL malware_url, | 84 void MaybeShowMalwareWarning(GURL original_url, GURL malware_url, |
78 bool is_malware); | 85 bool is_malware); |
79 | 86 |
80 // Callback that is called when the browser feature extractor is done. | 87 // Callback that is called when the browser feature extractor is done. |
81 // This method is responsible for deleting the request object. Called on | 88 // This method is responsible for deleting the request object. Called on |
82 // the UI thread. | 89 // the UI thread. |
83 void FeatureExtractionDone(bool success, ClientPhishingRequest* request); | 90 void FeatureExtractionDone(bool success, ClientPhishingRequest* request); |
91 | |
84 // Function to be called when the browser malware feature extractor is done. | 92 // Function to be called when the browser malware feature extractor is done. |
85 void MalwareFeatureExtractionDone(scoped_ptr<ClientMalwareRequest> request); | 93 // Called on the UI thread. |
94 void MalwareFeatureExtractionDone(bool success, | |
95 scoped_ptr<ClientMalwareRequest> request); | |
86 | 96 |
87 // Update the entries in browse_info_->ips map. | 97 // Update the entries in browse_info_->ips map. |
88 void UpdateIPUrlMap(const std::string& ip, const std::string& url); | 98 void UpdateIPUrlMap(const std::string& ip, const std::string& url); |
89 | 99 |
90 // From NotificationObserver. Called when a notification comes in. This | 100 // From NotificationObserver. Called when a notification comes in. This |
91 // method is called in the UI thread. | 101 // method is called in the UI thread. |
92 virtual void Observe(int type, | 102 virtual void Observe(int type, |
93 const content::NotificationSource& source, | 103 const content::NotificationSource& source, |
94 const content::NotificationDetails& details) OVERRIDE; | 104 const content::NotificationDetails& details) OVERRIDE; |
95 | 105 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 // Whether the malware bad ip matching and report feature is enabled. | 164 // Whether the malware bad ip matching and report feature is enabled. |
155 // This should be accessed from UI thread. | 165 // This should be accessed from UI thread. |
156 bool malware_report_enabled_; | 166 bool malware_report_enabled_; |
157 | 167 |
158 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionHost); | 168 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionHost); |
159 }; | 169 }; |
160 | 170 |
161 } // namespace safe_browsing | 171 } // namespace safe_browsing |
162 | 172 |
163 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_HOST_H_ | 173 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_HOST_H_ |
OLD | NEW |