Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 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 "components/dom_distiller/webui/dom_distiller_ui.h" | |
| 6 | |
| 7 #include "components/dom_distiller/webui/dom_distiller_handler.h" | |
| 8 #include "content/public/browser/browser_context.h" | |
| 9 #include "content/public/browser/web_contents.h" | |
| 10 #include "content/public/browser/web_ui.h" | |
| 11 #include "content/public/browser/web_ui_data_source.h" | |
| 12 #include "grit/component_strings.h" | |
| 13 #include "grit/components_resources.h" | |
| 14 | |
| 15 namespace dom_distiller { | |
| 16 | |
| 17 DomDistillerUI::DomDistillerUI(content::WebUI* web_ui, | |
| 18 const GURL& url, | |
| 19 const std::string& host) | |
| 20 : content::WebUIController(web_ui) { | |
| 21 | |
|
Evan Stade
2013/09/11 01:44:01
^H
nyquist
2013/09/12 17:42:12
Done.
| |
| 22 // Setup WebUIDataSource. | |
| 23 content::WebUIDataSource* source = | |
| 24 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
| |
| 25 source->SetDefaultResource(IDR_ABOUT_DOM_DISTILLER_HTML); | |
| 26 source->AddResourcePath("about_dom_distiller.css", | |
| 27 IDR_ABOUT_DOM_DISTILLER_CSS); | |
| 28 source->AddResourcePath("about_dom_distiller.js", | |
| 29 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.
| |
| 30 | |
| 31 source->SetUseJsonJSFormatV2(); | |
| 32 source->AddLocalizedString("domDistillerTitle", IDS_DOM_DISTILLER_TITLE); | |
| 33 content::BrowserContext* browser_context = | |
| 34 web_ui->GetWebContents()->GetBrowserContext(); | |
| 35 content::WebUIDataSource::Add(browser_context, source); | |
| 36 source->SetJsonPath("strings.js"); | |
| 37 | |
| 38 // Add message handler. | |
| 39 web_ui->AddMessageHandler(new DomDistillerHandler()); | |
| 40 } | |
| 41 | |
| 42 DomDistillerUI::~DomDistillerUI() { | |
|
Evan Stade
2013/09/11 01:44:01
{} on same line
nyquist
2013/09/12 17:42:12
Done.
| |
| 43 } | |
| 44 | |
| 45 } // namespace dom_distiller | |
| OLD | NEW |