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

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

Issue 935663004: Add checkbox for reporting invalid TLS/SSL cert chains (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment tweaks Created 5 years, 10 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
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 28 matching lines...) Expand all
39 #include "chrome/browser/safe_browsing/ui_manager.h" 39 #include "chrome/browser/safe_browsing/ui_manager.h"
40 #include "url/gurl.h" 40 #include "url/gurl.h"
41 41
42 class MalwareDetails; 42 class MalwareDetails;
43 class SafeBrowsingBlockingPageFactory; 43 class SafeBrowsingBlockingPageFactory;
44 44
45 namespace base { 45 namespace base {
46 class MessageLoop; 46 class MessageLoop;
47 } 47 }
48 48
49 class SafeBrowsingBlockingPage : public SecurityInterstitialPage { 49 class SafeBrowsingBlockingPage
50 : public SecurityInterstitialPageWithExtendedReporting {
50 public: 51 public:
51 typedef SafeBrowsingUIManager::UnsafeResource UnsafeResource; 52 typedef SafeBrowsingUIManager::UnsafeResource UnsafeResource;
52 typedef std::vector<UnsafeResource> UnsafeResourceList; 53 typedef std::vector<UnsafeResource> UnsafeResourceList;
53 typedef std::map<content::WebContents*, UnsafeResourceList> UnsafeResourceMap; 54 typedef std::map<content::WebContents*, UnsafeResourceList> UnsafeResourceMap;
54 55
55 // Interstitial type, used in tests. 56 // Interstitial type, used in tests.
56 static const void* kTypeForTesting; 57 static const void* kTypeForTesting;
57 58
58 ~SafeBrowsingBlockingPage() override; 59 ~SafeBrowsingBlockingPage() override;
59 60
(...skipping 24 matching lines...) Expand all
84 void CommandReceived(const std::string& command) override; 85 void CommandReceived(const std::string& command) override;
85 void OverrideRendererPrefs(content::RendererPreferences* prefs) override; 86 void OverrideRendererPrefs(content::RendererPreferences* prefs) override;
86 87
87 // SecurityInterstitialPage method: 88 // SecurityInterstitialPage method:
88 const void* GetTypeForTesting() const override; 89 const void* GetTypeForTesting() const override;
89 90
90 protected: 91 protected:
91 friend class SafeBrowsingBlockingPageTest; 92 friend class SafeBrowsingBlockingPageTest;
92 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest, 93 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest,
93 ProceedThenDontProceed); 94 ProceedThenDontProceed);
94 void SetReportingPreference(bool report); 95
95 void UpdateReportingPref(); // Used for the transition from old to new pref. 96 void UpdateReportingPref(); // Used for the transition from old to new pref.
96 97
97 // Don't instantiate this class directly, use ShowBlockingPage instead. 98 // Don't instantiate this class directly, use ShowBlockingPage instead.
98 SafeBrowsingBlockingPage(SafeBrowsingUIManager* ui_manager, 99 SafeBrowsingBlockingPage(SafeBrowsingUIManager* ui_manager,
99 content::WebContents* web_contents, 100 content::WebContents* web_contents,
100 const UnsafeResourceList& unsafe_resources); 101 const UnsafeResourceList& unsafe_resources);
101 102
102 // SecurityInterstitialPage methods: 103 // SecurityInterstitialPage methods:
103 bool ShouldCreateNewNavigation() const override; 104 bool ShouldCreateNewNavigation() const override;
104 void PopulateInterstitialStrings( 105 void PopulateInterstitialStrings(
(...skipping 13 matching lines...) Expand all
118 // Checks if we should even show the malware details option. For example, we 119 // Checks if we should even show the malware details option. For example, we
119 // don't show it in incognito mode. 120 // don't show it in incognito mode.
120 bool CanShowMalwareDetailsOption(); 121 bool CanShowMalwareDetailsOption();
121 122
122 // Called when the insterstitial is going away. If there is a 123 // Called when the insterstitial is going away. If there is a
123 // pending malware details object, we look at the user's 124 // pending malware details object, we look at the user's
124 // preferences, and if the option to send malware details is 125 // preferences, and if the option to send malware details is
125 // enabled, the report is scheduled to be sent on the |ui_manager_|. 126 // enabled, the report is scheduled to be sent on the |ui_manager_|.
126 void FinishMalwareDetails(int64 delay_ms); 127 void FinishMalwareDetails(int64 delay_ms);
127 128
128 // Returns the boolean value of the given |pref| from the PrefService of the
129 // Profile associated with |web_contents_|.
130 bool IsPrefEnabled(const char* pref);
131
132 // A list of SafeBrowsingUIManager::UnsafeResource for a tab that the user 129 // A list of SafeBrowsingUIManager::UnsafeResource for a tab that the user
133 // should be warned about. They are queued when displaying more than one 130 // should be warned about. They are queued when displaying more than one
134 // interstitial at a time. 131 // interstitial at a time.
135 static UnsafeResourceMap* GetUnsafeResourcesMap(); 132 static UnsafeResourceMap* GetUnsafeResourcesMap();
136 133
137 // Notifies the SafeBrowsingUIManager on the IO thread whether to proceed 134 // Notifies the SafeBrowsingUIManager on the IO thread whether to proceed
138 // or not for the |resources|. 135 // or not for the |resources|.
139 static void NotifySafeBrowsingUIManager( 136 static void NotifySafeBrowsingUIManager(
140 SafeBrowsingUIManager* ui_manager, 137 SafeBrowsingUIManager* ui_manager,
141 const UnsafeResourceList& resources, bool proceed); 138 const UnsafeResourceList& resources, bool proceed);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } interstitial_reason_; 176 } interstitial_reason_;
180 177
181 // The factory used to instantiate SafeBrowsingBlockingPage objects. 178 // The factory used to instantiate SafeBrowsingBlockingPage objects.
182 // Usefull for tests, so they can provide their own implementation of 179 // Usefull for tests, so they can provide their own implementation of
183 // SafeBrowsingBlockingPage. 180 // SafeBrowsingBlockingPage.
184 static SafeBrowsingBlockingPageFactory* factory_; 181 static SafeBrowsingBlockingPageFactory* factory_;
185 182
186 private: 183 private:
187 // 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
188 // when creating the HTML. 185 // when creating the HTML.
189 void PopulateExtendedReportingOption(base::DictionaryValue* load_time_data);
190 void PopulateMalwareLoadTimeData(base::DictionaryValue* load_time_data); 186 void PopulateMalwareLoadTimeData(base::DictionaryValue* load_time_data);
191 void PopulateHarmfulLoadTimeData(base::DictionaryValue* load_time_data); 187 void PopulateHarmfulLoadTimeData(base::DictionaryValue* load_time_data);
192 void PopulatePhishingLoadTimeData(base::DictionaryValue* load_time_data); 188 void PopulatePhishingLoadTimeData(base::DictionaryValue* load_time_data);
189 // SecurityInterstitialPageWithExtendedReporting implementation:
190 void PopulateExtendedReportingOption(
191 base::DictionaryValue* load_time_data) override;
193 192
194 std::string GetMetricPrefix() const; 193 std::string GetMetricPrefix() const;
195 std::string GetSamplingEventName() const; 194 std::string GetSamplingEventName() const;
196 195
197 scoped_ptr<SecurityInterstitialMetricsHelper> metrics_helper_; 196 scoped_ptr<SecurityInterstitialMetricsHelper> metrics_helper_;
198 197
199 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPage); 198 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPage);
200 }; 199 };
201 200
202 // Factory for creating SafeBrowsingBlockingPage. Useful for tests. 201 // Factory for creating SafeBrowsingBlockingPage. Useful for tests.
203 class SafeBrowsingBlockingPageFactory { 202 class SafeBrowsingBlockingPageFactory {
204 public: 203 public:
205 virtual ~SafeBrowsingBlockingPageFactory() { } 204 virtual ~SafeBrowsingBlockingPageFactory() { }
206 205
207 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( 206 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage(
208 SafeBrowsingUIManager* ui_manager, 207 SafeBrowsingUIManager* ui_manager,
209 content::WebContents* web_contents, 208 content::WebContents* web_contents,
210 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; 209 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0;
211 }; 210 };
212 211
213 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ 212 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698