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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // may be NULL (for example, if the URL refers to an non-existent extension). | 152 // may be NULL (for example, if the URL refers to an non-existent extension). |
153 typedef WebUIController* (*WebUIFactoryFunction)(WebUI* web_ui, | 153 typedef WebUIController* (*WebUIFactoryFunction)(WebUI* web_ui, |
154 const GURL& url); | 154 const GURL& url); |
155 | 155 |
156 // Template for defining WebUIFactoryFunction. | 156 // Template for defining WebUIFactoryFunction. |
157 template<class T> | 157 template<class T> |
158 WebUIController* NewWebUI(WebUI* web_ui, const GURL& url) { | 158 WebUIController* NewWebUI(WebUI* web_ui, const GURL& url) { |
159 return new T(web_ui); | 159 return new T(web_ui); |
160 } | 160 } |
161 | 161 |
| 162 #if defined(ENABLE_EXTENSIONS) |
162 // Special cases for extensions. | 163 // Special cases for extensions. |
163 template<> | 164 template<> |
164 WebUIController* NewWebUI<ExtensionWebUI>(WebUI* web_ui, | 165 WebUIController* NewWebUI<ExtensionWebUI>(WebUI* web_ui, |
165 const GURL& url) { | 166 const GURL& url) { |
166 return new ExtensionWebUI(web_ui, url); | 167 return new ExtensionWebUI(web_ui, url); |
167 } | 168 } |
168 | 169 |
169 template<> | 170 template<> |
170 WebUIController* NewWebUI<extensions::ExtensionInfoUI>(WebUI* web_ui, | 171 WebUIController* NewWebUI<extensions::ExtensionInfoUI>(WebUI* web_ui, |
171 const GURL& url) { | 172 const GURL& url) { |
172 return new extensions::ExtensionInfoUI(web_ui, url); | 173 return new extensions::ExtensionInfoUI(web_ui, url); |
173 } | 174 } |
| 175 #endif // defined(ENABLE_EXTENSIONS) |
174 | 176 |
175 // Special case for older about: handlers. | 177 // Special case for older about: handlers. |
176 template<> | 178 template<> |
177 WebUIController* NewWebUI<AboutUI>(WebUI* web_ui, const GURL& url) { | 179 WebUIController* NewWebUI<AboutUI>(WebUI* web_ui, const GURL& url) { |
178 return new AboutUI(web_ui, url.host()); | 180 return new AboutUI(web_ui, url.host()); |
179 } | 181 } |
180 | 182 |
181 #if defined(OS_CHROMEOS) | 183 #if defined(OS_CHROMEOS) |
182 template<> | 184 template<> |
183 WebUIController* NewWebUI<chromeos::OobeUI>(WebUI* web_ui, const GURL& url) { | 185 WebUIController* NewWebUI<chromeos::OobeUI>(WebUI* web_ui, const GURL& url) { |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 if (page_url.host() == chrome::kChromeUIPluginsHost) | 647 if (page_url.host() == chrome::kChromeUIPluginsHost) |
646 return PluginsUI::GetFaviconResourceBytes(scale_factor); | 648 return PluginsUI::GetFaviconResourceBytes(scale_factor); |
647 | 649 |
648 // Android doesn't use the components pages. | 650 // Android doesn't use the components pages. |
649 if (page_url.host() == chrome::kChromeUIComponentsHost) | 651 if (page_url.host() == chrome::kChromeUIComponentsHost) |
650 return ComponentsUI::GetFaviconResourceBytes(scale_factor); | 652 return ComponentsUI::GetFaviconResourceBytes(scale_factor); |
651 #endif | 653 #endif |
652 | 654 |
653 return NULL; | 655 return NULL; |
654 } | 656 } |
OLD | NEW |