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" | |
30 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 29 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
31 #include "chrome/browser/ui/webui/options/options_ui.h" | 30 #include "chrome/browser/ui/webui/options/options_ui.h" |
32 #include "chrome/browser/ui/webui/plugins_ui.h" | 31 #include "chrome/browser/ui/webui/plugins_ui.h" |
33 #include "chrome/browser/ui/webui/print_preview_ui.h" | 32 #include "chrome/browser/ui/webui/print_preview_ui.h" |
34 #include "chrome/browser/ui/webui/quota_internals_ui.h" | 33 #include "chrome/browser/ui/webui/quota_internals_ui.h" |
35 #include "chrome/browser/ui/webui/sessions_ui.h" | 34 #include "chrome/browser/ui/webui/sessions_ui.h" |
36 #include "chrome/browser/ui/webui/sync_internals_ui.h" | 35 #include "chrome/browser/ui/webui/sync_internals_ui.h" |
37 #include "chrome/browser/ui/webui/test_chrome_web_ui_factory.h" | 36 #include "chrome/browser/ui/webui/test_chrome_web_ui_factory.h" |
38 #include "chrome/browser/ui/webui/textfields_ui.h" | 37 #include "chrome/browser/ui/webui/textfields_ui.h" |
39 #include "chrome/common/chrome_switches.h" | 38 #include "chrome/common/chrome_switches.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 #else | 215 #else |
217 if (url.host() == chrome::kChromeUIPrintHost && | 216 if (url.host() == chrome::kChromeUIPrintHost && |
218 switches::IsPrintPreviewEnabled()) { | 217 switches::IsPrintPreviewEnabled()) { |
219 return &NewWebUI<PrintPreviewUI>; | 218 return &NewWebUI<PrintPreviewUI>; |
220 } | 219 } |
221 #endif // defined(OS_CHROMEOS) | 220 #endif // defined(OS_CHROMEOS) |
222 | 221 |
223 if (url.spec() == chrome::kChromeUIConstrainedHTMLTestURL) | 222 if (url.spec() == chrome::kChromeUIConstrainedHTMLTestURL) |
224 return &NewWebUI<ConstrainedHtmlUI>; | 223 return &NewWebUI<ConstrainedHtmlUI>; |
225 | 224 |
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 | |
233 return NULL; | 225 return NULL; |
234 } | 226 } |
235 | 227 |
236 // When the test-type switch is set, return a TestType object, which should be a | 228 // When the test-type switch is set, return a TestType object, which should be a |
237 // subclass of Type. The logic is provided here in the traits class, rather than | 229 // subclass of Type. The logic is provided here in the traits class, rather than |
238 // in GetInstance() so that the choice is made only once, when the Singleton is | 230 // in GetInstance() so that the choice is made only once, when the Singleton is |
239 // first instantiated, rather than every time GetInstance() is called. | 231 // first instantiated, rather than every time GetInstance() is called. |
240 template<typename Type, typename TestType> | 232 template<typename Type, typename TestType> |
241 struct PossibleTestSingletonTraits : public DefaultSingletonTraits<Type> { | 233 struct PossibleTestSingletonTraits : public DefaultSingletonTraits<Type> { |
242 static Type* New() { | 234 static Type* New() { |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 return FlashUI::GetFaviconResourceBytes(); | 365 return FlashUI::GetFaviconResourceBytes(); |
374 | 366 |
375 if (page_url.host() == chrome::kChromeUISettingsHost) | 367 if (page_url.host() == chrome::kChromeUISettingsHost) |
376 return OptionsUI::GetFaviconResourceBytes(); | 368 return OptionsUI::GetFaviconResourceBytes(); |
377 | 369 |
378 if (page_url.host() == chrome::kChromeUIPluginsHost) | 370 if (page_url.host() == chrome::kChromeUIPluginsHost) |
379 return PluginsUI::GetFaviconResourceBytes(); | 371 return PluginsUI::GetFaviconResourceBytes(); |
380 | 372 |
381 return NULL; | 373 return NULL; |
382 } | 374 } |
OLD | NEW |