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 if (url.host() == chrome::kChromeUIDialogHost || | 98 if (url.host() == chrome::kChromeUIDialogHost) |
99 url.host() == chrome::kChromeUICollectedCookiesHost) { | |
100 return &NewWebUI<ConstrainedHtmlUI>; | 99 return &NewWebUI<ConstrainedHtmlUI>; |
101 } | |
102 | 100 |
103 ExtensionService* service = profile ? profile->GetExtensionService() : NULL; | 101 ExtensionService* service = profile ? profile->GetExtensionService() : NULL; |
104 if (service && service->ExtensionBindingsAllowed(url)) | 102 if (service && service->ExtensionBindingsAllowed(url)) |
105 return &NewWebUI<ExtensionWebUI>; | 103 return &NewWebUI<ExtensionWebUI>; |
106 | 104 |
107 // 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 |
108 // 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 |
109 // print dialog. | 107 // print dialog. |
110 if (url.host() == chrome::kCloudPrintResourcesHost) | 108 if (url.host() == chrome::kCloudPrintResourcesHost) |
111 return &NewWebUI<ExternalHtmlDialogUI>; | 109 return &NewWebUI<ExternalHtmlDialogUI>; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 #if defined(ENABLE_REMOTING) | 173 #if defined(ENABLE_REMOTING) |
176 if (url.host() == chrome::kChromeUIRemotingHost) { | 174 if (url.host() == chrome::kChromeUIRemotingHost) { |
177 if (CommandLine::ForCurrentProcess()->HasSwitch( | 175 if (CommandLine::ForCurrentProcess()->HasSwitch( |
178 switches::kEnableRemoting)) { | 176 switches::kEnableRemoting)) { |
179 return &NewWebUI<RemotingUI>; | 177 return &NewWebUI<RemotingUI>; |
180 } | 178 } |
181 } | 179 } |
182 #endif | 180 #endif |
183 | 181 |
184 #if defined(OS_CHROMEOS) | 182 #if defined(OS_CHROMEOS) |
| 183 if (url.host() == chrome::kChromeUICollectedCookiesHost) |
| 184 return &NewWebUI<ConstrainedHtmlUI>; |
185 if (url.host() == chrome::kChromeUIFileBrowseHost) | 185 if (url.host() == chrome::kChromeUIFileBrowseHost) |
186 return &NewWebUI<FileBrowseUI>; | 186 return &NewWebUI<FileBrowseUI>; |
187 if (url.host() == chrome::kChromeUIImageBurnerHost) | 187 if (url.host() == chrome::kChromeUIImageBurnerHost) |
188 return &NewWebUI<ImageBurnUI>; | 188 return &NewWebUI<ImageBurnUI>; |
189 if (url.host() == chrome::kChromeUIKeyboardOverlayHost) | 189 if (url.host() == chrome::kChromeUIKeyboardOverlayHost) |
190 return &NewWebUI<KeyboardOverlayUI>; | 190 return &NewWebUI<KeyboardOverlayUI>; |
191 if (url.host() == chrome::kChromeUIMediaplayerHost) | 191 if (url.host() == chrome::kChromeUIMediaplayerHost) |
192 return &NewWebUI<MediaplayerUI>; | 192 return &NewWebUI<MediaplayerUI>; |
193 if (url.host() == chrome::kChromeUIMobileSetupHost) | 193 if (url.host() == chrome::kChromeUIMobileSetupHost) |
194 return &NewWebUI<MobileSetupUI>; | 194 return &NewWebUI<MobileSetupUI>; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 if (page_url.host() == chrome::kChromeUIPluginsHost) | 339 if (page_url.host() == chrome::kChromeUIPluginsHost) |
340 return PluginsUI::GetFaviconResourceBytes(); | 340 return PluginsUI::GetFaviconResourceBytes(); |
341 | 341 |
342 #if defined(ENABLE_REMOTING) | 342 #if defined(ENABLE_REMOTING) |
343 if (page_url.host() == chrome::kChromeUIRemotingHost) | 343 if (page_url.host() == chrome::kChromeUIRemotingHost) |
344 return RemotingUI::GetFaviconResourceBytes(); | 344 return RemotingUI::GetFaviconResourceBytes(); |
345 #endif | 345 #endif |
346 | 346 |
347 return NULL; | 347 return NULL; |
348 } | 348 } |
OLD | NEW |