Chromium Code Reviews| Index: components/dom_distiller/webui/dom_distiller_ui.cc |
| diff --git a/components/dom_distiller/webui/dom_distiller_ui.cc b/components/dom_distiller/webui/dom_distiller_ui.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6a29559871b96b214cd88ab4d23d7f2d05f09b78 |
| --- /dev/null |
| +++ b/components/dom_distiller/webui/dom_distiller_ui.cc |
| @@ -0,0 +1,45 @@ |
| +// Copyright 2013 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/dom_distiller/webui/dom_distiller_ui.h" |
| + |
| +#include "components/dom_distiller/webui/dom_distiller_handler.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" |
| +#include "grit/component_strings.h" |
| +#include "grit/components_resources.h" |
| + |
| +namespace dom_distiller { |
| + |
| +DomDistillerUI::DomDistillerUI(content::WebUI* web_ui, |
| + const GURL& url, |
| + const std::string& host) |
| + : content::WebUIController(web_ui) { |
| + |
|
Evan Stade
2013/09/11 01:44:01
^H
nyquist
2013/09/12 17:42:12
Done.
|
| + // Setup WebUIDataSource. |
| + content::WebUIDataSource* source = |
| + content::WebUIDataSource::Create(host); |
|
Evan Stade
2013/09/11 01:44:01
you can hardcode the host here (perhaps a new url
cjhopman
2013/09/12 00:41:00
We also know that url.host() == host here, we coul
nyquist
2013/09/12 17:42:12
Removed the host argument, but kept the URL for no
|
| + source->SetDefaultResource(IDR_ABOUT_DOM_DISTILLER_HTML); |
| + source->AddResourcePath("about_dom_distiller.css", |
| + IDR_ABOUT_DOM_DISTILLER_CSS); |
| + source->AddResourcePath("about_dom_distiller.js", |
| + IDR_ABOUT_DOM_DISTILLER_JS); |
|
Evan Stade
2013/09/11 01:44:01
args should be aligned horizontally
nyquist
2013/09/12 17:42:12
Done.
|
| + |
| + source->SetUseJsonJSFormatV2(); |
| + source->AddLocalizedString("domDistillerTitle", IDS_DOM_DISTILLER_TITLE); |
| + content::BrowserContext* browser_context = |
| + web_ui->GetWebContents()->GetBrowserContext(); |
| + content::WebUIDataSource::Add(browser_context, source); |
| + source->SetJsonPath("strings.js"); |
| + |
| + // Add message handler. |
| + web_ui->AddMessageHandler(new DomDistillerHandler()); |
| +} |
| + |
| +DomDistillerUI::~DomDistillerUI() { |
|
Evan Stade
2013/09/11 01:44:01
{} on same line
nyquist
2013/09/12 17:42:12
Done.
|
| +} |
| + |
| +} // namespace dom_distiller |