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

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

Issue 318213002: Add custom interstitial for captive portals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mmenke comments, add login scenario to browser tests and fix race. Created 6 years 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 | Annotate | Revision Log
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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 SSLBlockingPage::SSLBlockingPage(content::WebContents* web_contents, 323 SSLBlockingPage::SSLBlockingPage(content::WebContents* web_contents,
324 int cert_error, 324 int cert_error,
325 const net::SSLInfo& ssl_info, 325 const net::SSLInfo& ssl_info,
326 const GURL& request_url, 326 const GURL& request_url,
327 int options_mask, 327 int options_mask,
328 const base::Callback<void(bool)>& callback) 328 const base::Callback<void(bool)>& callback)
329 : SecurityInterstitialPage(web_contents, request_url), 329 : SecurityInterstitialPage(web_contents, request_url),
330 callback_(callback), 330 callback_(callback),
331 cert_error_(cert_error), 331 cert_error_(cert_error),
332 ssl_info_(ssl_info), 332 ssl_info_(ssl_info),
333 overridable_(options_mask & OVERRIDABLE && 333 overridable_(IsOverridable(options_mask)),
334 !(options_mask & STRICT_ENFORCEMENT)),
335 danger_overridable_(true), 334 danger_overridable_(true),
336 strict_enforcement_((options_mask & STRICT_ENFORCEMENT) != 0), 335 strict_enforcement_((options_mask & STRICT_ENFORCEMENT) != 0),
337 internal_(false), 336 internal_(false),
338 num_visits_(-1), 337 num_visits_(-1),
339 expired_but_previously_allowed_( 338 expired_but_previously_allowed_(
340 (options_mask & EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0) { 339 (options_mask & EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0) {
341 Profile* profile = Profile::FromBrowserContext( 340 Profile* profile = Profile::FromBrowserContext(
342 web_contents->GetBrowserContext()); 341 web_contents->GetBrowserContext());
343 // For UMA stats. 342 // For UMA stats.
344 if (SSLErrorClassification::IsHostnameNonUniqueOrDotless( 343 if (SSLErrorClassification::IsHostnameNonUniqueOrDotless(
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 load_time_data->SetString("errorCode", net::ErrorToString(cert_error_)); 444 load_time_data->SetString("errorCode", net::ErrorToString(cert_error_));
446 load_time_data->SetString( 445 load_time_data->SetString(
447 "openDetails", 446 "openDetails",
448 l10n_util::GetStringUTF16(IDS_SSL_V2_OPEN_DETAILS_BUTTON)); 447 l10n_util::GetStringUTF16(IDS_SSL_V2_OPEN_DETAILS_BUTTON));
449 load_time_data->SetString( 448 load_time_data->SetString(
450 "closeDetails", 449 "closeDetails",
451 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOSE_DETAILS_BUTTON)); 450 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOSE_DETAILS_BUTTON));
452 451
453 // Conditional UI configuration. 452 // Conditional UI configuration.
454 if (bad_clock) { 453 if (bad_clock) {
455 load_time_data->SetBoolean("bad_clock", true);
456 load_time_data->SetBoolean("overridable", false);
457
458 #if defined(OS_IOS)
459 load_time_data->SetBoolean("hide_primary_button", true);
460 #else
461 load_time_data->SetBoolean("hide_primary_button", false);
462 #endif
463
464 // We're showing the SSL clock warning to be helpful, but we haven't warned
465 // them about the risks. (And there might still be an SSL error after they
466 // fix their clock.) Thus, we don't allow the "danger" override in this
467 // case.
468 danger_overridable_ = false;
469
470 int heading_string = SSLErrorClassification::IsUserClockInTheFuture(now) ?
471 IDS_SSL_V2_CLOCK_AHEAD_HEADING :
472 IDS_SSL_V2_CLOCK_BEHIND_HEADING;
473
474 load_time_data->SetString(
475 "tabTitle",
476 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOCK_TITLE));
477 load_time_data->SetString(
478 "heading",
479 l10n_util::GetStringUTF16(heading_string));
480 load_time_data->SetString("primaryParagraph", 454 load_time_data->SetString("primaryParagraph",
mmenke 2014/11/26 18:57:48 Mind having someone else review the js / HTML rela
meacer 2014/12/08 22:29:51 Sure, will do.
481 l10n_util::GetStringFUTF16( 455 l10n_util::GetStringFUTF16(
482 IDS_SSL_V2_CLOCK_PRIMARY_PARAGRAPH , 456 IDS_SSL_V2_CLOCK_PRIMARY_PARAGRAPH ,
483 url, 457 url,
484 base::TimeFormatFriendlyDateAndTime(now))); 458 base::TimeFormatFriendlyDateAndTime(now)));
485 459
486 load_time_data->SetString( 460 load_time_data->SetString(
487 "primaryButtonText", 461 "primaryButtonText",
488 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOCK_UPDATE_DATE_AND_TIME)); 462 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOCK_UPDATE_DATE_AND_TIME));
489 load_time_data->SetString( 463 load_time_data->SetString(
490 "explanationParagraph", 464 "explanationParagraph",
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 for (; i < 5; i++) { 690 for (; i < 5; i++) {
717 strings->SetString(keys[i], std::string()); 691 strings->SetString(keys[i], std::string());
718 } 692 }
719 } 693 }
720 694
721 void SSLBlockingPage::OnGotHistoryCount(bool success, 695 void SSLBlockingPage::OnGotHistoryCount(bool success,
722 int num_visits, 696 int num_visits,
723 base::Time first_visit) { 697 base::Time first_visit) {
724 num_visits_ = num_visits; 698 num_visits_ = num_visits;
725 } 699 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698