| 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 f18f52b661c367e5cc5cc7c7b9de8136b56ec3b4..bc20047a9cbf49311879520a4e9f2210d5cc2dea 100644
|
| --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
|
| +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
|
| @@ -54,7 +54,9 @@
|
| #include "chrome/common/extensions/extension_constants.h"
|
| #include "chrome/common/pref_names.h"
|
| #include "chrome/common/url_constants.h"
|
| +#include "components/dom_distiller/content/dom_distiller_service_factory.h"
|
| #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 "content/public/browser/web_contents.h"
|
| #include "content/public/browser/web_ui.h"
|
| @@ -186,6 +188,21 @@ WebUIController* NewWebUI<chromeos::OobeUI>(WebUI* web_ui, const GURL& url) {
|
| }
|
| #endif
|
|
|
| +// Special cases for DOM distiller.
|
| +template<>
|
| +WebUIController* NewWebUI<dom_distiller::DomDistillerUi>(WebUI* web_ui,
|
| + const GURL& url) {
|
| + // The DomDistillerUi 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);
|
| + // TODO(nyquist): Add real scheme.
|
| + return new dom_distiller::DomDistillerUi(web_ui, service, "dummy");
|
| +}
|
| +
|
| // Only create ExtensionWebUI for URLs that are allowed extension bindings,
|
| // hosted by actual tabs.
|
| bool NeedsExtensionWebUI(Profile* profile, const GURL& url) {
|
| @@ -245,11 +262,6 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
|
| return &NewWebUI<LocalDiscoveryUI>;
|
| }
|
| #endif
|
| - if (CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kEnableDomDistiller) &&
|
| - url.host() == dom_distiller::kChromeUIDomDistillerHost) {
|
| - return &NewWebUI<dom_distiller::DomDistillerUI>;
|
| - }
|
| if (url.host() == chrome::kChromeUIFlagsHost)
|
| return &NewWebUI<FlagsUI>;
|
| if (url.host() == chrome::kChromeUIHistoryFrameHost)
|
| @@ -480,6 +492,13 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
|
| return &NewWebUI<PrintPreviewUI>;
|
| #endif
|
|
|
| + if (CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kEnableDomDistiller)) {
|
| + if (url.host() == dom_distiller::kChromeUIDomDistillerHost) {
|
| + return &NewWebUI<dom_distiller::DomDistillerUi>;
|
| + }
|
| + }
|
| +
|
| return NULL;
|
| }
|
|
|
|
|