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

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

Issue 1414343007: Collect threat details for phishing and UwS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 5 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
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 factory_ = factory; 79 factory_ = factory;
80 } 80 }
81 81
82 // InterstitialPageDelegate method: 82 // InterstitialPageDelegate method:
83 void OnProceed() override; 83 void OnProceed() override;
84 void OnDontProceed() override; 84 void OnDontProceed() override;
85 void CommandReceived(const std::string& command) override; 85 void CommandReceived(const std::string& command) override;
86 void OverrideRendererPrefs(content::RendererPreferences* prefs) override; 86 void OverrideRendererPrefs(content::RendererPreferences* prefs) override;
87 content::InterstitialPageDelegate::TypeID GetTypeForTesting() const override; 87 content::InterstitialPageDelegate::TypeID GetTypeForTesting() const override;
88 88
89 // Checks the threat type to decide if we should report ThreatDetails.
90 static bool ShouldReportThreatDetails(SBThreatType threat_type);
91
89 protected: 92 protected:
90 friend class SafeBrowsingBlockingPageTest; 93 friend class SafeBrowsingBlockingPageTest;
91 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest, 94 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest,
92 ProceedThenDontProceed); 95 ProceedThenDontProceed);
93 96
94 void UpdateReportingPref(); // Used for the transition from old to new pref. 97 void UpdateReportingPref(); // Used for the transition from old to new pref.
95 98
96 // Don't instantiate this class directly, use ShowBlockingPage instead. 99 // Don't instantiate this class directly, use ShowBlockingPage instead.
97 SafeBrowsingBlockingPage(SafeBrowsingUIManager* ui_manager, 100 SafeBrowsingBlockingPage(SafeBrowsingUIManager* ui_manager,
98 content::WebContents* web_contents, 101 content::WebContents* web_contents,
99 const UnsafeResourceList& unsafe_resources); 102 const UnsafeResourceList& unsafe_resources);
100 103
101 // SecurityInterstitialPage methods: 104 // SecurityInterstitialPage methods:
102 bool ShouldCreateNewNavigation() const override; 105 bool ShouldCreateNewNavigation() const override;
103 void PopulateInterstitialStrings( 106 void PopulateInterstitialStrings(
104 base::DictionaryValue* load_time_data) override; 107 base::DictionaryValue* load_time_data) override;
105 108
106 // After a safe browsing interstitial where the user opted-in to the 109 // After a safe browsing interstitial where the user opted-in to the
107 // report but clicked "proceed anyway", we delay the call to 110 // report but clicked "proceed anyway", we delay the call to
108 // ThreatDetails::FinishCollection() by this much time (in 111 // ThreatDetails::FinishCollection() by this much time (in
109 // milliseconds), in order to get data from the blocked resource itself. 112 // milliseconds), in order to get data from the blocked resource itself.
110 int64 malware_details_proceed_delay_ms_; 113 int64 malware_details_proceed_delay_ms_;
111 114
112 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest, 115 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest,
113 MalwareReportsTransitionDisabled); 116 MalwareReportsTransitionDisabled);
114 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest, 117 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest,
115 MalwareReportsToggling); 118 MalwareReportsToggling);
116 119
117 // Checks if we should even show the malware details option. For example, we 120 // Checks if we should even show the threat details option. For example, we
118 // don't show it in incognito mode. 121 // don't show it in incognito mode.
119 bool CanShowMalwareDetailsOption(); 122 bool CanShowThreatDetailsOption();
120 123
121 // Called when the insterstitial is going away. If there is a 124 // Called when the insterstitial is going away. If there is a
122 // pending threat details object, we look at the user's 125 // pending threat details object, we look at the user's
123 // preferences, and if the option to send threat details is 126 // preferences, and if the option to send threat details is
124 // enabled, the report is scheduled to be sent on the |ui_manager_|. 127 // enabled, the report is scheduled to be sent on the |ui_manager_|.
125 void FinishThreatDetails(int64 delay_ms, bool did_proceed, int num_visits); 128 void FinishThreatDetails(int64 delay_ms, bool did_proceed, int num_visits);
126 129
127 // A list of SafeBrowsingUIManager::UnsafeResource for a tab that the user 130 // A list of SafeBrowsingUIManager::UnsafeResource for a tab that the user
128 // should be warned about. They are queued when displaying more than one 131 // should be warned about. They are queued when displaying more than one
129 // interstitial at a time. 132 // interstitial at a time.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 bool proceeded_; 169 bool proceeded_;
167 170
168 // Which type of Safe Browsing interstitial this is. 171 // Which type of Safe Browsing interstitial this is.
169 enum SBInterstitialReason { 172 enum SBInterstitialReason {
170 SB_REASON_MALWARE, 173 SB_REASON_MALWARE,
171 SB_REASON_HARMFUL, 174 SB_REASON_HARMFUL,
172 SB_REASON_PHISHING, 175 SB_REASON_PHISHING,
173 } interstitial_reason_; 176 } interstitial_reason_;
174 177
175 // The factory used to instantiate SafeBrowsingBlockingPage objects. 178 // The factory used to instantiate SafeBrowsingBlockingPage objects.
176 // Usefull for tests, so they can provide their own implementation of 179 // Useful for tests, so they can provide their own implementation of
177 // SafeBrowsingBlockingPage. 180 // SafeBrowsingBlockingPage.
178 static SafeBrowsingBlockingPageFactory* factory_; 181 static SafeBrowsingBlockingPageFactory* factory_;
179 182
180 private: 183 private:
181 // Fills the passed dictionary with the values to be passed to the template 184 // Fills the passed dictionary with the values to be passed to the template
182 // when creating the HTML. 185 // when creating the HTML.
183 void PopulateExtendedReportingOption(base::DictionaryValue* load_time_data); 186 void PopulateExtendedReportingOption(base::DictionaryValue* load_time_data);
184 void PopulateMalwareLoadTimeData(base::DictionaryValue* load_time_data); 187 void PopulateMalwareLoadTimeData(base::DictionaryValue* load_time_data);
185 void PopulateHarmfulLoadTimeData(base::DictionaryValue* load_time_data); 188 void PopulateHarmfulLoadTimeData(base::DictionaryValue* load_time_data);
186 void PopulatePhishingLoadTimeData(base::DictionaryValue* load_time_data); 189 void PopulatePhishingLoadTimeData(base::DictionaryValue* load_time_data);
(...skipping 11 matching lines...) Expand all
198 public: 201 public:
199 virtual ~SafeBrowsingBlockingPageFactory() { } 202 virtual ~SafeBrowsingBlockingPageFactory() { }
200 203
201 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( 204 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage(
202 SafeBrowsingUIManager* ui_manager, 205 SafeBrowsingUIManager* ui_manager,
203 content::WebContents* web_contents, 206 content::WebContents* web_contents,
204 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; 207 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0;
205 }; 208 };
206 209
207 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ 210 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698