| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 5 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 template<> | 196 template<> |
| 197 WebUIController* NewWebUI<dom_distiller::DomDistillerUi>(WebUI* web_ui, | 197 WebUIController* NewWebUI<dom_distiller::DomDistillerUi>(WebUI* web_ui, |
| 198 const GURL& url) { | 198 const GURL& url) { |
| 199 // The DomDistillerUi can not depend on components/dom_distiller/content, | 199 // The DomDistillerUi can not depend on components/dom_distiller/content, |
| 200 // so inject the correct DomDistillerService from chrome/. | 200 // so inject the correct DomDistillerService from chrome/. |
| 201 content::BrowserContext* browser_context = | 201 content::BrowserContext* browser_context = |
| 202 web_ui->GetWebContents()->GetBrowserContext(); | 202 web_ui->GetWebContents()->GetBrowserContext(); |
| 203 dom_distiller::DomDistillerService* service = | 203 dom_distiller::DomDistillerService* service = |
| 204 dom_distiller::DomDistillerServiceFactory::GetForBrowserContext( | 204 dom_distiller::DomDistillerServiceFactory::GetForBrowserContext( |
| 205 browser_context); | 205 browser_context); |
| 206 // TODO(nyquist): Add real scheme. | 206 return new dom_distiller::DomDistillerUi(web_ui, |
| 207 return new dom_distiller::DomDistillerUi(web_ui, service, "dummy"); | 207 service, |
| 208 chrome::kDomDistillerScheme); |
| 208 } | 209 } |
| 209 | 210 |
| 210 // Only create ExtensionWebUI for URLs that are allowed extension bindings, | 211 // Only create ExtensionWebUI for URLs that are allowed extension bindings, |
| 211 // hosted by actual tabs. | 212 // hosted by actual tabs. |
| 212 bool NeedsExtensionWebUI(Profile* profile, const GURL& url) { | 213 bool NeedsExtensionWebUI(Profile* profile, const GURL& url) { |
| 213 ExtensionService* service = profile ? profile->GetExtensionService() : NULL; | 214 ExtensionService* service = profile ? profile->GetExtensionService() : NULL; |
| 214 return service && service->ExtensionBindingsAllowed(url); | 215 return service && service->ExtensionBindingsAllowed(url); |
| 215 } | 216 } |
| 216 | 217 |
| 217 // Returns a function that can be used to create the right type of WebUI for a | 218 // Returns a function that can be used to create the right type of WebUI for a |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 #endif | 663 #endif |
| 663 | 664 |
| 664 // Android doesn't use the plugins pages. | 665 // Android doesn't use the plugins pages. |
| 665 if (page_url.host() == chrome::kChromeUIPluginsHost) | 666 if (page_url.host() == chrome::kChromeUIPluginsHost) |
| 666 return PluginsUI::GetFaviconResourceBytes(scale_factor); | 667 return PluginsUI::GetFaviconResourceBytes(scale_factor); |
| 667 | 668 |
| 668 #endif | 669 #endif |
| 669 | 670 |
| 670 return NULL; | 671 return NULL; |
| 671 } | 672 } |
| OLD | NEW |