| 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/webui/web_ui_factory.h" | 5 #include "chrome/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/dom_ui/constrained_html_ui.h" | 9 #include "chrome/browser/dom_ui/constrained_html_ui.h" |
| 10 #include "chrome/browser/dom_ui/html_dialog_ui.h" | 10 #include "chrome/browser/dom_ui/html_dialog_ui.h" |
| 11 #include "chrome/browser/dom_ui/new_tab_ui.h" | 11 #include "chrome/browser/dom_ui/new_tab_ui.h" |
| 12 #include "chrome/browser/dom_ui/options/options_ui.h" | 12 #include "chrome/browser/dom_ui/options/options_ui.h" |
| 13 #include "chrome/browser/dom_ui/print_preview_ui.h" | 13 #include "chrome/browser/dom_ui/print_preview_ui.h" |
| 14 #include "chrome/browser/dom_ui/sync_internals_ui.h" | 14 #include "chrome/browser/dom_ui/sync_internals_ui.h" |
| 15 #include "chrome/browser/dom_ui/textfields_ui.h" | 15 #include "chrome/browser/dom_ui/textfields_ui.h" |
| 16 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
| 17 #include "chrome/browser/extensions/extension_web_ui.h" | 17 #include "chrome/browser/extensions/extension_web_ui.h" |
| 18 #include "chrome/browser/extensions/extensions_ui.h" | 18 #include "chrome/browser/extensions/extensions_ui.h" |
| 19 #include "chrome/browser/printing/print_dialog_cloud.h" | 19 #include "chrome/browser/printing/print_dialog_cloud.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/tab_contents/tab_contents.h" | 21 #include "chrome/browser/tab_contents/tab_contents.h" |
| 22 #include "chrome/browser/webui/bookmarks_ui.h" | 22 #include "chrome/browser/webui/bookmarks_ui.h" |
| 23 #include "chrome/browser/webui/bug_report_ui.h" | 23 #include "chrome/browser/webui/bug_report_ui.h" |
| 24 #include "chrome/browser/webui/crashes_ui.h" |
| 24 #include "chrome/browser/webui/devtools_ui.h" | 25 #include "chrome/browser/webui/devtools_ui.h" |
| 25 #include "chrome/browser/webui/downloads_ui.h" | 26 #include "chrome/browser/webui/downloads_ui.h" |
| 26 #include "chrome/browser/webui/flags_ui.h" | 27 #include "chrome/browser/webui/flags_ui.h" |
| 27 #include "chrome/browser/webui/gpu_internals_ui.h" | 28 #include "chrome/browser/webui/gpu_internals_ui.h" |
| 28 #include "chrome/browser/webui/history2_ui.h" | 29 #include "chrome/browser/webui/history2_ui.h" |
| 29 #include "chrome/browser/webui/history_ui.h" | 30 #include "chrome/browser/webui/history_ui.h" |
| 30 #include "chrome/browser/webui/net_internals_ui.h" | 31 #include "chrome/browser/webui/net_internals_ui.h" |
| 31 #include "chrome/browser/webui/plugins_ui.h" | 32 #include "chrome/browser/webui/plugins_ui.h" |
| 32 #include "chrome/browser/webui/remoting_ui.h" | 33 #include "chrome/browser/webui/remoting_ui.h" |
| 33 #include "chrome/browser/webui/slideshow_ui.h" | 34 #include "chrome/browser/webui/slideshow_ui.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // Give about:about a generic Web UI so it can navigate to pages with Web UIs. | 134 // Give about:about a generic Web UI so it can navigate to pages with Web UIs. |
| 134 if (url.spec() == chrome::kChromeUIAboutAboutURL) | 135 if (url.spec() == chrome::kChromeUIAboutAboutURL) |
| 135 return &NewWebUI<WebUI>; | 136 return &NewWebUI<WebUI>; |
| 136 | 137 |
| 137 // We must compare hosts only since some of the Web UIs append extra stuff | 138 // We must compare hosts only since some of the Web UIs append extra stuff |
| 138 // after the host name. | 139 // after the host name. |
| 139 if (url.host() == chrome::kChromeUIBookmarksHost) | 140 if (url.host() == chrome::kChromeUIBookmarksHost) |
| 140 return &NewWebUI<BookmarksUI>; | 141 return &NewWebUI<BookmarksUI>; |
| 141 if (url.host() == chrome::kChromeUIBugReportHost) | 142 if (url.host() == chrome::kChromeUIBugReportHost) |
| 142 return &NewWebUI<BugReportUI>; | 143 return &NewWebUI<BugReportUI>; |
| 144 if (url.host() == chrome::kChromeUICrashesHost) |
| 145 return &NewWebUI<CrashesUI>; |
| 143 if (url.host() == chrome::kChromeUIDevToolsHost) | 146 if (url.host() == chrome::kChromeUIDevToolsHost) |
| 144 return &NewWebUI<DevToolsUI>; | 147 return &NewWebUI<DevToolsUI>; |
| 145 #if defined(OS_WIN) | 148 #if defined(OS_WIN) |
| 146 if (url.host() == chrome::kChromeUIConflictsHost) | 149 if (url.host() == chrome::kChromeUIConflictsHost) |
| 147 return &NewWebUI<ConflictsUI>; | 150 return &NewWebUI<ConflictsUI>; |
| 148 #endif | 151 #endif |
| 149 if (url.host() == chrome::kChromeUIDownloadsHost) | 152 if (url.host() == chrome::kChromeUIDownloadsHost) |
| 150 return &NewWebUI<DownloadsUI>; | 153 return &NewWebUI<DownloadsUI>; |
| 151 if (url.host() == chrome::kChromeUITextfieldsHost) | 154 if (url.host() == chrome::kChromeUITextfieldsHost) |
| 152 return &NewWebUI<TextfieldsUI>; | 155 return &NewWebUI<TextfieldsUI>; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 } | 311 } |
| 309 | 312 |
| 310 if (!HasWebUIScheme(page_url)) | 313 if (!HasWebUIScheme(page_url)) |
| 311 return NULL; | 314 return NULL; |
| 312 | 315 |
| 313 #if defined(OS_WIN) | 316 #if defined(OS_WIN) |
| 314 if (page_url.host() == chrome::kChromeUIConflictsHost) | 317 if (page_url.host() == chrome::kChromeUIConflictsHost) |
| 315 return ConflictsUI::GetFaviconResourceBytes(); | 318 return ConflictsUI::GetFaviconResourceBytes(); |
| 316 #endif | 319 #endif |
| 317 | 320 |
| 321 if (page_url.host() == chrome::kChromeUICrashesHost) |
| 322 return CrashesUI::GetFaviconResourceBytes(); |
| 323 |
| 318 if (page_url.host() == chrome::kChromeUIDownloadsHost) | 324 if (page_url.host() == chrome::kChromeUIDownloadsHost) |
| 319 return DownloadsUI::GetFaviconResourceBytes(); | 325 return DownloadsUI::GetFaviconResourceBytes(); |
| 320 | 326 |
| 321 if (page_url.host() == chrome::kChromeUIExtensionsHost) | 327 if (page_url.host() == chrome::kChromeUIExtensionsHost) |
| 322 return ExtensionsUI::GetFaviconResourceBytes(); | 328 return ExtensionsUI::GetFaviconResourceBytes(); |
| 323 | 329 |
| 324 if (page_url.host() == chrome::kChromeUIHistoryHost) | 330 if (page_url.host() == chrome::kChromeUIHistoryHost) |
| 325 return HistoryUI::GetFaviconResourceBytes(); | 331 return HistoryUI::GetFaviconResourceBytes(); |
| 326 | 332 |
| 327 if (page_url.host() == chrome::kChromeUIHistory2Host) | 333 if (page_url.host() == chrome::kChromeUIHistory2Host) |
| 328 return HistoryUI2::GetFaviconResourceBytes(); | 334 return HistoryUI2::GetFaviconResourceBytes(); |
| 329 | 335 |
| 330 if (page_url.host() == chrome::kChromeUIFlagsHost) | 336 if (page_url.host() == chrome::kChromeUIFlagsHost) |
| 331 return FlagsUI::GetFaviconResourceBytes(); | 337 return FlagsUI::GetFaviconResourceBytes(); |
| 332 | 338 |
| 333 if (page_url.host() == chrome::kChromeUISettingsHost) | 339 if (page_url.host() == chrome::kChromeUISettingsHost) |
| 334 return OptionsUI::GetFaviconResourceBytes(); | 340 return OptionsUI::GetFaviconResourceBytes(); |
| 335 | 341 |
| 336 if (page_url.host() == chrome::kChromeUIPluginsHost) | 342 if (page_url.host() == chrome::kChromeUIPluginsHost) |
| 337 return PluginsUI::GetFaviconResourceBytes(); | 343 return PluginsUI::GetFaviconResourceBytes(); |
| 338 | 344 |
| 339 #if defined(ENABLE_REMOTING) | 345 #if defined(ENABLE_REMOTING) |
| 340 if (page_url.host() == chrome::kChromeUIRemotingHost) | 346 if (page_url.host() == chrome::kChromeUIRemotingHost) |
| 341 return RemotingUI::GetFaviconResourceBytes(); | 347 return RemotingUI::GetFaviconResourceBytes(); |
| 342 #endif | 348 #endif |
| 343 | 349 |
| 344 return NULL; | 350 return NULL; |
| 345 } | 351 } |
| OLD | NEW |