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

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

Issue 351363002: Revert of Port HistoryService::GetVisibleVisitCountToHost to CancelableTaskTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
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.
(...skipping 15 matching lines...) Expand all
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 "base/gtest_prod_util.h" 35 #include "base/gtest_prod_util.h"
36 #include "base/task/cancelable_task_tracker.h"
37 #include "base/time/time.h" 36 #include "base/time/time.h"
38 #include "chrome/browser/history/history_service.h" 37 #include "chrome/browser/history/history_service.h"
39 #include "chrome/browser/safe_browsing/ui_manager.h" 38 #include "chrome/browser/safe_browsing/ui_manager.h"
40 #include "content/public/browser/interstitial_page_delegate.h" 39 #include "content/public/browser/interstitial_page_delegate.h"
41 #include "url/gurl.h" 40 #include "url/gurl.h"
42 41
43 class MalwareDetails; 42 class MalwareDetails;
44 class SafeBrowsingBlockingPageFactory; 43 class SafeBrowsingBlockingPageFactory;
45 44
46 namespace base { 45 namespace base {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 PROCEED, 117 PROCEED,
119 DONT_PROCEED, 118 DONT_PROCEED,
120 SHOW_ADVANCED, 119 SHOW_ADVANCED,
121 }; 120 };
122 121
123 // Records a user action for this interstitial, using the form 122 // Records a user action for this interstitial, using the form
124 // SBInterstitial[Phishing|Malware|Multiple][Show|Proceed|DontProceed]. 123 // SBInterstitial[Phishing|Malware|Multiple][Show|Proceed|DontProceed].
125 void RecordUserAction(BlockingPageEvent event); 124 void RecordUserAction(BlockingPageEvent event);
126 125
127 // Used to query the HistoryService to see if the URL is in history. For UMA. 126 // Used to query the HistoryService to see if the URL is in history. For UMA.
128 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); 127 void OnGotHistoryCount(HistoryService::Handle handle,
128 bool success,
129 int num_visits,
130 base::Time first_visit);
129 131
130 // Records the time it took for the user to react to the 132 // Records the time it took for the user to react to the
131 // interstitial. We won't double-count if this method is called 133 // interstitial. We won't double-count if this method is called
132 // multiple times. 134 // multiple times.
133 void RecordUserReactionTime(const std::string& command); 135 void RecordUserReactionTime(const std::string& command);
134 136
135 // Checks if we should even show the malware details option. For example, we 137 // Checks if we should even show the malware details option. For example, we
136 // don't show it in incognito mode. 138 // don't show it in incognito mode.
137 bool CanShowMalwareDetailsOption(); 139 bool CanShowMalwareDetailsOption();
138 140
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 TYPE_MALWARE_AND_PHISHING, 214 TYPE_MALWARE_AND_PHISHING,
213 } interstitial_type_; 215 } interstitial_type_;
214 216
215 // The factory used to instanciate SafeBrowsingBlockingPage objects. 217 // The factory used to instanciate SafeBrowsingBlockingPage objects.
216 // Usefull for tests, so they can provide their own implementation of 218 // Usefull for tests, so they can provide their own implementation of
217 // SafeBrowsingBlockingPage. 219 // SafeBrowsingBlockingPage.
218 static SafeBrowsingBlockingPageFactory* factory_; 220 static SafeBrowsingBlockingPageFactory* factory_;
219 221
220 // How many times is this same URL in history? Used for histogramming. 222 // How many times is this same URL in history? Used for histogramming.
221 int num_visits_; 223 int num_visits_;
222 base::CancelableTaskTracker request_tracker_; 224 CancelableRequestConsumer request_consumer_;
223 225
224 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPage); 226 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPage);
225 }; 227 };
226 228
227 class SafeBrowsingBlockingPageV1 : public SafeBrowsingBlockingPage { 229 class SafeBrowsingBlockingPageV1 : public SafeBrowsingBlockingPage {
228 public: 230 public:
229 // Don't instanciate this class directly, use ShowBlockingPage instead. 231 // Don't instanciate this class directly, use ShowBlockingPage instead.
230 SafeBrowsingBlockingPageV1(SafeBrowsingUIManager* ui_manager, 232 SafeBrowsingBlockingPageV1(SafeBrowsingUIManager* ui_manager,
231 content::WebContents* web_contents, 233 content::WebContents* web_contents,
232 const UnsafeResourceList& unsafe_resources); 234 const UnsafeResourceList& unsafe_resources);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 public: 310 public:
309 virtual ~SafeBrowsingBlockingPageFactory() { } 311 virtual ~SafeBrowsingBlockingPageFactory() { }
310 312
311 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( 313 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage(
312 SafeBrowsingUIManager* ui_manager, 314 SafeBrowsingUIManager* ui_manager,
313 content::WebContents* web_contents, 315 content::WebContents* web_contents,
314 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; 316 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0;
315 }; 317 };
316 318
317 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ 319 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698