| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/dom_distiller/webui/dom_distiller_ui.h" | 5 #include "components/dom_distiller/webui/dom_distiller_ui.h" |
| 6 | 6 |
| 7 #include "components/dom_distiller/core/dom_distiller_constants.h" | 7 #include "components/dom_distiller/core/dom_distiller_constants.h" |
| 8 #include "components/dom_distiller/core/dom_distiller_service.h" | 8 #include "components/dom_distiller/core/dom_distiller_service.h" |
| 9 #include "components/dom_distiller/webui/dom_distiller_handler.h" | 9 #include "components/dom_distiller/webui/dom_distiller_handler.h" |
| 10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 const std::string& scheme) | 21 const std::string& scheme) |
| 22 : content::WebUIController(web_ui) { | 22 : content::WebUIController(web_ui) { |
| 23 // Set up WebUIDataSource. | 23 // Set up WebUIDataSource. |
| 24 content::WebUIDataSource* source = | 24 content::WebUIDataSource* source = |
| 25 content::WebUIDataSource::Create(kChromeUIDomDistillerHost); | 25 content::WebUIDataSource::Create(kChromeUIDomDistillerHost); |
| 26 source->SetDefaultResource(IDR_ABOUT_DOM_DISTILLER_HTML); | 26 source->SetDefaultResource(IDR_ABOUT_DOM_DISTILLER_HTML); |
| 27 source->AddResourcePath("about_dom_distiller.css", | 27 source->AddResourcePath("about_dom_distiller.css", |
| 28 IDR_ABOUT_DOM_DISTILLER_CSS); | 28 IDR_ABOUT_DOM_DISTILLER_CSS); |
| 29 source->AddResourcePath("about_dom_distiller.js", IDR_ABOUT_DOM_DISTILLER_JS); | 29 source->AddResourcePath("about_dom_distiller.js", IDR_ABOUT_DOM_DISTILLER_JS); |
| 30 | 30 |
| 31 source->SetUseJsonJSFormatV2(); | |
| 32 source->AddLocalizedString("domDistillerTitle", | 31 source->AddLocalizedString("domDistillerTitle", |
| 33 IDS_DOM_DISTILLER_WEBUI_TITLE); | 32 IDS_DOM_DISTILLER_WEBUI_TITLE); |
| 34 source->AddLocalizedString("addArticleUrl", | 33 source->AddLocalizedString("addArticleUrl", |
| 35 IDS_DOM_DISTILLER_WEBUI_ENTRY_URL); | 34 IDS_DOM_DISTILLER_WEBUI_ENTRY_URL); |
| 36 source->AddLocalizedString("addArticleAddButtonLabel", | 35 source->AddLocalizedString("addArticleAddButtonLabel", |
| 37 IDS_DOM_DISTILLER_WEBUI_ENTRY_ADD); | 36 IDS_DOM_DISTILLER_WEBUI_ENTRY_ADD); |
| 38 source->AddLocalizedString("addArticleFailedLabel", | 37 source->AddLocalizedString("addArticleFailedLabel", |
| 39 IDS_DOM_DISTILLER_WEBUI_ENTRY_ADD_FAILED); | 38 IDS_DOM_DISTILLER_WEBUI_ENTRY_ADD_FAILED); |
| 40 source->AddLocalizedString("viewUrlButtonLabel", | 39 source->AddLocalizedString("viewUrlButtonLabel", |
| 41 IDS_DOM_DISTILLER_WEBUI_VIEW_URL); | 40 IDS_DOM_DISTILLER_WEBUI_VIEW_URL); |
| 42 source->AddLocalizedString("viewUrlFailedLabel", | 41 source->AddLocalizedString("viewUrlFailedLabel", |
| 43 IDS_DOM_DISTILLER_WEBUI_VIEW_URL_FAILED); | 42 IDS_DOM_DISTILLER_WEBUI_VIEW_URL_FAILED); |
| 44 source->AddLocalizedString("loadingEntries", | 43 source->AddLocalizedString("loadingEntries", |
| 45 IDS_DOM_DISTILLER_WEBUI_FETCHING_ENTRIES); | 44 IDS_DOM_DISTILLER_WEBUI_FETCHING_ENTRIES); |
| 46 source->AddLocalizedString("refreshButtonLabel", | 45 source->AddLocalizedString("refreshButtonLabel", |
| 47 IDS_DOM_DISTILLER_WEBUI_REFRESH); | 46 IDS_DOM_DISTILLER_WEBUI_REFRESH); |
| 48 | 47 |
| 49 content::BrowserContext* browser_context = | 48 content::BrowserContext* browser_context = |
| 50 web_ui->GetWebContents()->GetBrowserContext(); | 49 web_ui->GetWebContents()->GetBrowserContext(); |
| 51 content::WebUIDataSource::Add(browser_context, source); | 50 content::WebUIDataSource::Add(browser_context, source); |
| 52 source->SetJsonPath("strings.js"); | 51 source->SetJsonPath("strings.js"); |
| 53 | 52 |
| 54 // Add message handler. | 53 // Add message handler. |
| 55 web_ui->AddMessageHandler(new DomDistillerHandler(service, scheme)); | 54 web_ui->AddMessageHandler(new DomDistillerHandler(service, scheme)); |
| 56 } | 55 } |
| 57 | 56 |
| 58 DomDistillerUi::~DomDistillerUi() {} | 57 DomDistillerUi::~DomDistillerUi() {} |
| 59 | 58 |
| 60 } // namespace dom_distiller | 59 } // namespace dom_distiller |
| OLD | NEW |