| 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/flags_ui.h" | 20 #include "chrome/browser/ui/webui/flags_ui.h" |
| 21 #include "chrome/browser/ui/webui/flash_ui.h" | 21 #include "chrome/browser/ui/webui/flash_ui.h" |
| 22 #include "chrome/browser/ui/webui/gpu_internals_ui.h" | 22 #include "chrome/browser/ui/webui/gpu_internals_ui.h" |
| 23 #include "chrome/browser/ui/webui/history2_ui.h" | 23 #include "chrome/browser/ui/webui/history2_ui.h" |
| 24 #include "chrome/browser/ui/webui/history_ui.h" | 24 #include "chrome/browser/ui/webui/history_ui.h" |
| 25 #include "chrome/browser/ui/webui/html_dialog_ui.h" | 25 #include "chrome/browser/ui/webui/html_dialog_ui.h" |
| 26 #include "chrome/browser/ui/webui/net_internals_ui.h" | 26 #include "chrome/browser/ui/webui/net_internals_ui.h" |
| 27 #include "chrome/browser/ui/webui/new_profile_ui.h" |
| 27 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 28 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 28 #include "chrome/browser/ui/webui/options/options_ui.h" | 29 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 29 #include "chrome/browser/ui/webui/plugins_ui.h" | 30 #include "chrome/browser/ui/webui/plugins_ui.h" |
| 30 #include "chrome/browser/ui/webui/print_preview_ui.h" | 31 #include "chrome/browser/ui/webui/print_preview_ui.h" |
| 31 #include "chrome/browser/ui/webui/sessions_ui.h" | 32 #include "chrome/browser/ui/webui/sessions_ui.h" |
| 32 #include "chrome/browser/ui/webui/sync_internals_ui.h" | 33 #include "chrome/browser/ui/webui/sync_internals_ui.h" |
| 33 #include "chrome/browser/ui/webui/test_chrome_web_ui_factory.h" | 34 #include "chrome/browser/ui/webui/test_chrome_web_ui_factory.h" |
| 34 #include "chrome/browser/ui/webui/textfields_ui.h" | 35 #include "chrome/browser/ui/webui/textfields_ui.h" |
| 35 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" |
| 36 #include "chrome/common/extensions/extension_constants.h" | 37 #include "chrome/common/extensions/extension_constants.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 #else | 207 #else |
| 207 if (url.host() == chrome::kChromeUIPrintHost && | 208 if (url.host() == chrome::kChromeUIPrintHost && |
| 208 switches::IsPrintPreviewEnabled()) { | 209 switches::IsPrintPreviewEnabled()) { |
| 209 return &NewWebUI<PrintPreviewUI>; | 210 return &NewWebUI<PrintPreviewUI>; |
| 210 } | 211 } |
| 211 #endif // defined(OS_CHROMEOS) | 212 #endif // defined(OS_CHROMEOS) |
| 212 | 213 |
| 213 if (url.spec() == chrome::kChromeUIConstrainedHTMLTestURL) | 214 if (url.spec() == chrome::kChromeUIConstrainedHTMLTestURL) |
| 214 return &NewWebUI<ConstrainedHtmlUI>; | 215 return &NewWebUI<ConstrainedHtmlUI>; |
| 215 | 216 |
| 217 #if !defined(OS_CHROMEOS) |
| 218 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles)) { |
| 219 if (url.host() == chrome::kChromeUINewProfileHost) |
| 220 return &NewWebUI<NewProfileUI>; |
| 221 } |
| 222 #endif |
| 223 |
| 216 return NULL; | 224 return NULL; |
| 217 } | 225 } |
| 218 | 226 |
| 219 // When the test-type switch is set, return a TestType object, which should be a | 227 // When the test-type switch is set, return a TestType object, which should be a |
| 220 // subclass of Type. The logic is provided here in the traits class, rather than | 228 // subclass of Type. The logic is provided here in the traits class, rather than |
| 221 // in GetInstance() so that the choice is made only once, when the Singleton is | 229 // in GetInstance() so that the choice is made only once, when the Singleton is |
| 222 // first instantiated, rather than every time GetInstance() is called. | 230 // first instantiated, rather than every time GetInstance() is called. |
| 223 template<typename Type, typename TestType> | 231 template<typename Type, typename TestType> |
| 224 struct PossibleTestSingletonTraits : public DefaultSingletonTraits<Type> { | 232 struct PossibleTestSingletonTraits : public DefaultSingletonTraits<Type> { |
| 225 static Type* New() { | 233 static Type* New() { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 return FlashUI::GetFaviconResourceBytes(); | 364 return FlashUI::GetFaviconResourceBytes(); |
| 357 | 365 |
| 358 if (page_url.host() == chrome::kChromeUISettingsHost) | 366 if (page_url.host() == chrome::kChromeUISettingsHost) |
| 359 return OptionsUI::GetFaviconResourceBytes(); | 367 return OptionsUI::GetFaviconResourceBytes(); |
| 360 | 368 |
| 361 if (page_url.host() == chrome::kChromeUIPluginsHost) | 369 if (page_url.host() == chrome::kChromeUIPluginsHost) |
| 362 return PluginsUI::GetFaviconResourceBytes(); | 370 return PluginsUI::GetFaviconResourceBytes(); |
| 363 | 371 |
| 364 return NULL; | 372 return NULL; |
| 365 } | 373 } |
| OLD | NEW |