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

Side by Side Diff: chrome/browser/safe_browsing/test_safe_browsing_blocking_page_quiet.cc

Issue 2894243002: Add quiet safe browsing interstitials to chrome://interstitials for in browser testing (Closed)
Patch Set: Merge and fix display_options Created 3 years, 7 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/safe_browsing/test_safe_browsing_blocking_page_quiet.h"
6
7 #include "components/grit/components_resources.h"
8 #include "components/security_interstitials/content/security_interstitial_contro ller_client.h"
9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/base/webui/jstemplate_builder.h"
11 #include "ui/base/webui/web_ui_util.h"
12
13 namespace security_interstitials {
14 TestSafeBrowsingBlockingPageQuiet::~TestSafeBrowsingBlockingPageQuiet() {}
15
16 TestSafeBrowsingBlockingPageQuiet::TestSafeBrowsingBlockingPageQuiet(
17 safe_browsing::BaseUIManager* ui_manager,
18 content::WebContents* web_contents,
19 const GURL& main_frame_url,
20 const UnsafeResourceList& unsafe_resources,
21 const BaseSafeBrowsingErrorUI::SBErrorDisplayOptions& display_options,
22 bool is_giant_webview)
23 : BaseBlockingPage(
24 ui_manager,
25 web_contents,
26 main_frame_url,
27 unsafe_resources,
28 CreateControllerClient(web_contents, unsafe_resources, ui_manager),
29 display_options),
30 sb_error_ui_(unsafe_resources[0].url,
31 main_frame_url,
32 GetInterstitialReason(unsafe_resources),
33 display_options,
34 ui_manager->app_locale(),
35 base::Time::NowFromSystemTime(),
36 controller(),
37 is_giant_webview) {}
38
39 // static
40 TestSafeBrowsingBlockingPageQuiet*
41 TestSafeBrowsingBlockingPageQuiet::CreateBlockingPage(
42 safe_browsing::BaseUIManager* ui_manager,
43 content::WebContents* web_contents,
44 const GURL& main_frame_url,
45 const UnsafeResource& unsafe_resource,
46 bool is_giant_webview) {
47 const UnsafeResourceList resources{unsafe_resource};
48
49 BaseSafeBrowsingErrorUI::SBErrorDisplayOptions display_options =
50 BaseBlockingPage::CreateDefaultDisplayOptions(resources);
51
52 return new TestSafeBrowsingBlockingPageQuiet(
53 ui_manager, web_contents, main_frame_url, resources, display_options,
54 is_giant_webview);
55 }
56
57 std::string TestSafeBrowsingBlockingPageQuiet::GetHTML() {
58 base::DictionaryValue load_time_data;
59 sb_error_ui_.PopulateStringsForHtml(&load_time_data);
60 webui::SetLoadTimeDataDefaults(controller()->GetApplicationLocale(),
61 &load_time_data);
62 std::string html =
63 ResourceBundle::GetSharedInstance()
64 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_QUIET_HTML)
65 .as_string();
66 webui::AppendWebUiCssTextDefaults(&html);
67 html = webui::GetI18nTemplateHtml(html, &load_time_data);
68 return html;
69 }
70
71 } // namespace security_interstitials
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698