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 "chrome/browser/ui/webui/chrome_web_ui_factory.h" | 5 #include "chrome/browser/ui/webui/chrome_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 13 matching lines...) Expand all Loading... | |
24 #include "chrome/browser/ui/webui/net_internals_ui.h" | 24 #include "chrome/browser/ui/webui/net_internals_ui.h" |
25 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 25 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
26 #include "chrome/browser/ui/webui/options/options_ui.h" | 26 #include "chrome/browser/ui/webui/options/options_ui.h" |
27 #include "chrome/browser/ui/webui/plugins_ui.h" | 27 #include "chrome/browser/ui/webui/plugins_ui.h" |
28 #include "chrome/browser/ui/webui/print_preview_ui.h" | 28 #include "chrome/browser/ui/webui/print_preview_ui.h" |
29 #include "chrome/browser/ui/webui/sync_internals_ui.h" | 29 #include "chrome/browser/ui/webui/sync_internals_ui.h" |
30 #include "chrome/browser/ui/webui/textfields_ui.h" | 30 #include "chrome/browser/ui/webui/textfields_ui.h" |
31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/common/extensions/extension_constants.h" | 32 #include "chrome/common/extensions/extension_constants.h" |
33 #include "chrome/common/url_constants.h" | 33 #include "chrome/common/url_constants.h" |
34 #include "content/browser/content_browser_client.h" | |
34 #include "content/browser/tab_contents/tab_contents.h" | 35 #include "content/browser/tab_contents/tab_contents.h" |
35 #include "content/browser/webui/web_ui.h" | 36 #include "content/browser/webui/web_ui.h" |
37 #include "content/common/content_client.h" | |
36 #include "googleurl/src/gurl.h" | 38 #include "googleurl/src/gurl.h" |
37 | 39 |
38 #if defined(OS_CHROMEOS) | 40 #if defined(OS_CHROMEOS) |
39 #include "chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.h" | 41 #include "chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.h" |
40 #include "chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.h" | 42 #include "chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.h" |
41 #include "chrome/browser/ui/webui/chromeos/imageburner_ui.h" | 43 #include "chrome/browser/ui/webui/chromeos/imageburner_ui.h" |
42 #include "chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.h" | 44 #include "chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.h" |
43 #include "chrome/browser/ui/webui/chromeos/mobile_setup_ui.h" | 45 #include "chrome/browser/ui/webui/chromeos/mobile_setup_ui.h" |
44 #include "chrome/browser/ui/webui/chromeos/proxy_settings_ui.h" | 46 #include "chrome/browser/ui/webui/chromeos/proxy_settings_ui.h" |
45 #include "chrome/browser/ui/webui/chromeos/register_page_ui.h" | 47 #include "chrome/browser/ui/webui/chromeos/register_page_ui.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 } // namespace | 222 } // namespace |
221 | 223 |
222 WebUI::TypeID ChromeWebUIFactory::GetWebUIType(Profile* profile, | 224 WebUI::TypeID ChromeWebUIFactory::GetWebUIType(Profile* profile, |
223 const GURL& url) const { | 225 const GURL& url) const { |
224 WebUIFactoryFunction function = GetWebUIFactoryFunction(profile, url); | 226 WebUIFactoryFunction function = GetWebUIFactoryFunction(profile, url); |
225 return function ? reinterpret_cast<WebUI::TypeID>(function) : WebUI::kNoWebUI; | 227 return function ? reinterpret_cast<WebUI::TypeID>(function) : WebUI::kNoWebUI; |
226 } | 228 } |
227 | 229 |
228 bool ChromeWebUIFactory::UseWebUIForURL(Profile* profile, | 230 bool ChromeWebUIFactory::UseWebUIForURL(Profile* profile, |
229 const GURL& url) const { | 231 const GURL& url) const { |
230 return GetWebUIType(profile, url) != WebUI::kNoWebUI; | 232 // Convert installed app URLs to extension URLs to classify them properly. |
Matt Perry
2011/05/19 22:15:11
Shouldn't this be done in GetWebUIType so that we
Charlie Reis
2011/05/19 23:02:15
Ah, yes, good point. I think it actually belongs
Matt Perry
2011/05/19 23:04:43
Could you verify that we are using the same WebUI
Charlie Reis
2011/05/19 23:53:07
Wow, the WebUI code is kind of hard to follow. I
Matt Perry
2011/05/20 00:03:47
WebUI is a way of exposing extra bindings to a tab
Charlie Reis
2011/05/20 15:32:47
Thanks-- that clarifies things. I've added a chec
| |
233 GURL effective_url = | |
234 content::GetContentClient()->browser()->GetEffectiveURL(profile, url); | |
235 return GetWebUIType(profile, effective_url) != WebUI::kNoWebUI; | |
231 } | 236 } |
232 | 237 |
233 bool ChromeWebUIFactory::HasWebUIScheme(const GURL& url) const { | 238 bool ChromeWebUIFactory::HasWebUIScheme(const GURL& url) const { |
234 return url.SchemeIs(chrome::kChromeDevToolsScheme) || | 239 return url.SchemeIs(chrome::kChromeDevToolsScheme) || |
235 url.SchemeIs(chrome::kChromeInternalScheme) || | 240 url.SchemeIs(chrome::kChromeInternalScheme) || |
236 url.SchemeIs(chrome::kChromeUIScheme) || | 241 url.SchemeIs(chrome::kChromeUIScheme) || |
237 url.SchemeIs(chrome::kExtensionScheme); | 242 url.SchemeIs(chrome::kExtensionScheme); |
238 } | 243 } |
239 | 244 |
240 bool ChromeWebUIFactory::IsURLAcceptableForWebUI( | 245 bool ChromeWebUIFactory::IsURLAcceptableForWebUI( |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 return FlagsUI::GetFaviconResourceBytes(); | 340 return FlagsUI::GetFaviconResourceBytes(); |
336 | 341 |
337 if (page_url.host() == chrome::kChromeUISettingsHost) | 342 if (page_url.host() == chrome::kChromeUISettingsHost) |
338 return OptionsUI::GetFaviconResourceBytes(); | 343 return OptionsUI::GetFaviconResourceBytes(); |
339 | 344 |
340 if (page_url.host() == chrome::kChromeUIPluginsHost) | 345 if (page_url.host() == chrome::kChromeUIPluginsHost) |
341 return PluginsUI::GetFaviconResourceBytes(); | 346 return PluginsUI::GetFaviconResourceBytes(); |
342 | 347 |
343 return NULL; | 348 return NULL; |
344 } | 349 } |
OLD | NEW |