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

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

Issue 622683006: Refactor security interstitials, add SecurityInterstitialPage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 #include "chrome/browser/ssl/ssl_blocking_page.h" 5 #include "chrome/browser/ssl/ssl_blocking_page.h"
6 6
7 #include "base/build_time.h" 7 #include "base/build_time.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/i18n/time_formatting.h" 10 #include "base/i18n/time_formatting.h"
(...skipping 26 matching lines...) Expand all
37 #include "content/public/browser/notification_types.h" 37 #include "content/public/browser/notification_types.h"
38 #include "content/public/browser/render_process_host.h" 38 #include "content/public/browser/render_process_host.h"
39 #include "content/public/browser/render_view_host.h" 39 #include "content/public/browser/render_view_host.h"
40 #include "content/public/browser/web_contents.h" 40 #include "content/public/browser/web_contents.h"
41 #include "content/public/common/ssl_status.h" 41 #include "content/public/common/ssl_status.h"
42 #include "grit/browser_resources.h" 42 #include "grit/browser_resources.h"
43 #include "net/base/hash_value.h" 43 #include "net/base/hash_value.h"
44 #include "net/base/net_errors.h" 44 #include "net/base/net_errors.h"
45 #include "net/base/net_util.h" 45 #include "net/base/net_util.h"
46 #include "ui/base/l10n/l10n_util.h" 46 #include "ui/base/l10n/l10n_util.h"
47 #include "ui/base/resource/resource_bundle.h"
48 #include "ui/base/webui/jstemplate_builder.h"
49 #include "ui/base/webui/web_ui_util.h"
50 47
51 #if defined(ENABLE_EXTENSIONS) 48 #if defined(ENABLE_EXTENSIONS)
52 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s ampling.h" 49 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s ampling.h"
53 #endif 50 #endif
54 51
55 #if defined(OS_WIN) 52 #if defined(OS_WIN)
56 #include "base/base_paths_win.h" 53 #include "base/base_paths_win.h"
57 #include "base/path_service.h" 54 #include "base/path_service.h"
58 #include "base/strings/string16.h" 55 #include "base/strings/string16.h"
59 #include "base/win/windows_version.h" 56 #include "base/win/windows_version.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 } // namespace 300 } // namespace
304 301
305 // Note that we always create a navigation entry with SSL errors. 302 // Note that we always create a navigation entry with SSL errors.
306 // No error happening loading a sub-resource triggers an interstitial so far. 303 // No error happening loading a sub-resource triggers an interstitial so far.
307 SSLBlockingPage::SSLBlockingPage(content::WebContents* web_contents, 304 SSLBlockingPage::SSLBlockingPage(content::WebContents* web_contents,
308 int cert_error, 305 int cert_error,
309 const net::SSLInfo& ssl_info, 306 const net::SSLInfo& ssl_info,
310 const GURL& request_url, 307 const GURL& request_url,
311 int options_mask, 308 int options_mask,
312 const base::Callback<void(bool)>& callback) 309 const base::Callback<void(bool)>& callback)
313 : callback_(callback), 310 : SecurityInterstitialPage(web_contents, request_url),
314 web_contents_(web_contents), 311 callback_(callback),
315 cert_error_(cert_error), 312 cert_error_(cert_error),
316 ssl_info_(ssl_info), 313 ssl_info_(ssl_info),
317 request_url_(request_url),
318 overridable_(options_mask & OVERRIDABLE && 314 overridable_(options_mask & OVERRIDABLE &&
319 !(options_mask & STRICT_ENFORCEMENT)), 315 !(options_mask & STRICT_ENFORCEMENT)),
320 strict_enforcement_((options_mask & STRICT_ENFORCEMENT) != 0), 316 strict_enforcement_((options_mask & STRICT_ENFORCEMENT) != 0),
321 interstitial_page_(NULL),
322 internal_(false), 317 internal_(false),
323 num_visits_(-1), 318 num_visits_(-1),
324 expired_but_previously_allowed_( 319 expired_but_previously_allowed_(
325 (options_mask & EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0) { 320 (options_mask & EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0) {
326 Profile* profile = Profile::FromBrowserContext( 321 Profile* profile = Profile::FromBrowserContext(
327 web_contents->GetBrowserContext()); 322 web_contents->GetBrowserContext());
328 // For UMA stats. 323 // For UMA stats.
329 if (net::IsHostnameNonUnique(request_url_.HostNoBrackets())) 324 if (net::IsHostnameNonUnique(request_url.HostNoBrackets()))
330 internal_ = true; 325 internal_ = true;
331 RecordSSLBlockingPageEventStats(SHOW_ALL); 326 RecordSSLBlockingPageEventStats(SHOW_ALL);
332 if (overridable_) { 327 if (overridable_) {
333 RecordSSLBlockingPageEventStats(SHOW_OVERRIDABLE); 328 RecordSSLBlockingPageEventStats(SHOW_OVERRIDABLE);
334 if (internal_) 329 if (internal_)
335 RecordSSLBlockingPageEventStats(SHOW_INTERNAL_HOSTNAME); 330 RecordSSLBlockingPageEventStats(SHOW_INTERNAL_HOSTNAME);
336 HistoryService* history_service = HistoryServiceFactory::GetForProfile( 331 HistoryService* history_service = HistoryServiceFactory::GetForProfile(
337 profile, Profile::EXPLICIT_ACCESS); 332 profile, Profile::EXPLICIT_ACCESS);
338 if (history_service) { 333 if (history_service) {
339 history_service->GetVisibleVisitCountToHost( 334 history_service->GetVisibleVisitCountToHost(
340 request_url_, 335 request_url,
341 base::Bind(&SSLBlockingPage::OnGotHistoryCount, 336 base::Bind(&SSLBlockingPage::OnGotHistoryCount,
342 base::Unretained(this)), 337 base::Unretained(this)),
343 &request_tracker_); 338 &request_tracker_);
344 } 339 }
345 } 340 }
346 341
347 ssl_error_classification_.reset(new SSLErrorClassification( 342 ssl_error_classification_.reset(new SSLErrorClassification(
348 web_contents_, 343 web_contents,
349 base::Time::NowFromSystemTime(), 344 base::Time::NowFromSystemTime(),
350 request_url_, 345 request_url,
351 cert_error_, 346 cert_error_,
352 *ssl_info_.cert.get())); 347 *ssl_info_.cert.get()));
353 ssl_error_classification_->RecordUMAStatistics(overridable_); 348 ssl_error_classification_->RecordUMAStatistics(overridable_);
354 349
355 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) 350 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
356 ssl_error_classification_->RecordCaptivePortalUMAStatistics(overridable_); 351 ssl_error_classification_->RecordCaptivePortalUMAStatistics(overridable_);
357 #endif 352 #endif
358 353
359 #if defined(ENABLE_EXTENSIONS) 354 #if defined(ENABLE_EXTENSIONS)
360 // ExperienceSampling: Set up new sampling event for this interstitial. 355 // ExperienceSampling: Set up new sampling event for this interstitial.
361 std::string event_name(kEventNameBase); 356 std::string event_name(kEventNameBase);
362 if (overridable_ && !strict_enforcement_) 357 if (overridable_ && !strict_enforcement_)
363 event_name.append(kEventOverridable); 358 event_name.append(kEventOverridable);
364 else 359 else
365 event_name.append(kEventNotOverridable); 360 event_name.append(kEventNotOverridable);
366 event_name.append(net::ErrorToString(cert_error_)); 361 event_name.append(net::ErrorToString(cert_error_));
367 sampling_event_.reset(new ExperienceSamplingEvent( 362 sampling_event_.reset(new ExperienceSamplingEvent(
368 event_name, 363 event_name,
369 request_url_, 364 request_url,
370 web_contents_->GetLastCommittedURL(), 365 web_contents->GetLastCommittedURL(),
371 web_contents_->GetBrowserContext())); 366 web_contents->GetBrowserContext()));
372 #endif 367 #endif
373 368
374 // Creating an interstitial without showing (e.g. from chrome://interstitials) 369 // Creating an interstitial without showing (e.g. from chrome://interstitials)
375 // it leaks memory, so don't create it here. 370 // it leaks memory, so don't create it here.
376 } 371 }
377 372
373 bool SSLBlockingPage::ShouldCreateNewNavigation() const {
374 return true;
375 }
376
377 SecurityInterstitialPage::Type SSLBlockingPage::GetTypeForTesting() const {
378 return SecurityInterstitialPage::SSL;
379 }
380
378 SSLBlockingPage::~SSLBlockingPage() { 381 SSLBlockingPage::~SSLBlockingPage() {
379 // InvalidCommonNameSeverityScore() and InvalidDateSeverityScore() are in the 382 // InvalidCommonNameSeverityScore() and InvalidDateSeverityScore() are in the
380 // destructor because they depend on knowing whether captive portal detection 383 // destructor because they depend on knowing whether captive portal detection
381 // happened before the user made a decision. 384 // happened before the user made a decision.
382 SSLErrorInfo::ErrorType type = 385 SSLErrorInfo::ErrorType type =
383 SSLErrorInfo::NetErrorToErrorType(cert_error_); 386 SSLErrorInfo::NetErrorToErrorType(cert_error_);
384 switch (type) { 387 switch (type) {
385 case SSLErrorInfo::CERT_DATE_INVALID: 388 case SSLErrorInfo::CERT_DATE_INVALID:
386 ssl_error_classification_->InvalidDateSeverityScore(); 389 ssl_error_classification_->InvalidDateSeverityScore();
387 break; 390 break;
388 case SSLErrorInfo::CERT_COMMON_NAME_INVALID: 391 case SSLErrorInfo::CERT_COMMON_NAME_INVALID:
389 ssl_error_classification_->InvalidCommonNameSeverityScore(); 392 ssl_error_classification_->InvalidCommonNameSeverityScore();
390 break; 393 break;
391 default: 394 default:
392 break; 395 break;
393 } 396 }
394 if (!callback_.is_null()) { 397 if (!callback_.is_null()) {
395 RecordSSLBlockingPageDetailedStats(false, 398 RecordSSLBlockingPageDetailedStats(false,
396 cert_error_, 399 cert_error_,
397 overridable_, 400 overridable_,
398 internal_, 401 internal_,
399 num_visits_, 402 num_visits_,
400 expired_but_previously_allowed_); 403 expired_but_previously_allowed_);
401 // The page is closed without the user having chosen what to do, default to 404 // The page is closed without the user having chosen what to do, default to
402 // deny. 405 // deny.
403 NotifyDenyCertificate(); 406 NotifyDenyCertificate();
404 } 407 }
405 } 408 }
406 409
407 void SSLBlockingPage::Show() { 410 void SSLBlockingPage::PopulateLoadTimeData(
408 DCHECK(!interstitial_page_); 411 base::DictionaryValue* load_time_data) {
409 interstitial_page_ = InterstitialPage::Create( 412 CHECK(load_time_data);
410 web_contents_, true, request_url_, this); 413 base::string16 url(GetFormattedHostName());
411 interstitial_page_->Show();
412 }
413
414 std::string SSLBlockingPage::GetHTMLContents() {
415 base::DictionaryValue load_time_data;
416 base::string16 url(ASCIIToUTF16(request_url_.host()));
417 if (base::i18n::IsRTL())
418 base::i18n::WrapStringWithLTRFormatting(&url);
419 webui::SetFontAndTextDirection(&load_time_data);
420
421 // Shared values for both the overridable and non-overridable versions. 414 // Shared values for both the overridable and non-overridable versions.
422 load_time_data.SetString("type", "SSL"); 415 load_time_data->SetString("type", "SSL");
423 load_time_data.SetBoolean("overridable", overridable_); 416 load_time_data->SetBoolean("overridable", overridable_);
424 load_time_data.SetString( 417 load_time_data->SetString(
425 "tabTitle", l10n_util::GetStringUTF16(IDS_SSL_V2_TITLE)); 418 "tabTitle", l10n_util::GetStringUTF16(IDS_SSL_V2_TITLE));
426 load_time_data.SetString( 419 load_time_data->SetString(
427 "heading", l10n_util::GetStringUTF16(IDS_SSL_V2_HEADING)); 420 "heading", l10n_util::GetStringUTF16(IDS_SSL_V2_HEADING));
428 421
429 base::Time now = base::Time::NowFromSystemTime(); 422 base::Time now = base::Time::NowFromSystemTime();
430 bool bad_clock = IsErrorDueToBadClock(now, cert_error_); 423 bool bad_clock = IsErrorDueToBadClock(now, cert_error_);
431 if (bad_clock) { 424 if (bad_clock) {
432 load_time_data.SetString("primaryParagraph", 425 load_time_data->SetString("primaryParagraph",
433 l10n_util::GetStringFUTF16( 426 l10n_util::GetStringFUTF16(
434 IDS_SSL_CLOCK_ERROR, 427 IDS_SSL_CLOCK_ERROR,
435 url, 428 url,
436 base::TimeFormatShortDate(now))); 429 base::TimeFormatShortDate(now)));
437 } else { 430 } else {
438 load_time_data.SetString( 431 load_time_data->SetString(
439 "primaryParagraph", 432 "primaryParagraph",
440 l10n_util::GetStringFUTF16(IDS_SSL_V2_PRIMARY_PARAGRAPH, url)); 433 l10n_util::GetStringFUTF16(IDS_SSL_V2_PRIMARY_PARAGRAPH, url));
441 } 434 }
442 435
443 load_time_data.SetString( 436 load_time_data->SetString(
444 "openDetails", 437 "openDetails",
445 l10n_util::GetStringUTF16(IDS_SSL_V2_OPEN_DETAILS_BUTTON)); 438 l10n_util::GetStringUTF16(IDS_SSL_V2_OPEN_DETAILS_BUTTON));
446 load_time_data.SetString( 439 load_time_data->SetString(
447 "closeDetails", 440 "closeDetails",
448 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOSE_DETAILS_BUTTON)); 441 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOSE_DETAILS_BUTTON));
449 load_time_data.SetString("errorCode", net::ErrorToString(cert_error_)); 442 load_time_data->SetString("errorCode", net::ErrorToString(cert_error_));
450 443
451 if (overridable_) { 444 if (overridable_) {
452 SSLErrorInfo error_info = 445 SSLErrorInfo error_info =
453 SSLErrorInfo::CreateError( 446 SSLErrorInfo::CreateError(
454 SSLErrorInfo::NetErrorToErrorType(cert_error_), 447 SSLErrorInfo::NetErrorToErrorType(cert_error_),
455 ssl_info_.cert.get(), 448 ssl_info_.cert.get(),
456 request_url_); 449 request_url());
457 if (bad_clock) { 450 if (bad_clock) {
458 load_time_data.SetString("explanationParagraph", 451 load_time_data->SetString("explanationParagraph",
459 l10n_util::GetStringFUTF16( 452 l10n_util::GetStringFUTF16(
460 IDS_SSL_CLOCK_ERROR_EXPLANATION, url)); 453 IDS_SSL_CLOCK_ERROR_EXPLANATION, url));
461 } else { 454 } else {
462 load_time_data.SetString("explanationParagraph", error_info.details()); 455 load_time_data->SetString("explanationParagraph", error_info.details());
463 } 456 }
464 load_time_data.SetString( 457 load_time_data->SetString(
465 "primaryButtonText", 458 "primaryButtonText",
466 l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_SAFETY_BUTTON)); 459 l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_SAFETY_BUTTON));
467 load_time_data.SetString( 460 load_time_data->SetString(
468 "finalParagraph", 461 "finalParagraph",
469 l10n_util::GetStringFUTF16(IDS_SSL_OVERRIDABLE_PROCEED_PARAGRAPH, 462 l10n_util::GetStringFUTF16(IDS_SSL_OVERRIDABLE_PROCEED_PARAGRAPH,
470 url)); 463 url));
471 } else { 464 } else {
472 SSLErrorInfo::ErrorType type = 465 SSLErrorInfo::ErrorType type =
473 SSLErrorInfo::NetErrorToErrorType(cert_error_); 466 SSLErrorInfo::NetErrorToErrorType(cert_error_);
474 if (type == SSLErrorInfo::CERT_INVALID && SSLErrorClassification:: 467 if (type == SSLErrorInfo::CERT_INVALID && SSLErrorClassification::
475 MaybeWindowsLacksSHA256Support()) { 468 MaybeWindowsLacksSHA256Support()) {
476 load_time_data.SetString( 469 load_time_data->SetString(
477 "explanationParagraph", 470 "explanationParagraph",
478 l10n_util::GetStringFUTF16( 471 l10n_util::GetStringFUTF16(
479 IDS_SSL_NONOVERRIDABLE_MORE_INVALID_SP3, url)); 472 IDS_SSL_NONOVERRIDABLE_MORE_INVALID_SP3, url));
480 } else if (bad_clock) { 473 } else if (bad_clock) {
481 load_time_data.SetString("explanationParagraph", 474 load_time_data->SetString("explanationParagraph",
482 l10n_util::GetStringFUTF16( 475 l10n_util::GetStringFUTF16(
483 IDS_SSL_CLOCK_ERROR_EXPLANATION, url)); 476 IDS_SSL_CLOCK_ERROR_EXPLANATION, url));
484 } else { 477 } else {
485 load_time_data.SetString("explanationParagraph", 478 load_time_data->SetString("explanationParagraph",
486 l10n_util::GetStringFUTF16( 479 l10n_util::GetStringFUTF16(
487 IDS_SSL_NONOVERRIDABLE_MORE, url)); 480 IDS_SSL_NONOVERRIDABLE_MORE, url));
488 } 481 }
489 load_time_data.SetString( 482 load_time_data->SetString(
490 "primaryButtonText", 483 "primaryButtonText",
491 l10n_util::GetStringUTF16(IDS_SSL_NONOVERRIDABLE_RELOAD_BUTTON)); 484 l10n_util::GetStringUTF16(IDS_SSL_NONOVERRIDABLE_RELOAD_BUTTON));
492 // Customize the help link depending on the specific error type. 485 // Customize the help link depending on the specific error type.
493 // Only mark as HSTS if none of the more specific error types apply, and use 486 // Only mark as HSTS if none of the more specific error types apply, and use
494 // INVALID as a fallback if no other string is appropriate. 487 // INVALID as a fallback if no other string is appropriate.
495 load_time_data.SetInteger("errorType", type); 488 load_time_data->SetInteger("errorType", type);
496 int help_string = IDS_SSL_NONOVERRIDABLE_INVALID; 489 int help_string = IDS_SSL_NONOVERRIDABLE_INVALID;
497 switch (type) { 490 switch (type) {
498 case SSLErrorInfo::CERT_REVOKED: 491 case SSLErrorInfo::CERT_REVOKED:
499 help_string = IDS_SSL_NONOVERRIDABLE_REVOKED; 492 help_string = IDS_SSL_NONOVERRIDABLE_REVOKED;
500 break; 493 break;
501 case SSLErrorInfo::CERT_PINNED_KEY_MISSING: 494 case SSLErrorInfo::CERT_PINNED_KEY_MISSING:
502 help_string = IDS_SSL_NONOVERRIDABLE_PINNED; 495 help_string = IDS_SSL_NONOVERRIDABLE_PINNED;
503 break; 496 break;
504 case SSLErrorInfo::CERT_INVALID: 497 case SSLErrorInfo::CERT_INVALID:
505 help_string = IDS_SSL_NONOVERRIDABLE_INVALID; 498 help_string = IDS_SSL_NONOVERRIDABLE_INVALID;
506 break; 499 break;
507 default: 500 default:
508 if (strict_enforcement_) 501 if (strict_enforcement_)
509 help_string = IDS_SSL_NONOVERRIDABLE_HSTS; 502 help_string = IDS_SSL_NONOVERRIDABLE_HSTS;
510 } 503 }
511 load_time_data.SetString( 504 load_time_data->SetString(
512 "finalParagraph", l10n_util::GetStringFUTF16(help_string, url)); 505 "finalParagraph", l10n_util::GetStringFUTF16(help_string, url));
513 } 506 }
514 507
515 // Set debugging information at the bottom of the warning. 508 // Set debugging information at the bottom of the warning.
516 load_time_data.SetString( 509 load_time_data->SetString(
517 "subject", ssl_info_.cert->subject().GetDisplayName()); 510 "subject", ssl_info_.cert->subject().GetDisplayName());
518 load_time_data.SetString( 511 load_time_data->SetString(
519 "issuer", ssl_info_.cert->issuer().GetDisplayName()); 512 "issuer", ssl_info_.cert->issuer().GetDisplayName());
520 load_time_data.SetString( 513 load_time_data->SetString(
521 "expirationDate", 514 "expirationDate",
522 base::TimeFormatShortDate(ssl_info_.cert->valid_expiry())); 515 base::TimeFormatShortDate(ssl_info_.cert->valid_expiry()));
523 load_time_data.SetString( 516 load_time_data->SetString(
524 "currentDate", base::TimeFormatShortDate(now)); 517 "currentDate", base::TimeFormatShortDate(now));
525 std::vector<std::string> encoded_chain; 518 std::vector<std::string> encoded_chain;
526 ssl_info_.cert->GetPEMEncodedChain(&encoded_chain); 519 ssl_info_.cert->GetPEMEncodedChain(&encoded_chain);
527 load_time_data.SetString("pem", JoinString(encoded_chain, std::string())); 520 load_time_data->SetString("pem", JoinString(encoded_chain, std::string()));
528
529 base::StringPiece html(
530 ResourceBundle::GetSharedInstance().GetRawDataResource(
531 IRD_SECURITY_INTERSTITIAL_HTML));
532 return webui::GetI18nTemplateHtml(html, &load_time_data);
533 } 521 }
534 522
535 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { 523 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) {
536 int cert_id = content::CertStore::GetInstance()->StoreCert( 524 int cert_id = content::CertStore::GetInstance()->StoreCert(
537 ssl_info_.cert.get(), web_contents_->GetRenderProcessHost()->GetID()); 525 ssl_info_.cert.get(), web_contents()->GetRenderProcessHost()->GetID());
538 DCHECK(cert_id); 526 DCHECK(cert_id);
539 527
540 entry->GetSSL().security_style = 528 entry->GetSSL().security_style =
541 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; 529 content::SECURITY_STYLE_AUTHENTICATION_BROKEN;
542 entry->GetSSL().cert_id = cert_id; 530 entry->GetSSL().cert_id = cert_id;
543 entry->GetSSL().cert_status = ssl_info_.cert_status; 531 entry->GetSSL().cert_status = ssl_info_.cert_status;
544 entry->GetSSL().security_bits = ssl_info_.security_bits; 532 entry->GetSSL().security_bits = ssl_info_.security_bits;
545 } 533 }
546 534
547 // This handles the commands sent from the interstitial JavaScript. They are 535 // This handles the commands sent from the interstitial JavaScript. They are
548 // defined in chrome/browser/resources/ssl/ssl_errors_common.js. 536 // defined in chrome/browser/resources/ssl/ssl_errors_common.js.
549 // DO NOT reorder or change this logic without also changing the JavaScript! 537 // DO NOT reorder or change this logic without also changing the JavaScript!
550 void SSLBlockingPage::CommandReceived(const std::string& command) { 538 void SSLBlockingPage::CommandReceived(const std::string& command) {
551 int cmd = 0; 539 int cmd = 0;
552 bool retval = base::StringToInt(command, &cmd); 540 bool retval = base::StringToInt(command, &cmd);
553 DCHECK(retval); 541 DCHECK(retval);
554 switch (cmd) { 542 switch (cmd) {
555 case CMD_DONT_PROCEED: { 543 case CMD_DONT_PROCEED: {
556 interstitial_page_->DontProceed(); 544 interstitial_page()->DontProceed();
557 break; 545 break;
558 } 546 }
559 case CMD_PROCEED: { 547 case CMD_PROCEED: {
560 interstitial_page_->Proceed(); 548 interstitial_page()->Proceed();
561 break; 549 break;
562 } 550 }
563 case CMD_MORE: { 551 case CMD_MORE: {
564 RecordSSLBlockingPageEventStats(MORE); 552 RecordSSLBlockingPageEventStats(MORE);
565 #if defined(ENABLE_EXTENSIONS) 553 #if defined(ENABLE_EXTENSIONS)
566 if (sampling_event_.get()) 554 if (sampling_event_.get())
567 sampling_event_->set_has_viewed_details(true); 555 sampling_event_->set_has_viewed_details(true);
568 #endif 556 #endif
569 break; 557 break;
570 } 558 }
571 case CMD_RELOAD: { 559 case CMD_RELOAD: {
572 // The interstitial can't refresh itself. 560 // The interstitial can't refresh itself.
573 web_contents_->GetController().Reload(true); 561 web_contents()->GetController().Reload(true);
574 break; 562 break;
575 } 563 }
576 case CMD_HELP: { 564 case CMD_HELP: {
577 content::NavigationController::LoadURLParams help_page_params( 565 content::NavigationController::LoadURLParams help_page_params(
578 google_util::AppendGoogleLocaleParam( 566 google_util::AppendGoogleLocaleParam(
579 GURL(kHelpURL), g_browser_process->GetApplicationLocale())); 567 GURL(kHelpURL), g_browser_process->GetApplicationLocale()));
580 #if defined(ENABLE_EXTENSIONS) 568 #if defined(ENABLE_EXTENSIONS)
581 if (sampling_event_.get()) 569 if (sampling_event_.get())
582 sampling_event_->set_has_viewed_learn_more(true); 570 sampling_event_->set_has_viewed_learn_more(true);
583 #endif 571 #endif
584 web_contents_->GetController().LoadURLWithParams(help_page_params); 572 web_contents()->GetController().LoadURLWithParams(help_page_params);
585 break; 573 break;
586 } 574 }
587 case CMD_CLOCK: { 575 case CMD_CLOCK: {
588 LaunchDateAndTimeSettings(); 576 LaunchDateAndTimeSettings();
589 break; 577 break;
590 } 578 }
591 default: { 579 default: {
592 NOTREACHED(); 580 NOTREACHED();
593 } 581 }
594 } 582 }
595 } 583 }
596 584
597 void SSLBlockingPage::OverrideRendererPrefs( 585 void SSLBlockingPage::OverrideRendererPrefs(
598 content::RendererPreferences* prefs) { 586 content::RendererPreferences* prefs) {
599 Profile* profile = Profile::FromBrowserContext( 587 Profile* profile = Profile::FromBrowserContext(
600 web_contents_->GetBrowserContext()); 588 web_contents()->GetBrowserContext());
601 renderer_preferences_util::UpdateFromSystemSettings(prefs, profile); 589 renderer_preferences_util::UpdateFromSystemSettings(prefs, profile);
602 } 590 }
603 591
604 void SSLBlockingPage::OnProceed() { 592 void SSLBlockingPage::OnProceed() {
605 RecordSSLBlockingPageDetailedStats(true, 593 RecordSSLBlockingPageDetailedStats(true,
606 cert_error_, 594 cert_error_,
607 overridable_, 595 overridable_,
608 internal_, 596 internal_,
609 num_visits_, 597 num_visits_,
610 expired_but_previously_allowed_); 598 expired_but_previously_allowed_);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 for (; i < 5; i++) { 655 for (; i < 5; i++) {
668 strings->SetString(keys[i], std::string()); 656 strings->SetString(keys[i], std::string());
669 } 657 }
670 } 658 }
671 659
672 void SSLBlockingPage::OnGotHistoryCount(bool success, 660 void SSLBlockingPage::OnGotHistoryCount(bool success,
673 int num_visits, 661 int num_visits,
674 base::Time first_visit) { 662 base::Time first_visit) {
675 num_visits_ = num_visits; 663 num_visits_ = num_visits;
676 } 664 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698