| 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" |
| 11 #include "chrome/browser/extensions/extensions_ui.h" | 11 #include "chrome/browser/extensions/extensions_ui.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/webui/bookmarks_ui.h" | 13 #include "chrome/browser/ui/webui/bookmarks_ui.h" |
| 14 #include "chrome/browser/ui/webui/bug_report_ui.h" | 14 #include "chrome/browser/ui/webui/bug_report_ui.h" |
| 15 #include "chrome/browser/ui/webui/constrained_html_ui.h" | 15 #include "chrome/browser/ui/webui/constrained_html_ui.h" |
| 16 #include "chrome/browser/ui/webui/crashes_ui.h" | 16 #include "chrome/browser/ui/webui/crashes_ui.h" |
| 17 #include "chrome/browser/ui/webui/devtools_ui.h" | 17 #include "chrome/browser/ui/webui/devtools_ui.h" |
| 18 #include "chrome/browser/ui/webui/downloads_ui.h" | 18 #include "chrome/browser/ui/webui/downloads_ui.h" |
| 19 #include "chrome/browser/ui/webui/flags_ui.h" | 19 #include "chrome/browser/ui/webui/flags_ui.h" |
| 20 #include "chrome/browser/ui/webui/gpu_internals_ui.h" | 20 #include "chrome/browser/ui/webui/gpu_internals_ui.h" |
| 21 #include "chrome/browser/ui/webui/history2_ui.h" | 21 #include "chrome/browser/ui/webui/history2_ui.h" |
| 22 #include "chrome/browser/ui/webui/history_ui.h" | 22 #include "chrome/browser/ui/webui/history_ui.h" |
| 23 #include "chrome/browser/ui/webui/html_dialog_ui.h" | 23 #include "chrome/browser/ui/webui/html_dialog_ui.h" |
| 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/remoting_ui.h" | |
| 30 #include "chrome/browser/ui/webui/sync_internals_ui.h" | 29 #include "chrome/browser/ui/webui/sync_internals_ui.h" |
| 31 #include "chrome/browser/ui/webui/textfields_ui.h" | 30 #include "chrome/browser/ui/webui/textfields_ui.h" |
| 32 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 33 #include "chrome/common/extensions/extension_constants.h" | 32 #include "chrome/common/extensions/extension_constants.h" |
| 34 #include "chrome/common/url_constants.h" | 33 #include "chrome/common/url_constants.h" |
| 35 #include "content/browser/tab_contents/tab_contents.h" | 34 #include "content/browser/tab_contents/tab_contents.h" |
| 36 #include "content/browser/webui/web_ui.h" | 35 #include "content/browser/webui/web_ui.h" |
| 37 #include "googleurl/src/gurl.h" | 36 #include "googleurl/src/gurl.h" |
| 38 | 37 |
| 39 #if defined(OS_CHROMEOS) | 38 #if defined(OS_CHROMEOS) |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 return &NewWebUI<ExternalHtmlDialogUI>; | 107 return &NewWebUI<ExternalHtmlDialogUI>; |
| 109 | 108 |
| 110 // This will get called a lot to check all URLs, so do a quick check of other | 109 // This will get called a lot to check all URLs, so do a quick check of other |
| 111 // schemes to filter out most URLs. | 110 // schemes to filter out most URLs. |
| 112 if (!url.SchemeIs(chrome::kChromeDevToolsScheme) && | 111 if (!url.SchemeIs(chrome::kChromeDevToolsScheme) && |
| 113 !url.SchemeIs(chrome::kChromeInternalScheme) && | 112 !url.SchemeIs(chrome::kChromeInternalScheme) && |
| 114 !url.SchemeIs(chrome::kChromeUIScheme)) | 113 !url.SchemeIs(chrome::kChromeUIScheme)) |
| 115 return NULL; | 114 return NULL; |
| 116 | 115 |
| 117 if (url.host() == chrome::kChromeUISyncResourcesHost || | 116 if (url.host() == chrome::kChromeUISyncResourcesHost || |
| 118 url.host() == chrome::kChromeUIRemotingResourcesHost || | |
| 119 url.host() == chrome::kCloudPrintSetupHost) | 117 url.host() == chrome::kCloudPrintSetupHost) |
| 120 return &NewWebUI<HtmlDialogUI>; | 118 return &NewWebUI<HtmlDialogUI>; |
| 121 | 119 |
| 122 // Special case the new tab page. In older versions of Chrome, the new tab | 120 // Special case the new tab page. In older versions of Chrome, the new tab |
| 123 // page was hosted at chrome-internal:<blah>. This might be in people's saved | 121 // page was hosted at chrome-internal:<blah>. This might be in people's saved |
| 124 // sessions or bookmarks, so we say any URL with that scheme triggers the new | 122 // sessions or bookmarks, so we say any URL with that scheme triggers the new |
| 125 // tab page. | 123 // tab page. |
| 126 if (url.host() == chrome::kChromeUINewTabHost || | 124 if (url.host() == chrome::kChromeUINewTabHost || |
| 127 url.SchemeIs(chrome::kChromeInternalScheme)) | 125 url.SchemeIs(chrome::kChromeInternalScheme)) |
| 128 return &NewWebUI<NewTabUI>; | 126 return &NewWebUI<NewTabUI>; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 return &NewWebUI<KeyboardUI>; | 160 return &NewWebUI<KeyboardUI>; |
| 163 #endif | 161 #endif |
| 164 if (url.host() == chrome::kChromeUIGpuInternalsHost) | 162 if (url.host() == chrome::kChromeUIGpuInternalsHost) |
| 165 return &NewWebUI<GpuInternalsUI>; | 163 return &NewWebUI<GpuInternalsUI>; |
| 166 if (url.host() == chrome::kChromeUINetInternalsHost) | 164 if (url.host() == chrome::kChromeUINetInternalsHost) |
| 167 return &NewWebUI<NetInternalsUI>; | 165 return &NewWebUI<NetInternalsUI>; |
| 168 if (url.host() == chrome::kChromeUIPluginsHost) | 166 if (url.host() == chrome::kChromeUIPluginsHost) |
| 169 return &NewWebUI<PluginsUI>; | 167 return &NewWebUI<PluginsUI>; |
| 170 if (url.host() == chrome::kChromeUISyncInternalsHost) | 168 if (url.host() == chrome::kChromeUISyncInternalsHost) |
| 171 return &NewWebUI<SyncInternalsUI>; | 169 return &NewWebUI<SyncInternalsUI>; |
| 172 #if defined(ENABLE_REMOTING) | |
| 173 if (url.host() == chrome::kChromeUIRemotingHost) { | |
| 174 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 175 switches::kEnableRemoting)) { | |
| 176 return &NewWebUI<RemotingUI>; | |
| 177 } | |
| 178 } | |
| 179 #endif | |
| 180 | 170 |
| 181 #if defined(OS_CHROMEOS) | 171 #if defined(OS_CHROMEOS) |
| 182 if (url.host() == chrome::kChromeUIChooseMobileNetworkHost) | 172 if (url.host() == chrome::kChromeUIChooseMobileNetworkHost) |
| 183 return &NewWebUI<chromeos::ChooseMobileNetworkUI>; | 173 return &NewWebUI<chromeos::ChooseMobileNetworkUI>; |
| 184 if (url.host() == chrome::kChromeUICollectedCookiesHost || | 174 if (url.host() == chrome::kChromeUICollectedCookiesHost || |
| 185 url.host() == chrome::kChromeUIHttpAuthHost) { | 175 url.host() == chrome::kChromeUIHttpAuthHost) { |
| 186 return &NewWebUI<ConstrainedHtmlUI>; | 176 return &NewWebUI<ConstrainedHtmlUI>; |
| 187 } | 177 } |
| 188 if (url.host() == chrome::kChromeUIActiveDownloadsHost) | 178 if (url.host() == chrome::kChromeUIActiveDownloadsHost) |
| 189 return &NewWebUI<ActiveDownloadsUI>; | 179 return &NewWebUI<ActiveDownloadsUI>; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 | 335 |
| 346 if (page_url.host() == chrome::kChromeUIFlagsHost) | 336 if (page_url.host() == chrome::kChromeUIFlagsHost) |
| 347 return FlagsUI::GetFaviconResourceBytes(); | 337 return FlagsUI::GetFaviconResourceBytes(); |
| 348 | 338 |
| 349 if (page_url.host() == chrome::kChromeUISettingsHost) | 339 if (page_url.host() == chrome::kChromeUISettingsHost) |
| 350 return OptionsUI::GetFaviconResourceBytes(); | 340 return OptionsUI::GetFaviconResourceBytes(); |
| 351 | 341 |
| 352 if (page_url.host() == chrome::kChromeUIPluginsHost) | 342 if (page_url.host() == chrome::kChromeUIPluginsHost) |
| 353 return PluginsUI::GetFaviconResourceBytes(); | 343 return PluginsUI::GetFaviconResourceBytes(); |
| 354 | 344 |
| 355 #if defined(ENABLE_REMOTING) | |
| 356 if (page_url.host() == chrome::kChromeUIRemotingHost) | |
| 357 return RemotingUI::GetFaviconResourceBytes(); | |
| 358 #endif | |
| 359 | |
| 360 return NULL; | 345 return NULL; |
| 361 } | 346 } |
| OLD | NEW |