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

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, 3 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 std::vector<history::FaviconBitmapResult> favicon_bitmap_results;
484 GetFaviconResourceBytes(url)); 484 if (bitmap.get() && bitmap->size()) {
485 favicon.known_icon = favicon.image_data.get() != NULL && 485 history::FaviconBitmapResult bitmap_result;
486 favicon.image_data->size() > 0; 486 bitmap_result.bitmap_data = bitmap;
487 favicon.icon_type = history::FAVICON; 487 bitmap_result.icon_type = history::FAVICON;
488 request->ForwardResultAsync(request->handle(), favicon); 488 favicon_bitmap_results.push_back(bitmap_result);
489 }
490 request->ForwardResultAsync(request->handle(), favicon_bitmap_results,
491 history::IconURLSizesMap());
489 } 492 }
490 } 493 }
491 494
492 // static 495 // static
493 ChromeWebUIControllerFactory* ChromeWebUIControllerFactory::GetInstance() { 496 ChromeWebUIControllerFactory* ChromeWebUIControllerFactory::GetInstance() {
494 return Singleton< ChromeWebUIControllerFactory, PossibleTestSingletonTraits< 497 return Singleton< ChromeWebUIControllerFactory, PossibleTestSingletonTraits<
495 ChromeWebUIControllerFactory, TestChromeWebUIControllerFactory> >::get(); 498 ChromeWebUIControllerFactory, TestChromeWebUIControllerFactory> >::get();
496 } 499 }
497 500
498 ChromeWebUIControllerFactory::ChromeWebUIControllerFactory() { 501 ChromeWebUIControllerFactory::ChromeWebUIControllerFactory() {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 if (page_url.host() == chrome::kChromeUISettingsFrameHost) 547 if (page_url.host() == chrome::kChromeUISettingsFrameHost)
545 return options::OptionsUI::GetFaviconResourceBytes(); 548 return options::OptionsUI::GetFaviconResourceBytes();
546 549
547 // Android doesn't use the plugins pages. 550 // Android doesn't use the plugins pages.
548 if (page_url.host() == chrome::kChromeUIPluginsHost) 551 if (page_url.host() == chrome::kChromeUIPluginsHost)
549 return PluginsUI::GetFaviconResourceBytes(); 552 return PluginsUI::GetFaviconResourceBytes();
550 #endif 553 #endif
551 554
552 return NULL; 555 return NULL;
553 } 556 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698