OLD | NEW |
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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 GURL url(page_url); | 428 GURL url(page_url); |
429 ExtensionWebUI::HandleChromeURLOverride(&url, profile); | 429 ExtensionWebUI::HandleChromeURLOverride(&url, profile); |
430 | 430 |
431 // 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 |
432 // part of the manifest. | 432 // part of the manifest. |
433 if (url.SchemeIs(chrome::kExtensionScheme) && | 433 if (url.SchemeIs(chrome::kExtensionScheme) && |
434 url.host() != extension_misc::kBookmarkManagerId) { | 434 url.host() != extension_misc::kBookmarkManagerId) { |
435 ExtensionWebUI::GetFaviconForURL(profile, request, url); | 435 ExtensionWebUI::GetFaviconForURL(profile, request, url); |
436 } else { | 436 } else { |
437 history::FaviconData favicon; | 437 history::FaviconData favicon; |
438 favicon.image_data = scoped_refptr<RefCountedMemory>( | 438 favicon.image_data = scoped_refptr<base::RefCountedMemory>( |
439 GetFaviconResourceBytes(url)); | 439 GetFaviconResourceBytes(url)); |
440 favicon.known_icon = favicon.image_data.get() != NULL && | 440 favicon.known_icon = favicon.image_data.get() != NULL && |
441 favicon.image_data->size() > 0; | 441 favicon.image_data->size() > 0; |
442 favicon.icon_type = history::FAVICON; | 442 favicon.icon_type = history::FAVICON; |
443 request->ForwardResultAsync(request->handle(), favicon); | 443 request->ForwardResultAsync(request->handle(), favicon); |
444 } | 444 } |
445 } | 445 } |
446 | 446 |
447 // static | 447 // static |
448 ChromeWebUIControllerFactory* ChromeWebUIControllerFactory::GetInstance() { | 448 ChromeWebUIControllerFactory* ChromeWebUIControllerFactory::GetInstance() { |
449 return Singleton< ChromeWebUIControllerFactory, PossibleTestSingletonTraits< | 449 return Singleton< ChromeWebUIControllerFactory, PossibleTestSingletonTraits< |
450 ChromeWebUIControllerFactory, TestChromeWebUIControllerFactory> >::get(); | 450 ChromeWebUIControllerFactory, TestChromeWebUIControllerFactory> >::get(); |
451 } | 451 } |
452 | 452 |
453 ChromeWebUIControllerFactory::ChromeWebUIControllerFactory() { | 453 ChromeWebUIControllerFactory::ChromeWebUIControllerFactory() { |
454 } | 454 } |
455 | 455 |
456 ChromeWebUIControllerFactory::~ChromeWebUIControllerFactory() { | 456 ChromeWebUIControllerFactory::~ChromeWebUIControllerFactory() { |
457 } | 457 } |
458 | 458 |
459 RefCountedMemory* ChromeWebUIControllerFactory::GetFaviconResourceBytes( | 459 base::RefCountedMemory* ChromeWebUIControllerFactory::GetFaviconResourceBytes( |
460 const GURL& page_url) const { | 460 const GURL& page_url) const { |
461 // The bookmark manager is a chrome extension, so we have to check for it | 461 // The bookmark manager is a chrome extension, so we have to check for it |
462 // before we check for extension scheme. | 462 // before we check for extension scheme. |
463 if (page_url.host() == extension_misc::kBookmarkManagerId) | 463 if (page_url.host() == extension_misc::kBookmarkManagerId) |
464 return BookmarksUI::GetFaviconResourceBytes(); | 464 return BookmarksUI::GetFaviconResourceBytes(); |
465 | 465 |
466 // The extension scheme is handled in GetFaviconForURL. | 466 // The extension scheme is handled in GetFaviconForURL. |
467 if (page_url.SchemeIs(chrome::kExtensionScheme)) { | 467 if (page_url.SchemeIs(chrome::kExtensionScheme)) { |
468 NOTREACHED(); | 468 NOTREACHED(); |
469 return NULL; | 469 return NULL; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 if (page_url.host() == chrome::kChromeUISettingsFrameHost) | 502 if (page_url.host() == chrome::kChromeUISettingsFrameHost) |
503 return options2::OptionsUI::GetFaviconResourceBytes(); | 503 return options2::OptionsUI::GetFaviconResourceBytes(); |
504 | 504 |
505 // Android doesn't use the plugins pages. | 505 // Android doesn't use the plugins pages. |
506 if (page_url.host() == chrome::kChromeUIPluginsHost) | 506 if (page_url.host() == chrome::kChromeUIPluginsHost) |
507 return PluginsUI::GetFaviconResourceBytes(); | 507 return PluginsUI::GetFaviconResourceBytes(); |
508 #endif | 508 #endif |
509 | 509 |
510 return NULL; | 510 return NULL; |
511 } | 511 } |
OLD | NEW |