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

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

Issue 4822002: Send malware reports when a user opts-in from the safe browsing interstitial ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 21 matching lines...) Expand all
32 #include <map> 32 #include <map>
33 #include <vector> 33 #include <vector>
34 34
35 #include "chrome/browser/tab_contents/interstitial_page.h" 35 #include "chrome/browser/tab_contents/interstitial_page.h"
36 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 36 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
37 #include "googleurl/src/gurl.h" 37 #include "googleurl/src/gurl.h"
38 38
39 class DictionaryValue; 39 class DictionaryValue;
40 class MessageLoop; 40 class MessageLoop;
41 class SafeBrowsingBlockingPageFactory; 41 class SafeBrowsingBlockingPageFactory;
42 class SafeBrowsingMalwareReport;
42 class TabContents; 43 class TabContents;
43 44
44 class SafeBrowsingBlockingPage : public InterstitialPage { 45 class SafeBrowsingBlockingPage : public InterstitialPage {
45 public: 46 public:
46 virtual ~SafeBrowsingBlockingPage(); 47 virtual ~SafeBrowsingBlockingPage();
47 48
48 // Shows a blocking page warning the user about phishing/malware for a 49 // Shows a blocking page warning the user about phishing/malware for a
49 // specific resource. 50 // specific resource.
50 // You can call this method several times, if an interstitial is already 51 // You can call this method several times, if an interstitial is already
51 // showing, the new one will be queued and displayed if the user decides 52 // showing, the new one will be queued and displayed if the user decides
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 const std::wstring& title, 96 const std::wstring& title,
96 const std::wstring& headline, 97 const std::wstring& headline,
97 const std::wstring& description1, 98 const std::wstring& description1,
98 const std::wstring& description2, 99 const std::wstring& description2,
99 const std::wstring& description3); 100 const std::wstring& description3);
100 101
101 // Records a user action for this interstitial, using the form 102 // Records a user action for this interstitial, using the form
102 // SBInterstitial[Phishing|Malware|Multiple][Show|Proceed|DontProceed]. 103 // SBInterstitial[Phishing|Malware|Multiple][Show|Proceed|DontProceed].
103 void RecordUserAction(BlockingPageEvent event); 104 void RecordUserAction(BlockingPageEvent event);
104 105
106 // Called when the insterstitial is going away. If there is a pending malware
107 // report, we look at the user's preferences, and if enabled, the
108 // report is scheduled to be sent on the |sb_service_|.
109 void FinishMalwareReport();
110
105 // A list of SafeBrowsingService::UnsafeResource for a tab that the user 111 // A list of SafeBrowsingService::UnsafeResource for a tab that the user
106 // should be warned about. They are queued when displaying more than one 112 // should be warned about. They are queued when displaying more than one
107 // interstitial at a time. 113 // interstitial at a time.
108 typedef std::map<TabContents*, UnsafeResourceList> UnsafeResourceMap; 114 typedef std::map<TabContents*, UnsafeResourceList> UnsafeResourceMap;
109 static UnsafeResourceMap* GetUnsafeResourcesMap(); 115 static UnsafeResourceMap* GetUnsafeResourcesMap();
110 116
111 // Notifies the SafeBrowsingService on the IO thread whether to proceed or not 117 // Notifies the SafeBrowsingService on the IO thread whether to proceed or not
112 // for the |resources|. 118 // for the |resources|.
113 static void NotifySafeBrowsingService(SafeBrowsingService* sb_service, 119 static void NotifySafeBrowsingService(SafeBrowsingService* sb_service,
114 const UnsafeResourceList& resources, 120 const UnsafeResourceList& resources,
(...skipping 11 matching lines...) Expand all
126 132
127 // Whether the flagged resource is the main page (or a sub-resource is false). 133 // Whether the flagged resource is the main page (or a sub-resource is false).
128 bool is_main_frame_; 134 bool is_main_frame_;
129 135
130 // The index of a navigation entry that should be removed when DontProceed() 136 // The index of a navigation entry that should be removed when DontProceed()
131 // is invoked, -1 if not entry should be removed. 137 // is invoked, -1 if not entry should be removed.
132 int navigation_entry_index_to_remove_; 138 int navigation_entry_index_to_remove_;
133 139
134 // The list of unsafe resources this page is warning about. 140 // The list of unsafe resources this page is warning about.
135 UnsafeResourceList unsafe_resources_; 141 UnsafeResourceList unsafe_resources_;
136 142
lzheng 2010/11/16 00:18:12 Instead of the warning, do you mean the blocking p
panayiotis 2010/11/18 22:04:37 Done.
143 // A malware report that we start generating when the warning is
144 // shown. The report will be sent when the warning is gone
145 // (if the user enables the feature).
146 scoped_refptr<SafeBrowsingMalwareReport> malware_report_;
147
137 // The factory used to instanciate SafeBrowsingBlockingPage objects. 148 // The factory used to instanciate SafeBrowsingBlockingPage objects.
138 // Usefull for tests, so they can provide their own implementation of 149 // Usefull for tests, so they can provide their own implementation of
139 // SafeBrowsingBlockingPage. 150 // SafeBrowsingBlockingPage.
140 static SafeBrowsingBlockingPageFactory* factory_; 151 static SafeBrowsingBlockingPageFactory* factory_;
141 152
142 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPage); 153 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPage);
143 }; 154 };
144 155
145 // Factory for creating SafeBrowsingBlockingPage. Useful for tests. 156 // Factory for creating SafeBrowsingBlockingPage. Useful for tests.
146 class SafeBrowsingBlockingPageFactory { 157 class SafeBrowsingBlockingPageFactory {
147 public: 158 public:
148 virtual ~SafeBrowsingBlockingPageFactory() { } 159 virtual ~SafeBrowsingBlockingPageFactory() { }
149 160
150 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( 161 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage(
151 SafeBrowsingService* service, 162 SafeBrowsingService* service,
152 TabContents* tab_contents, 163 TabContents* tab_contents,
153 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; 164 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0;
154 }; 165 };
155 166
156 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ 167 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698