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

Unified Diff: chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc

Issue 105723002: Add the scheme chrome-distiller:// and hook up data source. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed to use onReceived for javascript Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profiles/profile_io_data.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
index 458d0e70bf05f7bb8828ced8c33adeb4edaa8f96..8144ea74c2e5b2cc9b6ccb9610a4a3d60fcd60f7 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -58,6 +58,7 @@
#include "components/dom_distiller/core/dom_distiller_constants.h"
#include "components/dom_distiller/core/dom_distiller_service.h"
#include "components/dom_distiller/webui/dom_distiller_ui.h"
+#include "components/dom_distiller/webui/dom_distiller_viewer_ui.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/common/content_client.h"
@@ -199,7 +200,24 @@ WebUIController* NewWebUI<dom_distiller::DomDistillerUi>(WebUI* web_ui,
dom_distiller::DomDistillerService* service =
dom_distiller::DomDistillerServiceFactory::GetForBrowserContext(
browser_context);
- return new dom_distiller::DomDistillerUi(web_ui, service, "dummy");
+ return new dom_distiller::DomDistillerUi(web_ui,
+ service,
+ chrome::kDomDistillerScheme);
+}
+
+template<>
+WebUIController* NewWebUI<dom_distiller::DomDistillerViewerUi>(
+ WebUI* web_ui,
+ const GURL& url) {
+ // The DomDistillerViewerUi can not depend on
+ // components/dom_distiller/content, so inject the correct DomDistillerService
+ // from chrome/.
+ content::BrowserContext* browser_context =
+ web_ui->GetWebContents()->GetBrowserContext();
+ dom_distiller::DomDistillerService* service =
+ dom_distiller::DomDistillerServiceFactory::GetForBrowserContext(
+ browser_context);
+ return new dom_distiller::DomDistillerViewerUi(web_ui, service);
nyquist 2013/12/04 23:56:56 I think this can be added in the next CL instead.
}
// Only create ExtensionWebUI for URLs that are allowed extension bindings,
@@ -224,7 +242,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
// schemes to filter out most URLs.
if (!url.SchemeIs(chrome::kChromeDevToolsScheme) &&
!url.SchemeIs(chrome::kChromeInternalScheme) &&
- !url.SchemeIs(chrome::kChromeUIScheme)) {
+ !url.SchemeIs(chrome::kChromeUIScheme) &&
+ !url.SchemeIs(chrome::kDomDistillerScheme)) {
return NULL;
}
@@ -491,7 +510,9 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableDomDistiller)) {
- if (url.host() == dom_distiller::kChromeUIDomDistillerHost) {
+ if (url.SchemeIs(chrome::kDomDistillerScheme)) {
+ return &NewWebUI<dom_distiller::DomDistillerViewerUi>;
+ } else if (url.host() == dom_distiller::kChromeUIDomDistillerHost) {
return &NewWebUI<dom_distiller::DomDistillerUi>;
}
}
« no previous file with comments | « chrome/browser/profiles/profile_io_data.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698