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

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

Issue 105623002: Debug UI for DOM distiller supports distillation and lists articles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup after the mechanical-style move in patch set 1 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
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 b9c37c0bf5701a69333c3f1edd72c7a4f2b2fce6..458d0e70bf05f7bb8828ced8c33adeb4edaa8f96 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,20 @@ 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);
+ return new dom_distiller::DomDistillerUi(web_ui, service, "dummy");
Nico 2013/12/05 00:03:58 Add "//TODO: add real scheme"
nyquist 2013/12/05 00:24:02 Done.
+}
+
// Only create ExtensionWebUI for URLs that are allowed extension bindings,
// hosted by actual tabs.
bool NeedsExtensionWebUI(Profile* profile, const GURL& url) {
@@ -245,11 +261,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)
@@ -478,6 +489,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;
}

Powered by Google App Engine
This is Rietveld 408576698