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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 #include "components/favicon/core/favicon_service.h" | 61 #include "components/favicon/core/favicon_service.h" |
62 #include "components/favicon_base/favicon_util.h" | 62 #include "components/favicon_base/favicon_util.h" |
63 #include "components/favicon_base/select_favicon_frames.h" | 63 #include "components/favicon_base/select_favicon_frames.h" |
64 #include "components/history/core/browser/history_types.h" | 64 #include "components/history/core/browser/history_types.h" |
65 #include "components/password_manager/core/common/password_manager_switches.h" | 65 #include "components/password_manager/core/common/password_manager_switches.h" |
66 #include "components/signin/core/common/profile_management_switches.h" | 66 #include "components/signin/core/common/profile_management_switches.h" |
67 #include "content/public/browser/web_contents.h" | 67 #include "content/public/browser/web_contents.h" |
68 #include "content/public/browser/web_ui.h" | 68 #include "content/public/browser/web_ui.h" |
69 #include "content/public/common/content_client.h" | 69 #include "content/public/common/content_client.h" |
70 #include "content/public/common/url_utils.h" | 70 #include "content/public/common/url_utils.h" |
71 #include "grit/browser_resources.h" | |
71 #include "ui/gfx/favicon_size.h" | 72 #include "ui/gfx/favicon_size.h" |
72 #include "ui/oobe/oobe_md_ui.h" | 73 #include "ui/oobe/oobe_md_ui.h" |
73 #include "ui/web_dialogs/web_dialog_ui.h" | 74 #include "ui/web_dialogs/web_dialog_ui.h" |
74 #include "url/gurl.h" | 75 #include "url/gurl.h" |
75 | 76 |
76 #if !defined(DISABLE_NACL) | 77 #if !defined(DISABLE_NACL) |
77 #include "chrome/browser/ui/webui/nacl_ui.h" | 78 #include "chrome/browser/ui/webui/nacl_ui.h" |
78 #endif | 79 #endif |
79 | 80 |
80 #if defined(ENABLE_CONFIGURATION_POLICY) | 81 #if defined(ENABLE_CONFIGURATION_POLICY) |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 return new ExtensionWebUI(web_ui, url); | 206 return new ExtensionWebUI(web_ui, url); |
206 } | 207 } |
207 #endif // defined(ENABLE_EXTENSIONS) | 208 #endif // defined(ENABLE_EXTENSIONS) |
208 | 209 |
209 // Special case for older about: handlers. | 210 // Special case for older about: handlers. |
210 template<> | 211 template<> |
211 WebUIController* NewWebUI<AboutUI>(WebUI* web_ui, const GURL& url) { | 212 WebUIController* NewWebUI<AboutUI>(WebUI* web_ui, const GURL& url) { |
212 return new AboutUI(web_ui, url.host()); | 213 return new AboutUI(web_ui, url.host()); |
213 } | 214 } |
214 | 215 |
216 class CrElementsUI : public content::WebUIController { | |
michaelpg
2015/05/14 03:05:11
This is weird. I'd prefer you create a new file.
| |
217 public: | |
218 explicit CrElementsUI(content::WebUI* web_ui) | |
219 : content::WebUIController(web_ui) { | |
220 content::WebUIDataSource* html = | |
221 content::WebUIDataSource::Create(chrome::kChromeUICrElementsHost); | |
222 html->SetDefaultResource(IDR_CR_ELEMENTS_UI_HTML); | |
223 html->AddResourcePath("cr_elements_ui.js", IDR_CR_ELEMENTS_UI_JS); | |
224 | |
225 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), | |
226 html); | |
227 } | |
228 ~CrElementsUI() override {} | |
229 | |
230 private: | |
231 DISALLOW_COPY_AND_ASSIGN(CrElementsUI); | |
232 }; | |
233 | |
215 #if defined(OS_CHROMEOS) | 234 #if defined(OS_CHROMEOS) |
216 template<> | 235 template<> |
217 WebUIController* NewWebUI<chromeos::OobeUI>(WebUI* web_ui, const GURL& url) { | 236 WebUIController* NewWebUI<chromeos::OobeUI>(WebUI* web_ui, const GURL& url) { |
218 return new chromeos::OobeUI(web_ui, url); | 237 return new chromeos::OobeUI(web_ui, url); |
219 } | 238 } |
220 | 239 |
221 template <> | 240 template <> |
222 WebUIController* NewWebUI<OobeMdUI>(WebUI* web_ui, const GURL& url) { | 241 WebUIController* NewWebUI<OobeMdUI>(WebUI* web_ui, const GURL& url) { |
223 chromeos::Oobe::Register(); | 242 chromeos::Oobe::Register(); |
224 return new OobeMdUI(web_ui, url.host()); | 243 return new OobeMdUI(web_ui, url.host()); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
305 // dialog as backup. It's just that on Chrome OS, it's the only | 324 // dialog as backup. It's just that on Chrome OS, it's the only |
306 // print dialog. | 325 // print dialog. |
307 if (url.host() == chrome::kChromeUICloudPrintResourcesHost) | 326 if (url.host() == chrome::kChromeUICloudPrintResourcesHost) |
308 return &NewWebUI<ExternalWebDialogUI>; | 327 return &NewWebUI<ExternalWebDialogUI>; |
309 if (url.host() == chrome::kChromeUICloudPrintSetupHost) | 328 if (url.host() == chrome::kChromeUICloudPrintSetupHost) |
310 return &NewWebUI<WebDialogUI>; | 329 return &NewWebUI<WebDialogUI>; |
311 if (url.host() == chrome::kChromeUIComponentsHost) | 330 if (url.host() == chrome::kChromeUIComponentsHost) |
312 return &NewWebUI<ComponentsUI>; | 331 return &NewWebUI<ComponentsUI>; |
313 if (url.spec() == chrome::kChromeUIConstrainedHTMLTestURL) | 332 if (url.spec() == chrome::kChromeUIConstrainedHTMLTestURL) |
314 return &NewWebUI<ConstrainedWebDialogUI>; | 333 return &NewWebUI<ConstrainedWebDialogUI>; |
334 if (url.host() == chrome::kChromeUICrElementsHost) | |
335 return &NewWebUI<CrElementsUI>; | |
315 if (url.host() == chrome::kChromeUICrashesHost) | 336 if (url.host() == chrome::kChromeUICrashesHost) |
316 return &NewWebUI<CrashesUI>; | 337 return &NewWebUI<CrashesUI>; |
317 if (url.host() == chrome::kChromeUIDeviceLogHost) | 338 if (url.host() == chrome::kChromeUIDeviceLogHost) |
318 return &NewWebUI<chromeos::DeviceLogUI>; | 339 return &NewWebUI<chromeos::DeviceLogUI>; |
319 if (url.host() == chrome::kChromeUIDomainReliabilityInternalsHost) | 340 if (url.host() == chrome::kChromeUIDomainReliabilityInternalsHost) |
320 return &NewWebUI<DomainReliabilityInternalsUI>; | 341 return &NewWebUI<DomainReliabilityInternalsUI>; |
321 if (url.host() == chrome::kChromeUIFlagsHost) | 342 if (url.host() == chrome::kChromeUIFlagsHost) |
322 return &NewWebUI<FlagsUI>; | 343 return &NewWebUI<FlagsUI>; |
323 if (url.host() == chrome::kChromeUIHistoryFrameHost) | 344 if (url.host() == chrome::kChromeUIHistoryFrameHost) |
324 return &NewWebUI<HistoryUI>; | 345 return &NewWebUI<HistoryUI>; |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
756 #endif | 777 #endif |
757 | 778 |
758 // Android doesn't use the plugins pages. | 779 // Android doesn't use the plugins pages. |
759 if (page_url.host() == chrome::kChromeUIPluginsHost) | 780 if (page_url.host() == chrome::kChromeUIPluginsHost) |
760 return PluginsUI::GetFaviconResourceBytes(scale_factor); | 781 return PluginsUI::GetFaviconResourceBytes(scale_factor); |
761 | 782 |
762 #endif | 783 #endif |
763 | 784 |
764 return NULL; | 785 return NULL; |
765 } | 786 } |
OLD | NEW |