| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/webui/web_ui_factory.h" | 5 #include "content/browser/webui/web_ui_factory.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/about_flags.h" | 8 #include "chrome/browser/about_flags.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_web_ui.h" | 10 #include "chrome/browser/extensions/extension_web_ui.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 return NULL; | 89 return NULL; |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Returns a function that can be used to create the right type of WebUI for a | 92 // Returns a function that can be used to create the right type of WebUI for a |
| 93 // tab, based on its URL. Returns NULL if the URL doesn't have WebUI associated | 93 // tab, based on its URL. Returns NULL if the URL doesn't have WebUI associated |
| 94 // with it. Even if the factory function is valid, it may yield a NULL WebUI | 94 // with it. Even if the factory function is valid, it may yield a NULL WebUI |
| 95 // when invoked for a particular tab - see NewWebUI<ExtensionWebUI>. | 95 // when invoked for a particular tab - see NewWebUI<ExtensionWebUI>. |
| 96 static WebUIFactoryFunction GetWebUIFactoryFunction(Profile* profile, | 96 static WebUIFactoryFunction GetWebUIFactoryFunction(Profile* profile, |
| 97 const GURL& url) { | 97 const GURL& url) { |
| 98 // Currently, any gears: URL means an HTML dialog. | |
| 99 if (url.SchemeIs(chrome::kGearsScheme)) | |
| 100 return &NewWebUI<HtmlDialogUI>; | |
| 101 | |
| 102 if (url.host() == chrome::kChromeUIDialogHost) | 98 if (url.host() == chrome::kChromeUIDialogHost) |
| 103 return &NewWebUI<ConstrainedHtmlUI>; | 99 return &NewWebUI<ConstrainedHtmlUI>; |
| 104 | 100 |
| 105 ExtensionService* service = profile ? profile->GetExtensionService() : NULL; | 101 ExtensionService* service = profile ? profile->GetExtensionService() : NULL; |
| 106 if (service && service->ExtensionBindingsAllowed(url)) | 102 if (service && service->ExtensionBindingsAllowed(url)) |
| 107 return &NewWebUI<ExtensionWebUI>; | 103 return &NewWebUI<ExtensionWebUI>; |
| 108 | 104 |
| 109 // All platform builds of Chrome will need to have a cloud printing | 105 // All platform builds of Chrome will need to have a cloud printing |
| 110 // dialog as backup. It's just that on Chrome OS, it's the only | 106 // dialog as backup. It's just that on Chrome OS, it's the only |
| 111 // print dialog. | 107 // print dialog. |
| 112 if (url.host() == chrome::kCloudPrintResourcesHost) | 108 if (url.host() == chrome::kCloudPrintResourcesHost) |
| 113 return &NewWebUI<ExternalHtmlDialogUI>; | 109 return &NewWebUI<ExternalHtmlDialogUI>; |
| 114 | 110 |
| 115 // This will get called a lot to check all URLs, so do a quick check of other | 111 // This will get called a lot to check all URLs, so do a quick check of other |
| 116 // schemes (gears was handled above) to filter out most URLs. | 112 // schemes to filter out most URLs. |
| 117 if (!url.SchemeIs(chrome::kChromeDevToolsScheme) && | 113 if (!url.SchemeIs(chrome::kChromeDevToolsScheme) && |
| 118 !url.SchemeIs(chrome::kChromeInternalScheme) && | 114 !url.SchemeIs(chrome::kChromeInternalScheme) && |
| 119 !url.SchemeIs(chrome::kChromeUIScheme)) | 115 !url.SchemeIs(chrome::kChromeUIScheme)) |
| 120 return NULL; | 116 return NULL; |
| 121 | 117 |
| 122 if (url.host() == chrome::kChromeUISyncResourcesHost || | 118 if (url.host() == chrome::kChromeUISyncResourcesHost || |
| 123 url.host() == chrome::kChromeUIRemotingResourcesHost || | 119 url.host() == chrome::kChromeUIRemotingResourcesHost || |
| 124 url.host() == chrome::kCloudPrintSetupHost) | 120 url.host() == chrome::kCloudPrintSetupHost) |
| 125 return &NewWebUI<HtmlDialogUI>; | 121 return &NewWebUI<HtmlDialogUI>; |
| 126 | 122 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 if (page_url.host() == chrome::kChromeUIPluginsHost) | 337 if (page_url.host() == chrome::kChromeUIPluginsHost) |
| 342 return PluginsUI::GetFaviconResourceBytes(); | 338 return PluginsUI::GetFaviconResourceBytes(); |
| 343 | 339 |
| 344 #if defined(ENABLE_REMOTING) | 340 #if defined(ENABLE_REMOTING) |
| 345 if (page_url.host() == chrome::kChromeUIRemotingHost) | 341 if (page_url.host() == chrome::kChromeUIRemotingHost) |
| 346 return RemotingUI::GetFaviconResourceBytes(); | 342 return RemotingUI::GetFaviconResourceBytes(); |
| 347 #endif | 343 #endif |
| 348 | 344 |
| 349 return NULL; | 345 return NULL; |
| 350 } | 346 } |
| OLD | NEW |