OLD | NEW |
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 int64 malware_details_proceed_delay_ms_; | 118 int64 malware_details_proceed_delay_ms_; |
119 content::InterstitialPage* interstitial_page() const { | 119 content::InterstitialPage* interstitial_page() const { |
120 return interstitial_page_; | 120 return interstitial_page_; |
121 } | 121 } |
122 | 122 |
123 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest, | 123 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest, |
124 MalwareReportsTransitionDisabled); | 124 MalwareReportsTransitionDisabled); |
125 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest, | 125 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingBlockingPageTest, |
126 MalwareReportsToggling); | 126 MalwareReportsToggling); |
127 | 127 |
128 enum BlockingPageEvent { | 128 // These enums are used for histograms. Don't reorder, delete, or insert |
| 129 // elements. New elements should be added before MAX_ACTION only. |
| 130 enum Decision { |
129 SHOW, | 131 SHOW, |
130 PROCEED, | 132 PROCEED, |
131 DONT_PROCEED, | 133 DONT_PROCEED, |
| 134 PROCEEDING_DISABLED, |
| 135 MAX_DECISION |
| 136 }; |
| 137 enum Interaction { |
132 SHOW_ADVANCED, | 138 SHOW_ADVANCED, |
| 139 SHOW_PRIVACY_POLICY, |
| 140 SHOW_DIAGNOSTIC, |
| 141 SHOW_LEARN_MORE, |
| 142 MAX_INTERACTION |
133 }; | 143 }; |
134 | 144 |
135 // Records a user action for this interstitial, using the form | 145 // Record a user decision or interaction to the appropriate UMA histogram. |
136 // SBInterstitial[Phishing|Malware|Multiple][Show|Proceed|DontProceed]. | 146 void RecordUserDecision(Decision decision); |
137 void RecordUserAction(BlockingPageEvent event); | 147 void RecordUserInteraction(Interaction interaction); |
138 | 148 |
139 // Used to query the HistoryService to see if the URL is in history. For UMA. | 149 // Used to query the HistoryService to see if the URL is in history. For UMA. |
140 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); | 150 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); |
141 | 151 |
142 // Records the time it took for the user to react to the | 152 // Records the time it took for the user to react to the |
143 // interstitial. We won't double-count if this method is called | 153 // interstitial. We won't double-count if this method is called |
144 // multiple times. | 154 // multiple times. |
145 void RecordUserReactionTime(const std::string& command); | 155 void RecordUserReactionTime(const std::string& command); |
146 | 156 |
147 // Checks if we should even show the malware details option. For example, we | 157 // Checks if we should even show the malware details option. For example, we |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 public: | 261 public: |
252 virtual ~SafeBrowsingBlockingPageFactory() { } | 262 virtual ~SafeBrowsingBlockingPageFactory() { } |
253 | 263 |
254 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( | 264 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( |
255 SafeBrowsingUIManager* ui_manager, | 265 SafeBrowsingUIManager* ui_manager, |
256 content::WebContents* web_contents, | 266 content::WebContents* web_contents, |
257 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; | 267 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; |
258 }; | 268 }; |
259 | 269 |
260 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ | 270 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ |
OLD | NEW |