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

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

Powered by Google App Engine
This is Rietveld 408576698