Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc

Issue 2450623002: [MD Bookmarks] Add skeleton for Material Design Bookmarks (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 // Before determining whether page_url is an extension url, we must handle 707 // Before determining whether page_url is an extension url, we must handle
708 // overrides. This changes urls in |kChromeUIScheme| to extension urls, and 708 // overrides. This changes urls in |kChromeUIScheme| to extension urls, and
709 // allows to use ExtensionWebUI::GetFaviconForURL. 709 // allows to use ExtensionWebUI::GetFaviconForURL.
710 GURL url(page_url); 710 GURL url(page_url);
711 #if defined(ENABLE_EXTENSIONS) 711 #if defined(ENABLE_EXTENSIONS)
712 ExtensionWebUI::HandleChromeURLOverride(&url, profile); 712 ExtensionWebUI::HandleChromeURLOverride(&url, profile);
713 713
714 // All extensions but the bookmark manager get their favicon from the icons 714 // All extensions but the bookmark manager get their favicon from the icons
715 // part of the manifest. 715 // part of the manifest.
716 if (url.SchemeIs(extensions::kExtensionScheme) && 716 if (url.SchemeIs(extensions::kExtensionScheme) &&
717 url.host() != extension_misc::kBookmarkManagerId) { 717 url.host() != extension_misc::kBookmarkManagerId &&
718 url.host() != extension_misc::kMDBookmarkManagerId) {
718 ExtensionWebUI::GetFaviconForURL(profile, url, callback); 719 ExtensionWebUI::GetFaviconForURL(profile, url, callback);
719 return; 720 return;
720 } 721 }
721 #endif 722 #endif
722 723
723 std::vector<favicon_base::FaviconRawBitmapResult>* favicon_bitmap_results = 724 std::vector<favicon_base::FaviconRawBitmapResult>* favicon_bitmap_results =
724 new std::vector<favicon_base::FaviconRawBitmapResult>(); 725 new std::vector<favicon_base::FaviconRawBitmapResult>();
725 726
726 // Use ui::GetSupportedScaleFactors instead of 727 // Use ui::GetSupportedScaleFactors instead of
727 // favicon_base::GetFaviconScales() because chrome favicons comes from 728 // favicon_base::GetFaviconScales() because chrome favicons comes from
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 } 772 }
772 773
773 ChromeWebUIControllerFactory::~ChromeWebUIControllerFactory() { 774 ChromeWebUIControllerFactory::~ChromeWebUIControllerFactory() {
774 } 775 }
775 776
776 base::RefCountedMemory* ChromeWebUIControllerFactory::GetFaviconResourceBytes( 777 base::RefCountedMemory* ChromeWebUIControllerFactory::GetFaviconResourceBytes(
777 const GURL& page_url, ui::ScaleFactor scale_factor) const { 778 const GURL& page_url, ui::ScaleFactor scale_factor) const {
778 #if !defined(OS_ANDROID) // Bookmarks are part of NTP on Android. 779 #if !defined(OS_ANDROID) // Bookmarks are part of NTP on Android.
779 // The bookmark manager is a chrome extension, so we have to check for it 780 // The bookmark manager is a chrome extension, so we have to check for it
780 // before we check for extension scheme. 781 // before we check for extension scheme.
781 if (page_url.host() == extension_misc::kBookmarkManagerId) 782 if (page_url.host() == extension_misc::kBookmarkManagerId ||
783 page_url.host() == extension_misc::kMDBookmarkManagerId) {
782 return BookmarksUI::GetFaviconResourceBytes(scale_factor); 784 return BookmarksUI::GetFaviconResourceBytes(scale_factor);
785 }
783 786
784 // The extension scheme is handled in GetFaviconForURL. 787 // The extension scheme is handled in GetFaviconForURL.
785 if (page_url.SchemeIs(extensions::kExtensionScheme)) { 788 if (page_url.SchemeIs(extensions::kExtensionScheme)) {
786 NOTREACHED(); 789 NOTREACHED();
787 return NULL; 790 return NULL;
788 } 791 }
789 #endif 792 #endif
790 793
791 if (!content::HasWebUIScheme(page_url)) 794 if (!content::HasWebUIScheme(page_url))
792 return NULL; 795 return NULL;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 #endif 839 #endif
837 840
838 // Android doesn't use the plugins pages. 841 // Android doesn't use the plugins pages.
839 if (page_url.host() == chrome::kChromeUIPluginsHost) 842 if (page_url.host() == chrome::kChromeUIPluginsHost)
840 return PluginsUI::GetFaviconResourceBytes(scale_factor); 843 return PluginsUI::GetFaviconResourceBytes(scale_factor);
841 844
842 #endif 845 #endif
843 846
844 return NULL; 847 return NULL;
845 } 848 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698