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

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

Issue 10870022: Change FaviconData to be able to return data for multiple bitmaps for same icon URL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months 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 | Annotate | Revision Log
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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/about_flags.h" 8 #include "chrome/browser/about_flags.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_web_ui.h" 10 #include "chrome/browser/extensions/extension_web_ui.h"
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 // allows to use ExtensionWebUI::GetFaviconForURL. 472 // allows to use ExtensionWebUI::GetFaviconForURL.
473 GURL url(page_url); 473 GURL url(page_url);
474 ExtensionWebUI::HandleChromeURLOverride(&url, profile); 474 ExtensionWebUI::HandleChromeURLOverride(&url, profile);
475 475
476 // All extensions but the bookmark manager get their favicon from the icons 476 // All extensions but the bookmark manager get their favicon from the icons
477 // part of the manifest. 477 // part of the manifest.
478 if (url.SchemeIs(chrome::kExtensionScheme) && 478 if (url.SchemeIs(chrome::kExtensionScheme) &&
479 url.host() != extension_misc::kBookmarkManagerId) { 479 url.host() != extension_misc::kBookmarkManagerId) {
480 ExtensionWebUI::GetFaviconForURL(profile, request, url); 480 ExtensionWebUI::GetFaviconForURL(profile, request, url);
481 } else { 481 } else {
482 history::FaviconData favicon; 482 scoped_refptr<base::RefCountedMemory> bitmap(GetFaviconResourceBytes(url));
483 favicon.image_data = scoped_refptr<base::RefCountedMemory>( 483 history::FaviconBitmapData favicon_bitmap_data;
484 GetFaviconResourceBytes(url)); 484 favicon_bitmap_data.bitmap_data = bitmap;
485 favicon.known_icon = favicon.image_data.get() != NULL && 485 favicon_bitmap_data.pixel_size = gfx::Size();
486 favicon.image_data->size() > 0; 486 history::FaviconData favicon_data;
487 favicon.icon_type = history::FAVICON; 487 favicon_data.icon_type = history::FAVICON;
488 request->ForwardResultAsync(request->handle(), favicon); 488 favicon_data.bitmaps.push_back(favicon_bitmap_data);
489 request->ForwardResultAsync(request->handle(), favicon_data,
490 std::vector<GURL>());
489 } 491 }
490 } 492 }
491 493
492 // static 494 // static
493 ChromeWebUIControllerFactory* ChromeWebUIControllerFactory::GetInstance() { 495 ChromeWebUIControllerFactory* ChromeWebUIControllerFactory::GetInstance() {
494 return Singleton< ChromeWebUIControllerFactory, PossibleTestSingletonTraits< 496 return Singleton< ChromeWebUIControllerFactory, PossibleTestSingletonTraits<
495 ChromeWebUIControllerFactory, TestChromeWebUIControllerFactory> >::get(); 497 ChromeWebUIControllerFactory, TestChromeWebUIControllerFactory> >::get();
496 } 498 }
497 499
498 ChromeWebUIControllerFactory::ChromeWebUIControllerFactory() { 500 ChromeWebUIControllerFactory::ChromeWebUIControllerFactory() {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 if (page_url.host() == chrome::kChromeUISettingsFrameHost) 546 if (page_url.host() == chrome::kChromeUISettingsFrameHost)
545 return options::OptionsUI::GetFaviconResourceBytes(); 547 return options::OptionsUI::GetFaviconResourceBytes();
546 548
547 // Android doesn't use the plugins pages. 549 // Android doesn't use the plugins pages.
548 if (page_url.host() == chrome::kChromeUIPluginsHost) 550 if (page_url.host() == chrome::kChromeUIPluginsHost)
549 return PluginsUI::GetFaviconResourceBytes(); 551 return PluginsUI::GetFaviconResourceBytes();
550 #endif 552 #endif
551 553
552 return NULL; 554 return NULL;
553 } 555 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698