| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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. | 98 // Currently, any gears: URL means an HTML dialog. |
| 99 if (url.SchemeIs(chrome::kGearsScheme)) | 99 if (url.SchemeIs(chrome::kGearsScheme)) |
| 100 return &NewWebUI<HtmlDialogUI>; | 100 return &NewWebUI<HtmlDialogUI>; |
| 101 | 101 |
| 102 if (url.host() == chrome::kChromeUIDialogHost) | 102 if (url.host() == chrome::kChromeUIDialogHost || |
| 103 url.host() == chrome::kChromeUICollectedCookiesHost) { |
| 103 return &NewWebUI<ConstrainedHtmlUI>; | 104 return &NewWebUI<ConstrainedHtmlUI>; |
| 105 } |
| 104 | 106 |
| 105 ExtensionService* service = profile ? profile->GetExtensionService() : NULL; | 107 ExtensionService* service = profile ? profile->GetExtensionService() : NULL; |
| 106 if (service && service->ExtensionBindingsAllowed(url)) | 108 if (service && service->ExtensionBindingsAllowed(url)) |
| 107 return &NewWebUI<ExtensionWebUI>; | 109 return &NewWebUI<ExtensionWebUI>; |
| 108 | 110 |
| 109 // All platform builds of Chrome will need to have a cloud printing | 111 // 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 | 112 // dialog as backup. It's just that on Chrome OS, it's the only |
| 111 // print dialog. | 113 // print dialog. |
| 112 if (url.host() == chrome::kCloudPrintResourcesHost) | 114 if (url.host() == chrome::kCloudPrintResourcesHost) |
| 113 return &NewWebUI<ExternalHtmlDialogUI>; | 115 return &NewWebUI<ExternalHtmlDialogUI>; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 if (page_url.host() == chrome::kChromeUIPluginsHost) | 347 if (page_url.host() == chrome::kChromeUIPluginsHost) |
| 346 return PluginsUI::GetFaviconResourceBytes(); | 348 return PluginsUI::GetFaviconResourceBytes(); |
| 347 | 349 |
| 348 #if defined(ENABLE_REMOTING) | 350 #if defined(ENABLE_REMOTING) |
| 349 if (page_url.host() == chrome::kChromeUIRemotingHost) | 351 if (page_url.host() == chrome::kChromeUIRemotingHost) |
| 350 return RemotingUI::GetFaviconResourceBytes(); | 352 return RemotingUI::GetFaviconResourceBytes(); |
| 351 #endif | 353 #endif |
| 352 | 354 |
| 353 return NULL; | 355 return NULL; |
| 354 } | 356 } |
| OLD | NEW |