Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: chrome/browser/safe_browsing/client_side_detection_host.h

Issue 42553002: Mostly integrate new malware IP blacklist with the csd client. When (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 // Returns true if the given IP address is malicious.
56 // This method has be to called on the IO thread.
57 virtual bool IsBadIpAddress(const std::string& ip_address);
58
55 protected: 59 protected:
60 // Used for testing only when we mock out the host.
61 ClientSideDetectionHost();
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 // Takes ownership of the request object. Called on the UI thread.
94 void MalwareFeatureExtractionDone(bool success,
95 ClientMalwareRequest* request);
mattm 2013/10/25 06:28:12 Why removing the scoped_ptr? It's the explicit wa
noé 2013/10/28 23:39:26 Kept the scoped_ptr here but had to remove it from
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698