| Index: components/security_interstitials/content/security_interstitial_page.cc
|
| diff --git a/chrome/browser/interstitials/security_interstitial_page.cc b/components/security_interstitials/content/security_interstitial_page.cc
|
| similarity index 74%
|
| rename from chrome/browser/interstitials/security_interstitial_page.cc
|
| rename to components/security_interstitials/content/security_interstitial_page.cc
|
| index fc25be88f5d97fcf8a952c365d18d58944675ed7..90c54a9e45910cc989ebc6a874db4df3b7b67c73 100644
|
| --- a/chrome/browser/interstitials/security_interstitial_page.cc
|
| +++ b/components/security_interstitials/content/security_interstitial_page.cc
|
| @@ -2,40 +2,37 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/browser/interstitials/security_interstitial_page.h"
|
| +#include "components/security_interstitials/content/security_interstitial_page.h"
|
|
|
| #include <utility>
|
|
|
| #include "base/i18n/rtl.h"
|
| #include "base/metrics/histogram_macros.h"
|
| -#include "base/strings/utf_string_conversions.h"
|
| #include "base/values.h"
|
| -#include "chrome/browser/browser_process.h"
|
| -#include "chrome/browser/interstitials/chrome_controller_client.h"
|
| -#include "chrome/browser/profiles/profile.h"
|
| -#include "chrome/common/pref_names.h"
|
| -#include "components/grit/components_resources.h"
|
| #include "components/prefs/pref_service.h"
|
| #include "components/safe_browsing_db/safe_browsing_prefs.h"
|
| +#include "components/security_interstitials/content/security_interstitial_controller_client.h"
|
| #include "components/security_interstitials/core/common_string_util.h"
|
| #include "components/security_interstitials/core/metrics_helper.h"
|
| #include "content/public/browser/interstitial_page.h"
|
| #include "content/public/browser/page_navigator.h"
|
| #include "content/public/browser/web_contents.h"
|
| +#include "grit/components_resources.h"
|
| #include "ui/base/resource/resource_bundle.h"
|
| #include "ui/base/webui/jstemplate_builder.h"
|
| #include "ui/base/webui/web_ui_util.h"
|
|
|
| +namespace security_interstitials {
|
| +
|
| SecurityInterstitialPage::SecurityInterstitialPage(
|
| content::WebContents* web_contents,
|
| const GURL& request_url,
|
| - std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper)
|
| + std::unique_ptr<SecurityInterstitialControllerClient> controller)
|
| : web_contents_(web_contents),
|
| request_url_(request_url),
|
| interstitial_page_(NULL),
|
| create_view_(true),
|
| - controller_(
|
| - new ChromeControllerClient(web_contents, std::move(metrics_helper))) {
|
| + controller_(std::move(controller)) {
|
| // Creating interstitial_page_ without showing it leaks memory, so don't
|
| // create it here.
|
| }
|
| @@ -68,22 +65,20 @@ void SecurityInterstitialPage::Show() {
|
|
|
| // Determine if any prefs need to be updated prior to showing the security
|
| // interstitial.
|
| - safe_browsing::UpdatePrefsBeforeSecurityInterstitial(profile()->GetPrefs());
|
| + safe_browsing::UpdatePrefsBeforeSecurityInterstitial(
|
| + controller_->GetPrefService());
|
| +
|
| interstitial_page_->Show();
|
|
|
| controller_->set_interstitial_page(interstitial_page_);
|
| AfterShow();
|
| }
|
|
|
| -Profile* SecurityInterstitialPage::profile() {
|
| - return Profile::FromBrowserContext(web_contents()->GetBrowserContext());
|
| -}
|
| -
|
| bool SecurityInterstitialPage::IsPrefEnabled(const char* pref) {
|
| - return profile()->GetPrefs()->GetBoolean(pref);
|
| + return controller_->GetPrefService()->GetBoolean(pref);
|
| }
|
|
|
| -ChromeControllerClient* SecurityInterstitialPage::controller() {
|
| +SecurityInterstitialControllerClient* SecurityInterstitialPage::controller() {
|
| return controller_.get();
|
| }
|
|
|
| @@ -100,11 +95,13 @@ base::string16 SecurityInterstitialPage::GetFormattedHostName() const {
|
| std::string SecurityInterstitialPage::GetHTMLContents() {
|
| base::DictionaryValue load_time_data;
|
| PopulateInterstitialStrings(&load_time_data);
|
| - const std::string& app_locale = g_browser_process->GetApplicationLocale();
|
| - webui::SetLoadTimeDataDefaults(app_locale, &load_time_data);
|
| + webui::SetLoadTimeDataDefaults(
|
| + controller()->GetApplicationLocale(), &load_time_data);
|
| std::string html = ResourceBundle::GetSharedInstance()
|
| .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_HTML)
|
| .as_string();
|
| webui::AppendWebUiCssTextDefaults(&html);
|
| return webui::GetI18nTemplateHtml(html, &load_time_data);
|
| }
|
| +
|
| +} // security_interstitials
|
|
|