OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Classes for managing the SafeBrowsing interstitial pages. | 5 // Classes for managing the SafeBrowsing interstitial pages. |
6 // | 6 // |
7 // When a user is about to visit a page the SafeBrowsing system has deemed to | 7 // When a user is about to visit a page the SafeBrowsing system has deemed to |
8 // be malicious, either as malware or a phishing page, we show an interstitial | 8 // be malicious, either as malware or a phishing page, we show an interstitial |
9 // page with some options (go back, continue) to give the user a chance to avoid | 9 // page with some options (go back, continue) to give the user a chance to avoid |
10 // the harmful page. | 10 // the harmful page. |
(...skipping 14 matching lines...) Expand all Loading... |
25 // decides to proceed in the first interstitial, we display all queued unsafe | 25 // decides to proceed in the first interstitial, we display all queued unsafe |
26 // resources in a new interstitial. | 26 // resources in a new interstitial. |
27 | 27 |
28 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ | 28 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ |
29 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ | 29 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ |
30 | 30 |
31 #include <map> | 31 #include <map> |
32 #include <string> | 32 #include <string> |
33 #include <vector> | 33 #include <vector> |
34 | 34 |
| 35 #include <stdint.h> |
| 36 |
35 #include "base/gtest_prod_util.h" | 37 #include "base/gtest_prod_util.h" |
| 38 #include "base/macros.h" |
36 #include "base/task/cancelable_task_tracker.h" | 39 #include "base/task/cancelable_task_tracker.h" |
37 #include "chrome/browser/interstitials/chrome_metrics_helper.h" | 40 #include "chrome/browser/interstitials/chrome_metrics_helper.h" |
38 #include "chrome/browser/interstitials/security_interstitial_page.h" | 41 #include "chrome/browser/interstitials/security_interstitial_page.h" |
39 #include "chrome/browser/safe_browsing/ui_manager.h" | 42 #include "chrome/browser/safe_browsing/ui_manager.h" |
40 #include "content/public/browser/interstitial_page_delegate.h" | 43 #include "content/public/browser/interstitial_page_delegate.h" |
41 #include "url/gurl.h" | 44 #include "url/gurl.h" |
42 | 45 |
43 namespace base { | 46 namespace base { |
44 class MessageLoop; | 47 class MessageLoop; |
45 } | 48 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // SecurityInterstitialPage methods: | 129 // SecurityInterstitialPage methods: |
127 bool ShouldCreateNewNavigation() const override; | 130 bool ShouldCreateNewNavigation() const override; |
128 void PopulateInterstitialStrings( | 131 void PopulateInterstitialStrings( |
129 base::DictionaryValue* load_time_data) override; | 132 base::DictionaryValue* load_time_data) override; |
130 void AfterShow() override {} | 133 void AfterShow() override {} |
131 | 134 |
132 // After a safe browsing interstitial where the user opted-in to the | 135 // After a safe browsing interstitial where the user opted-in to the |
133 // report but clicked "proceed anyway", we delay the call to | 136 // report but clicked "proceed anyway", we delay the call to |
134 // ThreatDetails::FinishCollection() by this much time (in | 137 // ThreatDetails::FinishCollection() by this much time (in |
135 // milliseconds), in order to get data from the blocked resource itself. | 138 // milliseconds), in order to get data from the blocked resource itself. |
136 int64 malware_details_proceed_delay_ms_; | 139 int64_t malware_details_proceed_delay_ms_; |
137 | 140 |
138 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest, | 141 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest, |
139 MalwareReportsTransitionDisabled); | 142 MalwareReportsTransitionDisabled); |
140 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest, | 143 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest, |
141 MalwareReportsToggling); | 144 MalwareReportsToggling); |
142 | 145 |
143 // Checks if we should even show the threat details option. For example, we | 146 // Checks if we should even show the threat details option. For example, we |
144 // don't show it in incognito mode. | 147 // don't show it in incognito mode. |
145 bool CanShowThreatDetailsOption(); | 148 bool CanShowThreatDetailsOption(); |
146 | 149 |
147 // Called when the insterstitial is going away. If there is a | 150 // Called when the insterstitial is going away. If there is a |
148 // pending threat details object, we look at the user's | 151 // pending threat details object, we look at the user's |
149 // preferences, and if the option to send threat details is | 152 // preferences, and if the option to send threat details is |
150 // enabled, the report is scheduled to be sent on the |ui_manager_|. | 153 // enabled, the report is scheduled to be sent on the |ui_manager_|. |
151 void FinishThreatDetails(int64 delay_ms, bool did_proceed, int num_visits); | 154 void FinishThreatDetails(int64_t delay_ms, bool did_proceed, int num_visits); |
152 | 155 |
153 // A list of SafeBrowsingUIManager::UnsafeResource for a tab that the user | 156 // A list of SafeBrowsingUIManager::UnsafeResource for a tab that the user |
154 // should be warned about. They are queued when displaying more than one | 157 // should be warned about. They are queued when displaying more than one |
155 // interstitial at a time. | 158 // interstitial at a time. |
156 static UnsafeResourceMap* GetUnsafeResourcesMap(); | 159 static UnsafeResourceMap* GetUnsafeResourcesMap(); |
157 | 160 |
158 // Returns true if the passed |unsafe_resources| is blocking the load of | 161 // Returns true if the passed |unsafe_resources| is blocking the load of |
159 // the main page. | 162 // the main page. |
160 static bool IsMainPageLoadBlocked( | 163 static bool IsMainPageLoadBlocked( |
161 const UnsafeResourceList& unsafe_resources); | 164 const UnsafeResourceList& unsafe_resources); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( | 227 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( |
225 SafeBrowsingUIManager* ui_manager, | 228 SafeBrowsingUIManager* ui_manager, |
226 content::WebContents* web_contents, | 229 content::WebContents* web_contents, |
227 const GURL& main_frame_url, | 230 const GURL& main_frame_url, |
228 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; | 231 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; |
229 }; | 232 }; |
230 | 233 |
231 } // namespace safe_browsing | 234 } // namespace safe_browsing |
232 | 235 |
233 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ | 236 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ |
OLD | NEW |