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