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

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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 WebUIController* controller = (*function)(web_ui, url); 418 WebUIController* controller = (*function)(web_ui, url);
419 if (controller) 419 if (controller)
420 web_ui->AddMessageHandler(new GenericHandler()); 420 web_ui->AddMessageHandler(new GenericHandler());
421 return controller; 421 return controller;
422 } 422 }
423 423
424 void ChromeWebUIControllerFactory::GetFaviconForURL( 424 void ChromeWebUIControllerFactory::GetFaviconForURL(
425 Profile* profile, 425 Profile* profile,
426 FaviconService::GetFaviconRequest* request, 426 FaviconService::GetFaviconRequest* request,
427 const GURL& page_url) const { 427 const GURL& page_url) const {
428 // Before determining whether page_url is an extension url, we must handle
429 // overrides. This changes urls in |kChromeUIScheme| to extension urls, and
430 // allows to use ExtensionWebUI::GetFaviconForURL.
431 GURL url(page_url);
432 ExtensionWebUI::HandleChromeURLOverride(&url, profile);
433
428 // All extensions but the bookmark manager get their favicon from the icons 434 // All extensions but the bookmark manager get their favicon from the icons
429 // part of the manifest. 435 // part of the manifest.
430 if (page_url.SchemeIs(chrome::kExtensionScheme) && 436 if (url.SchemeIs(chrome::kExtensionScheme) &&
431 page_url.host() != extension_misc::kBookmarkManagerId) { 437 url.host() != extension_misc::kBookmarkManagerId) {
432 ExtensionWebUI::GetFaviconForURL(profile, request, page_url); 438 ExtensionWebUI::GetFaviconForURL(profile, request, url);
433 } else { 439 } else {
434 history::FaviconData favicon; 440 history::FaviconData favicon;
435 favicon.image_data = scoped_refptr<RefCountedMemory>( 441 favicon.image_data = scoped_refptr<RefCountedMemory>(
436 GetFaviconResourceBytes(page_url)); 442 GetFaviconResourceBytes(url));
437 favicon.known_icon = favicon.image_data.get() != NULL && 443 favicon.known_icon = favicon.image_data.get() != NULL &&
438 favicon.image_data->size() > 0; 444 favicon.image_data->size() > 0;
439 favicon.icon_type = history::FAVICON; 445 favicon.icon_type = history::FAVICON;
440 request->ForwardResultAsync(request->handle(), favicon); 446 request->ForwardResultAsync(request->handle(), favicon);
441 } 447 }
442 } 448 }
443 449
444 // static 450 // static
445 ChromeWebUIControllerFactory* ChromeWebUIControllerFactory::GetInstance() { 451 ChromeWebUIControllerFactory* ChromeWebUIControllerFactory::GetInstance() {
446 return Singleton< ChromeWebUIControllerFactory, PossibleTestSingletonTraits< 452 return Singleton< ChromeWebUIControllerFactory, PossibleTestSingletonTraits<
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 // Android doesn't use the Options pages. 504 // Android doesn't use the Options pages.
499 if (page_url.host() == chrome::kChromeUISettingsFrameHost) 505 if (page_url.host() == chrome::kChromeUISettingsFrameHost)
500 return options2::OptionsUI::GetFaviconResourceBytes(); 506 return options2::OptionsUI::GetFaviconResourceBytes();
501 #endif 507 #endif
502 508
503 if (page_url.host() == chrome::kChromeUIPluginsHost) 509 if (page_url.host() == chrome::kChromeUIPluginsHost)
504 return PluginsUI::GetFaviconResourceBytes(); 510 return PluginsUI::GetFaviconResourceBytes();
505 511
506 return NULL; 512 return NULL;
507 } 513 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698