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

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

Issue 9979001: Attempt to load component extension favicon from the resources first. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 WebUIController* controller = (*function)(web_ui, url); 415 WebUIController* controller = (*function)(web_ui, url);
416 if (controller) 416 if (controller)
417 web_ui->AddMessageHandler(new GenericHandler()); 417 web_ui->AddMessageHandler(new GenericHandler());
418 return controller; 418 return controller;
419 } 419 }
420 420
421 void ChromeWebUIControllerFactory::GetFaviconForURL( 421 void ChromeWebUIControllerFactory::GetFaviconForURL(
422 Profile* profile, 422 Profile* profile,
423 FaviconService::GetFaviconRequest* request, 423 FaviconService::GetFaviconRequest* request,
424 const GURL& page_url) const { 424 const GURL& page_url) const {
425 GURL url(page_url);
426 ExtensionWebUI::HandleChromeURLOverride(&url, profile);
James Hawkins 2012/04/06 04:45:25 This needs an explanatory comment.
dgozman 2012/04/06 11:15:39 Done.
425 // All extensions but the bookmark manager get their favicon from the icons 427 // All extensions but the bookmark manager get their favicon from the icons
426 // part of the manifest. 428 // part of the manifest.
427 if (page_url.SchemeIs(chrome::kExtensionScheme) && 429 if (url.SchemeIs(chrome::kExtensionScheme) &&
428 page_url.host() != extension_misc::kBookmarkManagerId) { 430 url.host() != extension_misc::kBookmarkManagerId) {
429 ExtensionWebUI::GetFaviconForURL(profile, request, page_url); 431 ExtensionWebUI::GetFaviconForURL(profile, request, url);
430 } else { 432 } else {
431 history::FaviconData favicon; 433 history::FaviconData favicon;
432 favicon.image_data = scoped_refptr<RefCountedMemory>( 434 favicon.image_data = scoped_refptr<RefCountedMemory>(
433 GetFaviconResourceBytes(page_url)); 435 GetFaviconResourceBytes(url));
434 favicon.known_icon = favicon.image_data.get() != NULL && 436 favicon.known_icon = favicon.image_data.get() != NULL &&
435 favicon.image_data->size() > 0; 437 favicon.image_data->size() > 0;
436 favicon.icon_type = history::FAVICON; 438 favicon.icon_type = history::FAVICON;
437 request->ForwardResultAsync(request->handle(), favicon); 439 request->ForwardResultAsync(request->handle(), favicon);
438 } 440 }
439 } 441 }
440 442
441 // static 443 // static
442 ChromeWebUIControllerFactory* ChromeWebUIControllerFactory::GetInstance() { 444 ChromeWebUIControllerFactory* ChromeWebUIControllerFactory::GetInstance() {
443 return Singleton< ChromeWebUIControllerFactory, PossibleTestSingletonTraits< 445 return Singleton< ChromeWebUIControllerFactory, PossibleTestSingletonTraits<
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 // Android doesn't use the Options pages. 497 // Android doesn't use the Options pages.
496 if (page_url.host() == chrome::kChromeUISettingsFrameHost) 498 if (page_url.host() == chrome::kChromeUISettingsFrameHost)
497 return options2::OptionsUI::GetFaviconResourceBytes(); 499 return options2::OptionsUI::GetFaviconResourceBytes();
498 #endif 500 #endif
499 501
500 if (page_url.host() == chrome::kChromeUIPluginsHost) 502 if (page_url.host() == chrome::kChromeUIPluginsHost)
501 return PluginsUI::GetFaviconResourceBytes(); 503 return PluginsUI::GetFaviconResourceBytes();
502 504
503 return NULL; 505 return NULL;
504 } 506 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/image_loading_tracker.cc ('k') | chrome/browser/ui/webui/extensions/extension_icon_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698