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

Side by Side Diff: chrome/browser/interstitials/security_interstitial_page.cc

Issue 935663004: Add checkbox for reporting invalid TLS/SSL cert chains (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment tweaks Created 5 years, 10 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) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/interstitials/security_interstitial_page.h" 5 #include "chrome/browser/interstitials/security_interstitial_page.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/metrics/histogram.h"
9 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
9 #include "base/values.h" 11 #include "base/values.h"
10 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/common/pref_names.h"
11 #include "chrome/grit/browser_resources.h" 15 #include "chrome/grit/browser_resources.h"
12 #include "content/public/browser/interstitial_page.h" 16 #include "content/public/browser/interstitial_page.h"
13 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
14 #include "ui/base/resource/resource_bundle.h" 18 #include "ui/base/resource/resource_bundle.h"
15 #include "ui/base/webui/jstemplate_builder.h" 19 #include "ui/base/webui/jstemplate_builder.h"
16 #include "ui/base/webui/web_ui_util.h" 20 #include "ui/base/webui/web_ui_util.h"
17 21
18 SecurityInterstitialPage::SecurityInterstitialPage( 22 SecurityInterstitialPage::SecurityInterstitialPage(
19 content::WebContents* web_contents, 23 content::WebContents* web_contents,
20 const GURL& request_url) 24 const GURL& request_url)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 base::DictionaryValue load_time_data; 69 base::DictionaryValue load_time_data;
66 PopulateInterstitialStrings(&load_time_data); 70 PopulateInterstitialStrings(&load_time_data);
67 const std::string& app_locale = g_browser_process->GetApplicationLocale(); 71 const std::string& app_locale = g_browser_process->GetApplicationLocale();
68 webui::SetLoadTimeDataDefaults(app_locale, &load_time_data); 72 webui::SetLoadTimeDataDefaults(app_locale, &load_time_data);
69 std::string html = ResourceBundle::GetSharedInstance() 73 std::string html = ResourceBundle::GetSharedInstance()
70 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_HTML) 74 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_HTML)
71 .as_string(); 75 .as_string();
72 webui::AppendWebUiCssTextDefaults(&html); 76 webui::AppendWebUiCssTextDefaults(&html);
73 return webui::GetI18nTemplateHtml(html, &load_time_data); 77 return webui::GetI18nTemplateHtml(html, &load_time_data);
74 } 78 }
79
80 SecurityInterstitialPageWithExtendedReporting::
81 SecurityInterstitialPageWithExtendedReporting(
82 content::WebContents* web_contents,
83 const GURL& url)
84 : SecurityInterstitialPage(web_contents, url) {
85 }
86
87 void SecurityInterstitialPageWithExtendedReporting::SetReportingPreference(
88 bool report) {
89 Profile* profile =
90 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
91 PrefService* pref = profile->GetPrefs();
92 pref->SetBoolean(prefs::kSafeBrowsingExtendedReportingEnabled, report);
93 UMA_HISTOGRAM_BOOLEAN("SB2.SetExtendedReportingEnabled", report);
94 }
95
96 bool SecurityInterstitialPageWithExtendedReporting::IsPrefEnabled(
97 const char* pref) {
98 Profile* profile =
99 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
100 return profile->GetPrefs()->GetBoolean(pref);
101 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698