OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_controller_factory.h" | 5 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 #include "chrome/browser/ui/webui/signin_internals_ui.h" | 48 #include "chrome/browser/ui/webui/signin_internals_ui.h" |
49 #include "chrome/browser/ui/webui/sync_internals_ui.h" | 49 #include "chrome/browser/ui/webui/sync_internals_ui.h" |
50 #include "chrome/browser/ui/webui/translate_internals/translate_internals_ui.h" | 50 #include "chrome/browser/ui/webui/translate_internals/translate_internals_ui.h" |
51 #include "chrome/browser/ui/webui/user_actions/user_actions_ui.h" | 51 #include "chrome/browser/ui/webui/user_actions/user_actions_ui.h" |
52 #include "chrome/browser/ui/webui/version_ui.h" | 52 #include "chrome/browser/ui/webui/version_ui.h" |
53 #include "chrome/common/chrome_switches.h" | 53 #include "chrome/common/chrome_switches.h" |
54 #include "chrome/common/extensions/extension_constants.h" | 54 #include "chrome/common/extensions/extension_constants.h" |
55 #include "chrome/common/extensions/feature_switch.h" | 55 #include "chrome/common/extensions/feature_switch.h" |
56 #include "chrome/common/pref_names.h" | 56 #include "chrome/common/pref_names.h" |
57 #include "chrome/common/url_constants.h" | 57 #include "chrome/common/url_constants.h" |
58 #include "components/dom_distiller/webui/dom_distiller_ui.h" | |
58 #include "content/public/browser/web_contents.h" | 59 #include "content/public/browser/web_contents.h" |
59 #include "content/public/browser/web_ui.h" | 60 #include "content/public/browser/web_ui.h" |
60 #include "content/public/common/content_client.h" | 61 #include "content/public/common/content_client.h" |
61 #include "content/public/common/url_utils.h" | 62 #include "content/public/common/url_utils.h" |
62 #include "extensions/common/constants.h" | 63 #include "extensions/common/constants.h" |
63 #include "ui/gfx/favicon_size.h" | 64 #include "ui/gfx/favicon_size.h" |
64 #include "ui/web_dialogs/web_dialog_ui.h" | 65 #include "ui/web_dialogs/web_dialog_ui.h" |
65 #include "url/gurl.h" | 66 #include "url/gurl.h" |
66 | 67 |
67 #if !defined(DISABLE_NACL) | 68 #if !defined(DISABLE_NACL) |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 return new T(web_ui); | 153 return new T(web_ui); |
153 } | 154 } |
154 | 155 |
155 // Special cases for extensions. | 156 // Special cases for extensions. |
156 template<> | 157 template<> |
157 WebUIController* NewWebUI<ExtensionWebUI>(WebUI* web_ui, | 158 WebUIController* NewWebUI<ExtensionWebUI>(WebUI* web_ui, |
158 const GURL& url) { | 159 const GURL& url) { |
159 return new ExtensionWebUI(web_ui, url); | 160 return new ExtensionWebUI(web_ui, url); |
160 } | 161 } |
161 | 162 |
163 // Special case for DOM distiller. | |
Evan Stade
2013/09/10 21:41:16
you should not put this in between the other two e
nyquist
2013/09/10 22:11:41
Done.
| |
164 template<> | |
165 WebUIController* NewWebUI<dom_distiller::DomDistillerUI>(WebUI* web_ui, | |
166 const GURL& url) { | |
167 return new dom_distiller::DomDistillerUI(web_ui, | |
168 url, | |
169 chrome::kChromeUIDomDistillerHost); | |
170 } | |
171 | |
162 template<> | 172 template<> |
163 WebUIController* NewWebUI<extensions::ExtensionInfoUI>(WebUI* web_ui, | 173 WebUIController* NewWebUI<extensions::ExtensionInfoUI>(WebUI* web_ui, |
164 const GURL& url) { | 174 const GURL& url) { |
165 return new extensions::ExtensionInfoUI(web_ui, url); | 175 return new extensions::ExtensionInfoUI(web_ui, url); |
166 } | 176 } |
167 | 177 |
168 // Special case for older about: handlers. | 178 // Special case for older about: handlers. |
169 template<> | 179 template<> |
170 WebUIController* NewWebUI<AboutUI>(WebUI* web_ui, const GURL& url) { | 180 WebUIController* NewWebUI<AboutUI>(WebUI* web_ui, const GURL& url) { |
171 return new AboutUI(web_ui, url.host()); | 181 return new AboutUI(web_ui, url.host()); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 return &NewWebUI<ConstrainedWebDialogUI>; | 240 return &NewWebUI<ConstrainedWebDialogUI>; |
231 if (url.host() == chrome::kChromeUICrashesHost) | 241 if (url.host() == chrome::kChromeUICrashesHost) |
232 return &NewWebUI<CrashesUI>; | 242 return &NewWebUI<CrashesUI>; |
233 #if defined(ENABLE_MDNS) | 243 #if defined(ENABLE_MDNS) |
234 if (url.host() == chrome::kChromeUIDevicesFrameHost && | 244 if (url.host() == chrome::kChromeUIDevicesFrameHost && |
235 !CommandLine::ForCurrentProcess()->HasSwitch( | 245 !CommandLine::ForCurrentProcess()->HasSwitch( |
236 switches::kDisableDeviceDiscovery)) { | 246 switches::kDisableDeviceDiscovery)) { |
237 return &NewWebUI<LocalDiscoveryUI>; | 247 return &NewWebUI<LocalDiscoveryUI>; |
238 } | 248 } |
239 #endif | 249 #endif |
250 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
251 switches::kEnableDomDistiller) && | |
252 url.host() == chrome::kChromeUIDomDistillerHost) { | |
253 return &NewWebUI<dom_distiller::DomDistillerUI>; | |
254 } | |
240 if (url.host() == chrome::kChromeUIFlagsHost) | 255 if (url.host() == chrome::kChromeUIFlagsHost) |
241 return &NewWebUI<FlagsUI>; | 256 return &NewWebUI<FlagsUI>; |
242 if (url.host() == chrome::kChromeUIHistoryFrameHost) | 257 if (url.host() == chrome::kChromeUIHistoryFrameHost) |
243 return &NewWebUI<HistoryUI>; | 258 return &NewWebUI<HistoryUI>; |
244 if (url.host() == chrome::kChromeUIInlineLoginHost) | 259 if (url.host() == chrome::kChromeUIInlineLoginHost) |
245 return &NewWebUI<InlineLoginUI>; | 260 return &NewWebUI<InlineLoginUI>; |
246 if (url.host() == chrome::kChromeUIInstantHost) | 261 if (url.host() == chrome::kChromeUIInstantHost) |
247 return &NewWebUI<InstantUI>; | 262 return &NewWebUI<InstantUI>; |
248 if (url.host() == chrome::kChromeUIManagedUserPassphrasePageHost) | 263 if (url.host() == chrome::kChromeUIManagedUserPassphrasePageHost) |
249 return &NewWebUI<ConstrainedWebDialogUI>; | 264 return &NewWebUI<ConstrainedWebDialogUI>; |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
622 if (page_url.host() == chrome::kChromeUIPluginsHost) | 637 if (page_url.host() == chrome::kChromeUIPluginsHost) |
623 return PluginsUI::GetFaviconResourceBytes(scale_factor); | 638 return PluginsUI::GetFaviconResourceBytes(scale_factor); |
624 | 639 |
625 // Android doesn't use the components pages. | 640 // Android doesn't use the components pages. |
626 if (page_url.host() == chrome::kChromeUIComponentsHost) | 641 if (page_url.host() == chrome::kChromeUIComponentsHost) |
627 return ComponentsUI::GetFaviconResourceBytes(scale_factor); | 642 return ComponentsUI::GetFaviconResourceBytes(scale_factor); |
628 #endif | 643 #endif |
629 | 644 |
630 return NULL; | 645 return NULL; |
631 } | 646 } |
OLD | NEW |