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

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: Fix strings and dependencies for ios 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 | « build/ios/grit_whitelist.txt ('k') | components/dom_distiller.gypi » ('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 c20609c3fa1dbfd247fd9c58821afacc6cfee382..fa712adbd24429c6a43ec7e183304f299b5209ac 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -11,6 +11,7 @@
#include "base/prefs/pref_service.h"
#include "chrome/browser/about_flags.h"
#include "chrome/browser/bookmarks/enhanced_bookmarks_features.h"
+#include "chrome/browser/dom_distiller/dom_distiller_service_factory.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_web_ui.h"
#include "chrome/browser/history/history_types.h"
@@ -56,6 +57,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.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"
@@ -187,6 +189,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) {
@@ -246,10 +263,6 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return &NewWebUI<LocalDiscoveryUI>;
}
#endif
- if (IsEnableDomDistillerSet() &&
- 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 +493,11 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return &NewWebUI<PrintPreviewUI>;
#endif
+ if (IsEnableDomDistillerSet() &&
+ url.host() == dom_distiller::kChromeUIDomDistillerHost) {
+ return &NewWebUI<dom_distiller::DomDistillerUi>;
+ }
+
return NULL;
}
« no previous file with comments | « build/ios/grit_whitelist.txt ('k') | components/dom_distiller.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698