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

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

Issue 2418813002: [Reland] Refactoring of SBER preference usage (Closed)
Patch Set: Sync Created 4 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) 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 <utility> 7 #include <utility>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 interstitial_page_ = content::InterstitialPage::Create( 63 interstitial_page_ = content::InterstitialPage::Create(
64 web_contents_, ShouldCreateNewNavigation(), request_url_, this); 64 web_contents_, ShouldCreateNewNavigation(), request_url_, this);
65 if (!create_view_) 65 if (!create_view_)
66 interstitial_page_->DontCreateViewForTesting(); 66 interstitial_page_->DontCreateViewForTesting();
67 interstitial_page_->Show(); 67 interstitial_page_->Show();
68 68
69 controller_->set_interstitial_page(interstitial_page_); 69 controller_->set_interstitial_page(interstitial_page_);
70 AfterShow(); 70 AfterShow();
71 } 71 }
72 72
73 Profile* SecurityInterstitialPage::profile() {
74 return Profile::FromBrowserContext(web_contents()->GetBrowserContext());
75 }
76
73 bool SecurityInterstitialPage::IsPrefEnabled(const char* pref) { 77 bool SecurityInterstitialPage::IsPrefEnabled(const char* pref) {
74 Profile* profile = 78 return profile()->GetPrefs()->GetBoolean(pref);
75 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
76 return profile->GetPrefs()->GetBoolean(pref);
77 } 79 }
78 80
79 ChromeControllerClient* SecurityInterstitialPage::controller() { 81 ChromeControllerClient* SecurityInterstitialPage::controller() {
80 return controller_.get(); 82 return controller_.get();
81 } 83 }
82 84
83 security_interstitials::MetricsHelper* 85 security_interstitials::MetricsHelper*
84 SecurityInterstitialPage::metrics_helper() { 86 SecurityInterstitialPage::metrics_helper() {
85 return controller_->metrics_helper(); 87 return controller_->metrics_helper();
86 } 88 }
87 89
88 base::string16 SecurityInterstitialPage::GetFormattedHostName() const { 90 base::string16 SecurityInterstitialPage::GetFormattedHostName() const {
89 return security_interstitials::common_string_util::GetFormattedHostName( 91 return security_interstitials::common_string_util::GetFormattedHostName(
90 request_url_); 92 request_url_);
91 } 93 }
92 94
93 std::string SecurityInterstitialPage::GetHTMLContents() { 95 std::string SecurityInterstitialPage::GetHTMLContents() {
94 base::DictionaryValue load_time_data; 96 base::DictionaryValue load_time_data;
95 PopulateInterstitialStrings(&load_time_data); 97 PopulateInterstitialStrings(&load_time_data);
96 const std::string& app_locale = g_browser_process->GetApplicationLocale(); 98 const std::string& app_locale = g_browser_process->GetApplicationLocale();
97 webui::SetLoadTimeDataDefaults(app_locale, &load_time_data); 99 webui::SetLoadTimeDataDefaults(app_locale, &load_time_data);
98 std::string html = ResourceBundle::GetSharedInstance() 100 std::string html = ResourceBundle::GetSharedInstance()
99 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_HTML) 101 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_HTML)
100 .as_string(); 102 .as_string();
101 webui::AppendWebUiCssTextDefaults(&html); 103 webui::AppendWebUiCssTextDefaults(&html);
102 return webui::GetI18nTemplateHtml(html, &load_time_data); 104 return webui::GetI18nTemplateHtml(html, &load_time_data);
103 } 105 }
OLDNEW
« no previous file with comments | « chrome/browser/interstitials/security_interstitial_page.h ('k') | chrome/browser/profiles/profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698