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>; |
} |
} |