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

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

Issue 1183513003: Ignore queued Safe Browsing interstitial requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months 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
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/safe_browsing_blocking_page.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.
11 // 11 //
12 // The SafeBrowsingBlockingPage is created by the SafeBrowsingUIManager on the 12 // The SafeBrowsingBlockingPage is created by the SafeBrowsingUIManager on the
13 // UI thread when we've determined that a page is malicious. The operation of 13 // UI thread when we've determined that a page is malicious. The operation of
14 // the blocking page occurs on the UI thread, where it waits for the user to 14 // the blocking page occurs on the UI thread, where it waits for the user to
15 // make a decision about what to do: either go back or continue on. 15 // make a decision about what to do: either go back or continue on.
16 // 16 //
17 // The blocking page forwards the result of the user's choice back to the 17 // The blocking page forwards the result of the user's choice back to the
18 // SafeBrowsingUIManager so that we can cancel the request for the new page, 18 // SafeBrowsingUIManager so that we can cancel the request for the new page,
19 // or allow it to continue. 19 // or allow it to continue.
20 // 20 //
21 // A web page may contain several resources flagged as malware/phishing. This 21 // A web page may contain several resources flagged as malware/phishing. This
22 // results into more than one interstitial being shown. On the first unsafe 22 // might result in more than one interstitial being shown. On the first unsafe
23 // resource received we show an interstitial. Any subsequent unsafe resource 23 // resource received we show an interstitial. Any subsequent unsafe resource
24 // notifications while the first interstitial is showing is queued. If the user 24 // notifications received while it is being displayed will be dropped. However
25 // decides to proceed in the first interstitial, we display all queued unsafe 25 // another resource might load at a later time and trigger the display of a new
26 // resources in a new interstitial. 26 // 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 "base/gtest_prod_util.h" 35 #include "base/gtest_prod_util.h"
36 #include "base/task/cancelable_task_tracker.h" 36 #include "base/task/cancelable_task_tracker.h"
37 #include "chrome/browser/interstitials/security_interstitial_metrics_helper.h" 37 #include "chrome/browser/interstitials/security_interstitial_metrics_helper.h"
38 #include "chrome/browser/interstitials/security_interstitial_page.h" 38 #include "chrome/browser/interstitials/security_interstitial_page.h"
39 #include "chrome/browser/safe_browsing/ui_manager.h" 39 #include "chrome/browser/safe_browsing/ui_manager.h"
40 #include "content/public/browser/interstitial_page_delegate.h" 40 #include "content/public/browser/interstitial_page_delegate.h"
41 #include "url/gurl.h" 41 #include "url/gurl.h"
42 42
43 class MalwareDetails; 43 class MalwareDetails;
44 class SafeBrowsingBlockingPageFactory; 44 class SafeBrowsingBlockingPageFactory;
45 45
46 namespace base { 46 namespace base {
47 class MessageLoop; 47 class MessageLoop;
48 } 48 }
49 49
50 class SafeBrowsingBlockingPage : public SecurityInterstitialPage { 50 class SafeBrowsingBlockingPage : public SecurityInterstitialPage {
51 public: 51 public:
52 typedef SafeBrowsingUIManager::UnsafeResource UnsafeResource; 52 typedef SafeBrowsingUIManager::UnsafeResource UnsafeResource;
53 typedef std::vector<UnsafeResource> UnsafeResourceList; 53 typedef std::vector<UnsafeResource> UnsafeResourceList;
54 typedef std::map<content::WebContents*, UnsafeResourceList> UnsafeResourceMap;
55 54
56 // Interstitial type, used in tests. 55 // Interstitial type, used in tests.
57 static content::InterstitialPageDelegate::TypeID kTypeForTesting; 56 static content::InterstitialPageDelegate::TypeID kTypeForTesting;
58 57
59 ~SafeBrowsingBlockingPage() override; 58 ~SafeBrowsingBlockingPage() override;
60 59
61 // Creates a blocking page. Use ShowBlockingPage if you don't need to access 60 // Creates a blocking page. Use ShowBlockingPage if you don't need to access
62 // the blocking page directly. 61 // the blocking page directly.
63 static SafeBrowsingBlockingPage* CreateBlockingPage( 62 static SafeBrowsingBlockingPage* CreateBlockingPage(
64 SafeBrowsingUIManager* ui_manager, 63 SafeBrowsingUIManager* ui_manager,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // Checks if we should even show the malware details option. For example, we 116 // Checks if we should even show the malware details option. For example, we
118 // don't show it in incognito mode. 117 // don't show it in incognito mode.
119 bool CanShowMalwareDetailsOption(); 118 bool CanShowMalwareDetailsOption();
120 119
121 // Called when the insterstitial is going away. If there is a 120 // Called when the insterstitial is going away. If there is a
122 // pending malware details object, we look at the user's 121 // pending malware details object, we look at the user's
123 // preferences, and if the option to send malware details is 122 // preferences, and if the option to send malware details is
124 // enabled, the report is scheduled to be sent on the |ui_manager_|. 123 // enabled, the report is scheduled to be sent on the |ui_manager_|.
125 void FinishMalwareDetails(int64 delay_ms); 124 void FinishMalwareDetails(int64 delay_ms);
126 125
127 // A list of SafeBrowsingUIManager::UnsafeResource for a tab that the user
128 // should be warned about. They are queued when displaying more than one
129 // interstitial at a time.
130 static UnsafeResourceMap* GetUnsafeResourcesMap();
131
132 // Notifies the SafeBrowsingUIManager on the IO thread whether to proceed 126 // Notifies the SafeBrowsingUIManager on the IO thread whether to proceed
133 // or not for the |resources|. 127 // or not for the |resources|.
134 static void NotifySafeBrowsingUIManager( 128 static void NotifySafeBrowsingUIManager(
135 SafeBrowsingUIManager* ui_manager, 129 SafeBrowsingUIManager* ui_manager,
136 const UnsafeResourceList& resources, bool proceed); 130 const UnsafeResourceList& resources, bool proceed);
137 131
138 // Returns true if the passed |unsafe_resources| is blocking the load of 132 // Returns true if the passed |unsafe_resources| is blocking the load of
139 // the main page. 133 // the main page.
140 static bool IsMainPageLoadBlocked( 134 static bool IsMainPageLoadBlocked(
141 const UnsafeResourceList& unsafe_resources); 135 const UnsafeResourceList& unsafe_resources);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 public: 191 public:
198 virtual ~SafeBrowsingBlockingPageFactory() { } 192 virtual ~SafeBrowsingBlockingPageFactory() { }
199 193
200 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( 194 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage(
201 SafeBrowsingUIManager* ui_manager, 195 SafeBrowsingUIManager* ui_manager,
202 content::WebContents* web_contents, 196 content::WebContents* web_contents,
203 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; 197 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0;
204 }; 198 };
205 199
206 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ 200 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/safe_browsing_blocking_page.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698