Chromium Code Reviews| 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/history/history_types.h" | 12 #include "chrome/browser/history/history_types.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/webui/bookmarks_ui.h" | 14 #include "chrome/browser/ui/webui/bookmarks_ui.h" |
| 15 #include "chrome/browser/ui/webui/bug_report_ui.h" | 15 #include "chrome/browser/ui/webui/bug_report_ui.h" |
| 16 #include "chrome/browser/ui/webui/constrained_html_ui.h" | 16 #include "chrome/browser/ui/webui/constrained_html_ui.h" |
| 17 #include "chrome/browser/ui/webui/crashes_ui.h" | 17 #include "chrome/browser/ui/webui/crashes_ui.h" |
| 18 #include "chrome/browser/ui/webui/devtools_ui.h" | 18 #include "chrome/browser/ui/webui/devtools_ui.h" |
| 19 #include "chrome/browser/ui/webui/downloads_ui.h" | 19 #include "chrome/browser/ui/webui/downloads_ui.h" |
| 20 #include "chrome/browser/ui/webui/task_manager_ui.h" | 20 #include "chrome/browser/ui/webui/task_manager_ui.h" |
| 21 #include "chrome/browser/ui/webui/flags_ui.h" | 21 #include "chrome/browser/ui/webui/flags_ui.h" |
| 22 #include "chrome/browser/ui/webui/flash_ui.h" | 22 #include "chrome/browser/ui/webui/flash_ui.h" |
| 23 #include "chrome/browser/ui/webui/gpu_internals_ui.h" | 23 #include "chrome/browser/ui/webui/gpu_internals_ui.h" |
| 24 #include "chrome/browser/ui/webui/history2_ui.h" | 24 #include "chrome/browser/ui/webui/history2_ui.h" |
| 25 #include "chrome/browser/ui/webui/history_ui.h" | 25 #include "chrome/browser/ui/webui/history_ui.h" |
| 26 #include "chrome/browser/ui/webui/html_dialog_ui.h" | 26 #include "chrome/browser/ui/webui/html_dialog_ui.h" |
| 27 #include "chrome/browser/ui/webui/media_internals_ui.h" | 27 #include "chrome/browser/ui/webui/media_internals_ui.h" |
| 28 #include "chrome/browser/ui/webui/net_internals_ui.h" | 28 #include "chrome/browser/ui/webui/net_internals_ui.h" |
| 29 #include "chrome/browser/ui/webui/new_profile_ui.h" | |
|
James Hawkins
2011/06/30 23:02:58
If this is only used for OS_CHROMEOS, move this in
sail
2011/07/01 01:16:18
Done.
| |
| 29 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 30 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 30 #include "chrome/browser/ui/webui/options/options_ui.h" | 31 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 31 #include "chrome/browser/ui/webui/plugins_ui.h" | 32 #include "chrome/browser/ui/webui/plugins_ui.h" |
| 32 #include "chrome/browser/ui/webui/print_preview_ui.h" | 33 #include "chrome/browser/ui/webui/print_preview_ui.h" |
| 33 #include "chrome/browser/ui/webui/quota_internals_ui.h" | 34 #include "chrome/browser/ui/webui/quota_internals_ui.h" |
| 34 #include "chrome/browser/ui/webui/sessions_ui.h" | 35 #include "chrome/browser/ui/webui/sessions_ui.h" |
| 35 #include "chrome/browser/ui/webui/sync_internals_ui.h" | 36 #include "chrome/browser/ui/webui/sync_internals_ui.h" |
| 36 #include "chrome/browser/ui/webui/test_chrome_web_ui_factory.h" | 37 #include "chrome/browser/ui/webui/test_chrome_web_ui_factory.h" |
| 37 #include "chrome/browser/ui/webui/textfields_ui.h" | 38 #include "chrome/browser/ui/webui/textfields_ui.h" |
| 38 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 #else | 216 #else |
| 216 if (url.host() == chrome::kChromeUIPrintHost && | 217 if (url.host() == chrome::kChromeUIPrintHost && |
| 217 switches::IsPrintPreviewEnabled()) { | 218 switches::IsPrintPreviewEnabled()) { |
| 218 return &NewWebUI<PrintPreviewUI>; | 219 return &NewWebUI<PrintPreviewUI>; |
| 219 } | 220 } |
| 220 #endif // defined(OS_CHROMEOS) | 221 #endif // defined(OS_CHROMEOS) |
| 221 | 222 |
| 222 if (url.spec() == chrome::kChromeUIConstrainedHTMLTestURL) | 223 if (url.spec() == chrome::kChromeUIConstrainedHTMLTestURL) |
| 223 return &NewWebUI<ConstrainedHtmlUI>; | 224 return &NewWebUI<ConstrainedHtmlUI>; |
| 224 | 225 |
| 226 #if !defined(OS_CHROMEOS) | |
| 227 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles)) { | |
| 228 if (url.host() == chrome::kChromeUINewProfileHost) | |
| 229 return &NewWebUI<NewProfileUI>; | |
| 230 } | |
| 231 #endif | |
| 232 | |
| 225 return NULL; | 233 return NULL; |
| 226 } | 234 } |
| 227 | 235 |
| 228 // When the test-type switch is set, return a TestType object, which should be a | 236 // When the test-type switch is set, return a TestType object, which should be a |
| 229 // subclass of Type. The logic is provided here in the traits class, rather than | 237 // subclass of Type. The logic is provided here in the traits class, rather than |
| 230 // in GetInstance() so that the choice is made only once, when the Singleton is | 238 // in GetInstance() so that the choice is made only once, when the Singleton is |
| 231 // first instantiated, rather than every time GetInstance() is called. | 239 // first instantiated, rather than every time GetInstance() is called. |
| 232 template<typename Type, typename TestType> | 240 template<typename Type, typename TestType> |
| 233 struct PossibleTestSingletonTraits : public DefaultSingletonTraits<Type> { | 241 struct PossibleTestSingletonTraits : public DefaultSingletonTraits<Type> { |
| 234 static Type* New() { | 242 static Type* New() { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 365 return FlashUI::GetFaviconResourceBytes(); | 373 return FlashUI::GetFaviconResourceBytes(); |
| 366 | 374 |
| 367 if (page_url.host() == chrome::kChromeUISettingsHost) | 375 if (page_url.host() == chrome::kChromeUISettingsHost) |
| 368 return OptionsUI::GetFaviconResourceBytes(); | 376 return OptionsUI::GetFaviconResourceBytes(); |
| 369 | 377 |
| 370 if (page_url.host() == chrome::kChromeUIPluginsHost) | 378 if (page_url.host() == chrome::kChromeUIPluginsHost) |
| 371 return PluginsUI::GetFaviconResourceBytes(); | 379 return PluginsUI::GetFaviconResourceBytes(); |
| 372 | 380 |
| 373 return NULL; | 381 return NULL; |
| 374 } | 382 } |
| OLD | NEW |