| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 void MaybeShowPhishingWarning(GURL phishing_url, bool is_phishing); | 72 void MaybeShowPhishingWarning(GURL phishing_url, bool is_phishing); |
| 73 | 73 |
| 74 // Callback that is called when the browser feature extractor is done. | 74 // Callback that is called when the browser feature extractor is done. |
| 75 // This method is responsible for deleting the request object. Called on | 75 // This method is responsible for deleting the request object. Called on |
| 76 // the UI thread. | 76 // the UI thread. |
| 77 void FeatureExtractionDone(bool success, ClientPhishingRequest* request); | 77 void FeatureExtractionDone(bool success, ClientPhishingRequest* request); |
| 78 // Function to be called when the browser malware feature extractor is done. | 78 // Function to be called when the browser malware feature extractor is done. |
| 79 void MalwareFeatureExtractionDone(scoped_ptr<ClientMalwareRequest> request); | 79 void MalwareFeatureExtractionDone(scoped_ptr<ClientMalwareRequest> request); |
| 80 | 80 |
| 81 // Update the entries in browse_info_->ips map. | 81 // Update the entries in browse_info_->ips map. |
| 82 void UpdateIPHostMap(const std::string& ip, const std::string& host); | 82 void UpdateIPUrlMap(const std::string& ip, const std::string& url); |
| 83 | 83 |
| 84 // From NotificationObserver. Called when a notification comes in. This | 84 // From NotificationObserver. Called when a notification comes in. This |
| 85 // method is called in the UI thread. | 85 // method is called in the UI thread. |
| 86 virtual void Observe(int type, | 86 virtual void Observe(int type, |
| 87 const content::NotificationSource& source, | 87 const content::NotificationSource& source, |
| 88 const content::NotificationDetails& details) OVERRIDE; | 88 const content::NotificationDetails& details) OVERRIDE; |
| 89 | 89 |
| 90 // Returns true if the user has seen a regular SafeBrowsing | 90 // Returns true if the user has seen a regular SafeBrowsing |
| 91 // interstitial for the current page. This is only true if the user has | 91 // interstitial for the current page. This is only true if the user has |
| 92 // actually clicked through the warning. This method is called on the UI | 92 // actually clicked through the warning. This method is called on the UI |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // Redirect chain that leads to the first page of the current host. We keep | 124 // Redirect chain that leads to the first page of the current host. We keep |
| 125 // track of this for browse_info_. | 125 // track of this for browse_info_. |
| 126 std::vector<GURL> cur_host_redirects_; | 126 std::vector<GURL> cur_host_redirects_; |
| 127 // Current host, used to help determine cur_host_redirects_. | 127 // Current host, used to help determine cur_host_redirects_. |
| 128 std::string cur_host_; | 128 std::string cur_host_; |
| 129 // Handles registering notifications with the NotificationService. | 129 // Handles registering notifications with the NotificationService. |
| 130 content::NotificationRegistrar registrar_; | 130 content::NotificationRegistrar registrar_; |
| 131 | 131 |
| 132 // Max number of ips we save for each browse | 132 // Max number of ips we save for each browse |
| 133 static const int kMaxIPsPerBrowse; | 133 static const int kMaxIPsPerBrowse; |
| 134 // Max number of hosts we report for each malware IP. | 134 // Max number of urls we report for each malware IP. |
| 135 static const int kMaxHostsPerIP; | 135 static const int kMaxUrlsPerIP; |
| 136 | 136 |
| 137 base::WeakPtrFactory<ClientSideDetectionHost> weak_factory_; | 137 base::WeakPtrFactory<ClientSideDetectionHost> weak_factory_; |
| 138 | 138 |
| 139 // Unique page ID of the most recent unsafe site that was loaded in this tab | 139 // Unique page ID of the most recent unsafe site that was loaded in this tab |
| 140 // as well as the UnsafeResource. | 140 // as well as the UnsafeResource. |
| 141 int unsafe_unique_page_id_; | 141 int unsafe_unique_page_id_; |
| 142 scoped_ptr<SafeBrowsingUIManager::UnsafeResource> unsafe_resource_; | 142 scoped_ptr<SafeBrowsingUIManager::UnsafeResource> unsafe_resource_; |
| 143 | 143 |
| 144 // Whether the malware IP matching feature killswitch is on. | 144 // Whether the malware IP matching feature killswitch is on. |
| 145 // This should be accessed from UI thread. | 145 // This should be accessed from UI thread. |
| 146 bool malware_killswitch_on_; | 146 bool malware_killswitch_on_; |
| 147 | 147 |
| 148 // Whether the malware bad ip matching and report feature is enabled. | 148 // Whether the malware bad ip matching and report feature is enabled. |
| 149 // This should be accessed from UI thread. | 149 // This should be accessed from UI thread. |
| 150 bool malware_report_enabled_; | 150 bool malware_report_enabled_; |
| 151 | 151 |
| 152 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionHost); | 152 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionHost); |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 } // namespace safe_browsing | 155 } // namespace safe_browsing |
| 156 | 156 |
| 157 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_HOST_H_ | 157 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_HOST_H_ |
| OLD | NEW |