Chromium Code Reviews| Index: components/safe_browsing/web_ui/safe_browsing_ui.cc |
| diff --git a/components/safe_browsing/web_ui/safe_browsing_ui.cc b/components/safe_browsing/web_ui/safe_browsing_ui.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..761b7cbd217c7c3b48efb4a40fe621912b217653 |
| --- /dev/null |
| +++ b/components/safe_browsing/web_ui/safe_browsing_ui.cc |
| @@ -0,0 +1,33 @@ |
| +// Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| +#include "components/safe_browsing/web_ui/safe_browsing_ui.h" |
| +#include "components/grit/components_resources.h" |
| +#include "components/grit/components_scaled_resources.h" |
| +#include "components/safe_browsing/web_ui/constants.h" |
| +#include "components/strings/grit/components_strings.h" |
| +#include "content/public/browser/browser_context.h" |
| +#include "content/public/browser/web_contents.h" |
| +#include "content/public/browser/web_ui.h" |
| +#include "content/public/browser/web_ui_data_source.h" |
| + |
| +SafeBrowsingUI::SafeBrowsingUI(content::WebUI* web_ui) |
| + : content::WebUIController(web_ui) { |
| + // Set up the chrome://safe-browsing source. |
| + content::WebUIDataSource* html_source = content::WebUIDataSource::Create( |
| + safe_browsing::kChromeUISafeBrowsingHost); |
| + |
| + // Add localized string resources. |
| + html_source->AddLocalizedString("sbUnderConstruction", |
| + IDS_SB_UNDER_CONSTRUCTION); |
| + |
| + // Add required resources. |
| + html_source->AddResourcePath("safe_browsing.css", IDR_SAFE_BROWSING_CSS); |
| + html_source->SetDefaultResource(IDR_SAFE_BROWSING_HTML); |
|
vakh (use Gerrit instead)
2017/06/23 18:52:03
This line explains why the strings.js file was loa
|
| + |
| + content::BrowserContext* browser_context = |
| + web_ui->GetWebContents()->GetBrowserContext(); |
| + content::WebUIDataSource::Add(browser_context, html_source); |
|
vakh (use Gerrit instead)
2017/06/23 18:52:02
content::WebUIDataSource::Add(web_ui->GetWebConten
|
| +} |
| + |
| +SafeBrowsingUI::~SafeBrowsingUI() {} |