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

Unified Diff: chrome/browser/ssl/ssl_blocking_page.cc

Issue 341653006: Add experimental versions of the SSL interstitial (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ssl/ssl_blocking_page.cc
diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc
index 1b9e8d1b163baf9ea4100699483cb10d33902ec9..83bd9b3845dfe1ffb316b0f35a9161446ebd2524 100644
--- a/chrome/browser/ssl/ssl_blocking_page.cc
+++ b/chrome/browser/ssl/ssl_blocking_page.cc
@@ -57,6 +57,46 @@ using content::NavigationEntry;
namespace {
+// Constants for the M37 Finch trial.
+const char kInterstitialTrialName[] = "SSLInterstitialVersion";
+const char kCondV1[] = "V1";
+const char kCondV1LayoutV2Text[] = "V1LayoutV2Text";
+const char kCondV2[] = "V2"; // Also the default.
+const char kCondV2Guard[] = "V2WithGuard";
+const char kCondV2Yellow[] = "V2Yellow";
+
+const char* GetTrialCondition() {
Dan Beam 2014/06/20 21:28:20 nit: makes the code smaller and easier to read
felt 2014/06/21 00:23:16 Done.
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kSSLInterstitialV1) ||
+ base::FieldTrialList::FindFullName(kInterstitialTrialName) == kCondV1) {
+ return kCondV1;
+ }
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kSSLInterstitialV2) ||
+ base::FieldTrialList::FindFullName(kInterstitialTrialName) == kCondV2) {
+ return kCondV2;
+ }
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kSSLInterstitialV1WithV2Text) ||
+ base::FieldTrialList::FindFullName(kInterstitialTrialName)
+ == kCondV1LayoutV2Text) {
+ return kCondV1LayoutV2Text;
+ }
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kSSLInterstitialV2Guard) ||
+ base::FieldTrialList::FindFullName(kInterstitialTrialName)
+ == kCondV2Guard) {
+ return kCondV2Guard;
+ }
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kSSLInterstitialV2Yellow) ||
+ base::FieldTrialList::FindFullName(kInterstitialTrialName)
+ == kCondV2Yellow) {
+ return kCondV2Yellow;
+ }
+ return kCondV2;
+}
+
// Events for UMA. Do not reorder or change!
enum SSLBlockingPageEvent {
SHOW_ALL,
@@ -200,7 +240,8 @@ SSLBlockingPage::SSLBlockingPage(
captive_portal_detection_enabled_(false),
captive_portal_probe_completed_(false),
captive_portal_no_response_(false),
- captive_portal_detected_(false) {
+ captive_portal_detected_(false),
+ trial_condition_(GetTrialCondition()) {
Profile* profile = Profile::FromBrowserContext(
web_contents->GetBrowserContext());
// For UMA stats.
@@ -255,11 +296,8 @@ SSLBlockingPage::~SSLBlockingPage() {
}
std::string SSLBlockingPage::GetHTMLContents() {
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSSLInterstitialVersionV1) ||
- base::FieldTrialList::FindFullName("SSLInterstitialVersion") == "V1") {
+ if (trial_condition_ == kCondV1 || trial_condition_ == kCondV1LayoutV2Text)
return GetHTMLContentsV1();
- }
return GetHTMLContentsV2();
}
@@ -273,25 +311,52 @@ std::string SSLBlockingPage::GetHTMLContentsV1() {
SSLErrorInfo::NetErrorToErrorType(cert_error_),
ssl_info_.cert.get(),
request_url_);
-
resource_id = IDR_SSL_ROAD_BLOCK_HTML;
- strings.SetString("headLine", error_info.title());
- strings.SetString("description", error_info.details());
- strings.SetString("moreInfoTitle",
- l10n_util::GetStringUTF16(IDS_CERT_ERROR_EXTRA_INFO_TITLE));
- SetExtraInfo(&strings, error_info.extra_information());
-
- strings.SetString(
- "exit", l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_PAGE_EXIT));
- strings.SetString(
- "title", l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_PAGE_TITLE));
- strings.SetString(
- "proceed", l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_PAGE_PROCEED));
- strings.SetString(
- "reasonForNotProceeding", l10n_util::GetStringUTF16(
- IDS_SSL_OVERRIDABLE_PAGE_SHOULD_NOT_PROCEED));
- strings.SetString("errorType", "overridable");
strings.SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr");
+ strings.SetString("errorType", "overridable");
+ if (trial_condition_ == kCondV1LayoutV2Text) {
+ base::string16 url(ASCIIToUTF16(request_url_.host()));
+ strings.SetString(
+ "headLine", l10n_util::GetStringUTF16(IDS_SSL_V2_HEADING));
+ strings.SetString(
+ "description",
+ l10n_util::GetStringFUTF16(IDS_SSL_V2_PRIMARY_PARAGRAPH, url));
+ strings.SetString(
+ "moreInfoTitle",
+ l10n_util::GetStringUTF16(IDS_SSL_V2_OPEN_DETAILS_BUTTON));
+ strings.SetString("moreInfo1", error_info.details());
+ strings.SetString("moreInfo2", std::string());
+ strings.SetString("moreInfo3", std::string());
+ strings.SetString("moreInfo4", std::string());
+ strings.SetString("moreInfo5", std::string());
Dan Beam 2014/06/20 21:28:20 ^ don't these need to be base::string16()?
felt 2014/06/21 00:23:15 Done, although it doesn't really matter for the em
+ strings.SetString(
+ "exit",
+ l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_SAFETY_BUTTON));
+ strings.SetString(
+ "title", l10n_util::GetStringUTF16(IDS_SSL_V2_TITLE));
+ strings.SetString(
+ "proceed",
+ l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_PROCEED_LINK_TEXT));
+ strings.SetString(
+ "reasonForNotProceeding", std::string());
+ } else {
+ strings.SetString("headLine", error_info.title());
+ strings.SetString("description", error_info.details());
+ strings.SetString("moreInfoTitle",
+ l10n_util::GetStringUTF16(IDS_CERT_ERROR_EXTRA_INFO_TITLE));
+ SetExtraInfo(&strings, error_info.extra_information());
+
+ strings.SetString(
+ "exit", l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_PAGE_EXIT));
+ strings.SetString(
+ "title", l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_PAGE_TITLE));
+ strings.SetString(
+ "proceed",
+ l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_PAGE_PROCEED));
+ strings.SetString(
+ "reasonForNotProceeding", l10n_util::GetStringUTF16(
+ IDS_SSL_OVERRIDABLE_PAGE_SHOULD_NOT_PROCEED));
Dan Beam 2014/06/20 21:28:20 opt nit: strings.SetString("reasonForNotProceed
felt 2014/06/21 00:23:15 sure
+ }
} else {
// Let's build the blocking error page.
resource_id = IDR_SSL_BLOCKING_HTML;
@@ -412,6 +477,7 @@ std::string SSLBlockingPage::GetHTMLContentsV2() {
if (base::i18n::IsRTL())
base::i18n::WrapStringWithLTRFormatting(&url);
webui::SetFontAndTextDirection(&load_time_data);
+ load_time_data.SetString("trialCondition", trial_condition_);
// Shared values for both the overridable and non-overridable versions.
load_time_data.SetBoolean("ssl", true);

Powered by Google App Engine
This is Rietveld 408576698