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

Side by Side Diff: chrome/browser/ssl/captive_portal_blocking_page.cc

Issue 1467063002: Introduce the ChromeControllerClient class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bugfix 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
« no previous file with comments | « chrome/browser/ssl/bad_clock_blocking_page.cc ('k') | chrome/browser/ssl/cert_report_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/browser/ssl/captive_portal_blocking_page.h" 5 #include "chrome/browser/ssl/captive_portal_blocking_page.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" 14 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ssl/cert_report_helper.h" 16 #include "chrome/browser/ssl/cert_report_helper.h"
17 #include "chrome/browser/ssl/ssl_cert_reporter.h" 17 #include "chrome/browser/ssl/ssl_cert_reporter.h"
18 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
19 #include "components/captive_portal/captive_portal_detector.h" 19 #include "components/captive_portal/captive_portal_detector.h"
20 #include "components/certificate_reporting/error_reporter.h" 20 #include "components/certificate_reporting/error_reporter.h"
21 #include "components/security_interstitials/core/controller_client.h"
21 #include "components/url_formatter/url_formatter.h" 22 #include "components/url_formatter/url_formatter.h"
22 #include "components/wifi/wifi_service.h" 23 #include "components/wifi/wifi_service.h"
23 #include "content/public/browser/web_contents.h" 24 #include "content/public/browser/web_contents.h"
24 #include "grit/generated_resources.h" 25 #include "grit/generated_resources.h"
25 #include "net/base/net_util.h" 26 #include "net/base/net_util.h"
26 #include "net/base/network_change_notifier.h" 27 #include "net/base/network_change_notifier.h"
27 #include "net/base/network_interfaces.h" 28 #include "net/base/network_interfaces.h"
28 #include "net/ssl/ssl_info.h" 29 #include "net/ssl/ssl_info.h"
29 #include "ui/base/l10n/l10n_util.h" 30 #include "ui/base/l10n/l10n_util.h"
30 31
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 load_time_data->SetString("primaryParagraph", paragraph); 177 load_time_data->SetString("primaryParagraph", paragraph);
177 // Explicitly specify other expected fields to empty. 178 // Explicitly specify other expected fields to empty.
178 load_time_data->SetString("openDetails", base::string16()); 179 load_time_data->SetString("openDetails", base::string16());
179 load_time_data->SetString("closeDetails", base::string16()); 180 load_time_data->SetString("closeDetails", base::string16());
180 load_time_data->SetString("explanationParagraph", base::string16()); 181 load_time_data->SetString("explanationParagraph", base::string16());
181 load_time_data->SetString("finalParagraph", base::string16()); 182 load_time_data->SetString("finalParagraph", base::string16());
182 183
183 if (cert_report_helper_) 184 if (cert_report_helper_)
184 cert_report_helper_->PopulateExtendedReportingOption(load_time_data); 185 cert_report_helper_->PopulateExtendedReportingOption(load_time_data);
185 else 186 else
186 load_time_data->SetBoolean(interstitials::kDisplayCheckBox, false); 187 load_time_data->SetBoolean(security_interstitials::kDisplayCheckBox, false);
187 } 188 }
188 189
189 void CaptivePortalBlockingPage::CommandReceived(const std::string& command) { 190 void CaptivePortalBlockingPage::CommandReceived(const std::string& command) {
190 if (command == "\"pageLoadComplete\"") { 191 if (command == "\"pageLoadComplete\"") {
191 // content::WaitForRenderFrameReady sends this message when the page 192 // content::WaitForRenderFrameReady sends this message when the page
192 // load completes. Ignore it. 193 // load completes. Ignore it.
193 return; 194 return;
194 } 195 }
195 int command_num = 0; 196 int command_num = 0;
196 bool command_is_num = base::StringToInt(command, &command_num); 197 bool command_is_num = base::StringToInt(command, &command_num);
197 DCHECK(command_is_num) << command; 198 DCHECK(command_is_num) << command;
198 // Any command other than "open the login page" is ignored. 199 // Any command other than "open the login page" is ignored.
199 if (command_num == CMD_OPEN_LOGIN) { 200 if (command_num == security_interstitials::CMD_OPEN_LOGIN) {
200 RecordUMA(OPEN_LOGIN_PAGE); 201 RecordUMA(OPEN_LOGIN_PAGE);
201 CaptivePortalTabHelper::OpenLoginTabForWebContents(web_contents(), true); 202 CaptivePortalTabHelper::OpenLoginTabForWebContents(web_contents(), true);
202 } 203 }
203 } 204 }
204 205
205 void CaptivePortalBlockingPage::OnProceed() { 206 void CaptivePortalBlockingPage::OnProceed() {
206 if (cert_report_helper_) { 207 if (cert_report_helper_) {
207 // Finish collecting information about invalid certificates, if the 208 // Finish collecting information about invalid certificates, if the
208 // user opted in to. 209 // user opted in to.
209 cert_report_helper_->FinishCertCollection( 210 cert_report_helper_->FinishCertCollection(
210 certificate_reporting::ErrorReport::USER_PROCEEDED); 211 certificate_reporting::ErrorReport::USER_PROCEEDED);
211 } 212 }
212 } 213 }
213 214
214 void CaptivePortalBlockingPage::OnDontProceed() { 215 void CaptivePortalBlockingPage::OnDontProceed() {
215 if (cert_report_helper_) { 216 if (cert_report_helper_) {
216 // Finish collecting information about invalid certificates, if the 217 // Finish collecting information about invalid certificates, if the
217 // user opted in to. 218 // user opted in to.
218 cert_report_helper_->FinishCertCollection( 219 cert_report_helper_->FinishCertCollection(
219 certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED); 220 certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED);
220 } 221 }
221 222
222 // Need to explicity deny the certificate via the callback, otherwise memory 223 // Need to explicity deny the certificate via the callback, otherwise memory
223 // is leaked. 224 // is leaked.
224 if (!callback_.is_null()) { 225 if (!callback_.is_null()) {
225 callback_.Run(false); 226 callback_.Run(false);
226 callback_.Reset(); 227 callback_.Reset();
227 } 228 }
228 } 229 }
OLDNEW
« no previous file with comments | « chrome/browser/ssl/bad_clock_blocking_page.cc ('k') | chrome/browser/ssl/cert_report_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698