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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 #include "components/favicon/core/favicon_service.h" | 72 #include "components/favicon/core/favicon_service.h" |
73 #include "components/favicon_base/favicon_util.h" | 73 #include "components/favicon_base/favicon_util.h" |
74 #include "components/favicon_base/select_favicon_frames.h" | 74 #include "components/favicon_base/select_favicon_frames.h" |
75 #include "components/history/core/browser/history_types.h" | 75 #include "components/history/core/browser/history_types.h" |
76 #include "components/prefs/pref_service.h" | 76 #include "components/prefs/pref_service.h" |
77 #include "components/signin/core/common/profile_management_switches.h" | 77 #include "components/signin/core/common/profile_management_switches.h" |
78 #include "content/public/browser/web_contents.h" | 78 #include "content/public/browser/web_contents.h" |
79 #include "content/public/browser/web_ui.h" | 79 #include "content/public/browser/web_ui.h" |
80 #include "content/public/common/content_client.h" | 80 #include "content/public/common/content_client.h" |
81 #include "content/public/common/url_utils.h" | 81 #include "content/public/common/url_utils.h" |
| 82 #include "extensions/features/features.h" |
82 #include "printing/features/features.h" | 83 #include "printing/features/features.h" |
83 #include "ui/gfx/favicon_size.h" | 84 #include "ui/gfx/favicon_size.h" |
84 #include "ui/web_dialogs/web_dialog_ui.h" | 85 #include "ui/web_dialogs/web_dialog_ui.h" |
85 #include "url/gurl.h" | 86 #include "url/gurl.h" |
86 | 87 |
87 #if !defined(DISABLE_NACL) | 88 #if !defined(DISABLE_NACL) |
88 #include "chrome/browser/ui/webui/nacl_ui.h" | 89 #include "chrome/browser/ui/webui/nacl_ui.h" |
89 #endif | 90 #endif |
90 | 91 |
91 #if defined(ENABLE_WEBRTC) | 92 #if defined(ENABLE_WEBRTC) |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 #endif | 181 #endif |
181 | 182 |
182 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) | 183 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) |
183 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui.h" | 184 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui.h" |
184 #endif | 185 #endif |
185 | 186 |
186 #if BUILDFLAG(ENABLE_APP_LIST) | 187 #if BUILDFLAG(ENABLE_APP_LIST) |
187 #include "chrome/browser/ui/webui/app_list/start_page_ui.h" | 188 #include "chrome/browser/ui/webui/app_list/start_page_ui.h" |
188 #endif | 189 #endif |
189 | 190 |
190 #if defined(ENABLE_EXTENSIONS) | 191 #if BUILDFLAG(ENABLE_EXTENSIONS) |
191 #include "chrome/browser/extensions/extension_web_ui.h" | 192 #include "chrome/browser/extensions/extension_web_ui.h" |
192 #include "chrome/browser/ui/webui/extensions/extensions_ui.h" | 193 #include "chrome/browser/ui/webui/extensions/extensions_ui.h" |
193 #include "chrome/common/extensions/extension_constants.h" | 194 #include "chrome/common/extensions/extension_constants.h" |
194 #include "extensions/browser/extension_registry.h" | 195 #include "extensions/browser/extension_registry.h" |
195 #include "extensions/browser/extension_system.h" | 196 #include "extensions/browser/extension_system.h" |
196 #include "extensions/common/constants.h" | 197 #include "extensions/common/constants.h" |
197 #include "extensions/common/extension.h" | 198 #include "extensions/common/extension.h" |
198 #include "extensions/common/feature_switch.h" | 199 #include "extensions/common/feature_switch.h" |
199 #include "extensions/common/manifest.h" | 200 #include "extensions/common/manifest.h" |
200 #endif | 201 #endif |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 return &NewWebUI<PolicyUI>; | 571 return &NewWebUI<PolicyUI>; |
571 if (url.host() == chrome::kChromeUIMdPolicyHost && | 572 if (url.host() == chrome::kChromeUIMdPolicyHost && |
572 switches::MdPolicyPageEnabled()) { | 573 switches::MdPolicyPageEnabled()) { |
573 return &NewWebUI<PolicyMaterialDesignUI>; | 574 return &NewWebUI<PolicyMaterialDesignUI>; |
574 } | 575 } |
575 | 576 |
576 #if BUILDFLAG(ENABLE_APP_LIST) | 577 #if BUILDFLAG(ENABLE_APP_LIST) |
577 if (url.host() == chrome::kChromeUIAppListStartPageHost) | 578 if (url.host() == chrome::kChromeUIAppListStartPageHost) |
578 return &NewWebUI<app_list::StartPageUI>; | 579 return &NewWebUI<app_list::StartPageUI>; |
579 #endif | 580 #endif |
580 #if defined(ENABLE_EXTENSIONS) | 581 #if BUILDFLAG(ENABLE_EXTENSIONS) |
581 if (url.host() == chrome::kChromeUIExtensionsFrameHost) | 582 if (url.host() == chrome::kChromeUIExtensionsFrameHost) |
582 return &NewWebUI<extensions::ExtensionsUI>; | 583 return &NewWebUI<extensions::ExtensionsUI>; |
583 #endif | 584 #endif |
584 #if defined(ENABLE_PLUGINS) | 585 #if defined(ENABLE_PLUGINS) |
585 if (url.host() == chrome::kChromeUIFlashHost) | 586 if (url.host() == chrome::kChromeUIFlashHost) |
586 return &NewWebUI<FlashUI>; | 587 return &NewWebUI<FlashUI>; |
587 if (url.host() == chrome::kChromeUIPluginsHost) | 588 if (url.host() == chrome::kChromeUIPluginsHost) |
588 return &NewWebUI<PluginsUI>; | 589 return &NewWebUI<PluginsUI>; |
589 #endif | 590 #endif |
590 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | 591 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 | 677 |
677 void ChromeWebUIControllerFactory::GetFaviconForURL( | 678 void ChromeWebUIControllerFactory::GetFaviconForURL( |
678 Profile* profile, | 679 Profile* profile, |
679 const GURL& page_url, | 680 const GURL& page_url, |
680 const std::vector<int>& desired_sizes_in_pixel, | 681 const std::vector<int>& desired_sizes_in_pixel, |
681 const favicon_base::FaviconResultsCallback& callback) const { | 682 const favicon_base::FaviconResultsCallback& callback) const { |
682 // Before determining whether page_url is an extension url, we must handle | 683 // Before determining whether page_url is an extension url, we must handle |
683 // overrides. This changes urls in |kChromeUIScheme| to extension urls, and | 684 // overrides. This changes urls in |kChromeUIScheme| to extension urls, and |
684 // allows to use ExtensionWebUI::GetFaviconForURL. | 685 // allows to use ExtensionWebUI::GetFaviconForURL. |
685 GURL url(page_url); | 686 GURL url(page_url); |
686 #if defined(ENABLE_EXTENSIONS) | 687 #if BUILDFLAG(ENABLE_EXTENSIONS) |
687 ExtensionWebUI::HandleChromeURLOverride(&url, profile); | 688 ExtensionWebUI::HandleChromeURLOverride(&url, profile); |
688 | 689 |
689 // All extensions but the bookmark manager get their favicon from the icons | 690 // All extensions but the bookmark manager get their favicon from the icons |
690 // part of the manifest. | 691 // part of the manifest. |
691 if (url.SchemeIs(extensions::kExtensionScheme) && | 692 if (url.SchemeIs(extensions::kExtensionScheme) && |
692 url.host() != extension_misc::kBookmarkManagerId) { | 693 url.host() != extension_misc::kBookmarkManagerId) { |
693 ExtensionWebUI::GetFaviconForURL(profile, url, callback); | 694 ExtensionWebUI::GetFaviconForURL(profile, url, callback); |
694 return; | 695 return; |
695 } | 696 } |
696 #endif | 697 #endif |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 // Android uses the native download manager. | 800 // Android uses the native download manager. |
800 if (page_url.host() == chrome::kChromeUIDownloadsHost) | 801 if (page_url.host() == chrome::kChromeUIDownloadsHost) |
801 return MdDownloadsUI::GetFaviconResourceBytes(scale_factor); | 802 return MdDownloadsUI::GetFaviconResourceBytes(scale_factor); |
802 | 803 |
803 // Android doesn't use the Options/Settings pages. | 804 // Android doesn't use the Options/Settings pages. |
804 if (page_url.host() == chrome::kChromeUISettingsHost || | 805 if (page_url.host() == chrome::kChromeUISettingsHost || |
805 page_url.host() == chrome::kChromeUISettingsFrameHost || | 806 page_url.host() == chrome::kChromeUISettingsFrameHost || |
806 page_url.host() == chrome::kChromeUIMdSettingsHost) | 807 page_url.host() == chrome::kChromeUIMdSettingsHost) |
807 return settings_utils::GetFaviconResourceBytes(scale_factor); | 808 return settings_utils::GetFaviconResourceBytes(scale_factor); |
808 | 809 |
809 #if defined(ENABLE_EXTENSIONS) | 810 #if BUILDFLAG(ENABLE_EXTENSIONS) |
810 if (page_url.host() == chrome::kChromeUIExtensionsHost || | 811 if (page_url.host() == chrome::kChromeUIExtensionsHost || |
811 page_url.host() == chrome::kChromeUIExtensionsFrameHost) | 812 page_url.host() == chrome::kChromeUIExtensionsFrameHost) |
812 return extensions::ExtensionsUI::GetFaviconResourceBytes(scale_factor); | 813 return extensions::ExtensionsUI::GetFaviconResourceBytes(scale_factor); |
813 #endif | 814 #endif |
814 | 815 |
815 // Android doesn't use the plugins pages. | 816 // Android doesn't use the plugins pages. |
816 if (page_url.host() == chrome::kChromeUIPluginsHost) | 817 if (page_url.host() == chrome::kChromeUIPluginsHost) |
817 return PluginsUI::GetFaviconResourceBytes(scale_factor); | 818 return PluginsUI::GetFaviconResourceBytes(scale_factor); |
818 | 819 |
819 #endif | 820 #endif |
820 | 821 |
821 return NULL; | 822 return NULL; |
822 } | 823 } |
OLD | NEW |