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

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

Issue 10186001: Revert 133427 - 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
434 // All extensions but the bookmark manager get their favicon from the icons 428 // All extensions but the bookmark manager get their favicon from the icons
435 // part of the manifest. 429 // part of the manifest.
436 if (url.SchemeIs(chrome::kExtensionScheme) && 430 if (page_url.SchemeIs(chrome::kExtensionScheme) &&
437 url.host() != extension_misc::kBookmarkManagerId) { 431 page_url.host() != extension_misc::kBookmarkManagerId) {
438 ExtensionWebUI::GetFaviconForURL(profile, request, url); 432 ExtensionWebUI::GetFaviconForURL(profile, request, page_url);
439 } else { 433 } else {
440 history::FaviconData favicon; 434 history::FaviconData favicon;
441 favicon.image_data = scoped_refptr<RefCountedMemory>( 435 favicon.image_data = scoped_refptr<RefCountedMemory>(
442 GetFaviconResourceBytes(url)); 436 GetFaviconResourceBytes(page_url));
443 favicon.known_icon = favicon.image_data.get() != NULL && 437 favicon.known_icon = favicon.image_data.get() != NULL &&
444 favicon.image_data->size() > 0; 438 favicon.image_data->size() > 0;
445 favicon.icon_type = history::FAVICON; 439 favicon.icon_type = history::FAVICON;
446 request->ForwardResultAsync(request->handle(), favicon); 440 request->ForwardResultAsync(request->handle(), favicon);
447 } 441 }
448 } 442 }
449 443
450 // static 444 // static
451 ChromeWebUIControllerFactory* ChromeWebUIControllerFactory::GetInstance() { 445 ChromeWebUIControllerFactory* ChromeWebUIControllerFactory::GetInstance() {
452 return Singleton< ChromeWebUIControllerFactory, PossibleTestSingletonTraits< 446 return Singleton< ChromeWebUIControllerFactory, PossibleTestSingletonTraits<
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 if (page_url.host() == chrome::kChromeUISettingsFrameHost) 499 if (page_url.host() == chrome::kChromeUISettingsFrameHost)
506 return options2::OptionsUI::GetFaviconResourceBytes(); 500 return options2::OptionsUI::GetFaviconResourceBytes();
507 501
508 // Android doesn't use the plugins pages. 502 // Android doesn't use the plugins pages.
509 if (page_url.host() == chrome::kChromeUIPluginsHost) 503 if (page_url.host() == chrome::kChromeUIPluginsHost)
510 return PluginsUI::GetFaviconResourceBytes(); 504 return PluginsUI::GetFaviconResourceBytes();
511 #endif 505 #endif
512 506
513 return NULL; 507 return NULL;
514 } 508 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698