OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef COMPONENTS_SAFE_BROWSING_BASE_BLOCKING_PAGE_H_ | 5 #ifndef COMPONENTS_SAFE_BROWSING_BASE_BLOCKING_PAGE_H_ |
6 #define COMPONENTS_SAFE_BROWSING_BASE_BLOCKING_PAGE_H_ | 6 #define COMPONENTS_SAFE_BROWSING_BASE_BLOCKING_PAGE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 // Returns true if the passed |unsafe_resources| is blocking the load of | 46 // Returns true if the passed |unsafe_resources| is blocking the load of |
47 // the main page. | 47 // the main page. |
48 static bool IsMainPageLoadBlocked(const UnsafeResourceList& unsafe_resources); | 48 static bool IsMainPageLoadBlocked(const UnsafeResourceList& unsafe_resources); |
49 | 49 |
50 // InterstitialPageDelegate methods: | 50 // InterstitialPageDelegate methods: |
51 void OnProceed() override; | 51 void OnProceed() override; |
52 void OnDontProceed() override; | 52 void OnDontProceed() override; |
53 void CommandReceived(const std::string& command) override; | 53 void CommandReceived(const std::string& command) override; |
54 | 54 |
55 protected: | 55 protected: |
56 // Used to specify which BaseSafeBrowsingErrorUI to instantiate, and | |
57 // parameters they require | |
Jialiu Lin
2017/05/22 17:06:00
period at the end.
Nate Fischer
2017/05/22 23:13:46
Done.
| |
58 enum class ErrorUiType { LOUD, QUIET_SMALL, QUIET_GIANT }; | |
59 | |
56 // Don't instantiate this class directly, use ShowBlockingPage instead. | 60 // Don't instantiate this class directly, use ShowBlockingPage instead. |
57 BaseBlockingPage( | 61 BaseBlockingPage( |
58 BaseUIManager* ui_manager, | 62 BaseUIManager* ui_manager, |
59 content::WebContents* web_contents, | 63 content::WebContents* web_contents, |
60 const GURL& main_frame_url, | 64 const GURL& main_frame_url, |
61 const UnsafeResourceList& unsafe_resources, | 65 const UnsafeResourceList& unsafe_resources, |
62 std::unique_ptr< | 66 std::unique_ptr< |
63 security_interstitials::SecurityInterstitialControllerClient> | 67 security_interstitials::SecurityInterstitialControllerClient> |
64 controller_client, | 68 controller_client, |
65 const BaseSafeBrowsingErrorUI::SBErrorDisplayOptions& display_options); | 69 const BaseSafeBrowsingErrorUI::SBErrorDisplayOptions& display_options, |
70 ErrorUiType type); | |
66 | 71 |
67 // SecurityInterstitialPage methods: | 72 // SecurityInterstitialPage methods: |
68 bool ShouldCreateNewNavigation() const override; | 73 bool ShouldCreateNewNavigation() const override; |
69 void PopulateInterstitialStrings( | 74 void PopulateInterstitialStrings( |
70 base::DictionaryValue* load_time_data) override; | 75 base::DictionaryValue* load_time_data) override; |
71 | 76 |
72 // Called when the interstitial is going away. Intentionally do nothing in | 77 // Called when the interstitial is going away. Intentionally do nothing in |
73 // this base class. | 78 // this base class. |
74 virtual void FinishThreatDetails(const base::TimeDelta& delay, | 79 virtual void FinishThreatDetails(const base::TimeDelta& delay, |
75 bool did_proceed, | 80 bool did_proceed, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 virtual void HandleSubresourcesAfterProceed(); | 115 virtual void HandleSubresourcesAfterProceed(); |
111 | 116 |
112 void SetThreatDetailsProceedDelayForTesting(int64_t delay); | 117 void SetThreatDetailsProceedDelayForTesting(int64_t delay); |
113 | 118 |
114 static std::unique_ptr< | 119 static std::unique_ptr< |
115 security_interstitials::SecurityInterstitialControllerClient> | 120 security_interstitials::SecurityInterstitialControllerClient> |
116 CreateControllerClient(content::WebContents* web_contents, | 121 CreateControllerClient(content::WebContents* web_contents, |
117 const UnsafeResourceList& unsafe_resources, | 122 const UnsafeResourceList& unsafe_resources, |
118 BaseUIManager* ui_manager); | 123 BaseUIManager* ui_manager); |
119 | 124 |
125 int GetHTMLTemplateId() override; | |
126 | |
120 private: | 127 private: |
121 // For reporting back user actions. | 128 // For reporting back user actions. |
122 BaseUIManager* ui_manager_; | 129 BaseUIManager* ui_manager_; |
123 | 130 |
124 // The URL of the main frame that caused the warning. | 131 // The URL of the main frame that caused the warning. |
125 GURL main_frame_url_; | 132 GURL main_frame_url_; |
126 | 133 |
127 // The index of a navigation entry that should be removed when DontProceed() | 134 // The index of a navigation entry that should be removed when DontProceed() |
128 // is invoked, -1 if entry should not be removed. | 135 // is invoked, -1 if entry should not be removed. |
129 const int navigation_entry_index_to_remove_; | 136 const int navigation_entry_index_to_remove_; |
130 | 137 |
131 // The list of unsafe resources this page is warning about. | 138 // The list of unsafe resources this page is warning about. |
132 UnsafeResourceList unsafe_resources_; | 139 UnsafeResourceList unsafe_resources_; |
133 | 140 |
134 // For displaying safe browsing interstitial. | 141 // For displaying safe browsing interstitial. |
135 std::unique_ptr<BaseSafeBrowsingErrorUI> sb_error_ui_; | 142 std::unique_ptr<BaseSafeBrowsingErrorUI> sb_error_ui_; |
136 | 143 |
137 // Indicate whether user has proceeded this blocking page. | 144 // Indicate whether user has proceeded this blocking page. |
138 bool proceeded_; | 145 bool proceeded_; |
139 | 146 |
140 // After a safe browsing interstitial where the user opted-in to the | 147 // After a safe browsing interstitial where the user opted-in to the |
141 // report but clicked "proceed anyway", we delay the call to | 148 // report but clicked "proceed anyway", we delay the call to |
142 // ThreatDetails::FinishCollection() by this much time (in | 149 // ThreatDetails::FinishCollection() by this much time (in |
143 // milliseconds), in order to get data from the blocked resource itself. | 150 // milliseconds), in order to get data from the blocked resource itself. |
144 int64_t threat_details_proceed_delay_ms_; | 151 int64_t threat_details_proceed_delay_ms_; |
145 | 152 |
153 ErrorUiType error_type_; | |
Jialiu Lin
2017/05/22 17:06:00
nit: can it be const?
Nate Fischer
2017/05/22 23:13:46
Acknowledged. Found a way to remove the member com
| |
154 | |
146 DISALLOW_COPY_AND_ASSIGN(BaseBlockingPage); | 155 DISALLOW_COPY_AND_ASSIGN(BaseBlockingPage); |
147 }; | 156 }; |
148 | 157 |
149 } // namespace safe_browsing | 158 } // namespace safe_browsing |
150 | 159 |
151 #endif // COMPONENTS_SAFE_BROWSING_BASE_BLOCKING_PAGE_H_ | 160 #endif // COMPONENTS_SAFE_BROWSING_BASE_BLOCKING_PAGE_H_ |
OLD | NEW |