| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "chrome/browser/about_flags.h" | 12 #include "chrome/browser/about_flags.h" |
| 13 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" | 13 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" |
| 14 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" | 14 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" |
| 15 #include "chrome/browser/extensions/extension_web_ui.h" | 15 #include "chrome/browser/extensions/extension_web_ui.h" |
| 16 #include "chrome/browser/favicon/favicon_service.h" |
| 16 #include "chrome/browser/history/history_types.h" | 17 #include "chrome/browser/history/history_types.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 19 #include "chrome/browser/ui/webui/about_ui.h" | 20 #include "chrome/browser/ui/webui/about_ui.h" |
| 20 #include "chrome/browser/ui/webui/app_launcher_page_ui.h" | 21 #include "chrome/browser/ui/webui/app_launcher_page_ui.h" |
| 21 #include "chrome/browser/ui/webui/bookmarks_ui.h" | 22 #include "chrome/browser/ui/webui/bookmarks_ui.h" |
| 22 #include "chrome/browser/ui/webui/components_ui.h" | 23 #include "chrome/browser/ui/webui/components_ui.h" |
| 23 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" | 24 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" |
| 24 #include "chrome/browser/ui/webui/crashes_ui.h" | 25 #include "chrome/browser/ui/webui/crashes_ui.h" |
| 25 #include "chrome/browser/ui/webui/devtools_ui.h" | 26 #include "chrome/browser/ui/webui/devtools_ui.h" |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 | 513 |
| 513 if (IsEnableDomDistillerSet() && | 514 if (IsEnableDomDistillerSet() && |
| 514 url.host() == dom_distiller::kChromeUIDomDistillerHost) { | 515 url.host() == dom_distiller::kChromeUIDomDistillerHost) { |
| 515 return &NewWebUI<dom_distiller::DomDistillerUi>; | 516 return &NewWebUI<dom_distiller::DomDistillerUi>; |
| 516 } | 517 } |
| 517 | 518 |
| 518 return NULL; | 519 return NULL; |
| 519 } | 520 } |
| 520 | 521 |
| 521 void RunFaviconCallbackAsync( | 522 void RunFaviconCallbackAsync( |
| 522 const FaviconService::FaviconResultsCallback& callback, | 523 const favicon_base::FaviconResultsCallback& callback, |
| 523 const std::vector<favicon_base::FaviconBitmapResult>* results) { | 524 const std::vector<favicon_base::FaviconBitmapResult>* results) { |
| 524 base::MessageLoopProxy::current()->PostTask( | 525 base::MessageLoopProxy::current()->PostTask( |
| 525 FROM_HERE, | 526 FROM_HERE, |
| 526 base::Bind(&FaviconService::FaviconResultsCallbackRunner, | 527 base::Bind(&FaviconService::FaviconResultsCallbackRunner, |
| 527 callback, base::Owned(results))); | 528 callback, base::Owned(results))); |
| 528 } | 529 } |
| 529 | 530 |
| 530 } // namespace | 531 } // namespace |
| 531 | 532 |
| 532 WebUI::TypeID ChromeWebUIControllerFactory::GetWebUIType( | 533 WebUI::TypeID ChromeWebUIControllerFactory::GetWebUIType( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 558 if (!function) | 559 if (!function) |
| 559 return NULL; | 560 return NULL; |
| 560 | 561 |
| 561 return (*function)(web_ui, url); | 562 return (*function)(web_ui, url); |
| 562 } | 563 } |
| 563 | 564 |
| 564 void ChromeWebUIControllerFactory::GetFaviconForURL( | 565 void ChromeWebUIControllerFactory::GetFaviconForURL( |
| 565 Profile* profile, | 566 Profile* profile, |
| 566 const GURL& page_url, | 567 const GURL& page_url, |
| 567 const std::vector<ui::ScaleFactor>& scale_factors, | 568 const std::vector<ui::ScaleFactor>& scale_factors, |
| 568 const FaviconService::FaviconResultsCallback& callback) const { | 569 const favicon_base::FaviconResultsCallback& callback) const { |
| 569 // Before determining whether page_url is an extension url, we must handle | 570 // Before determining whether page_url is an extension url, we must handle |
| 570 // overrides. This changes urls in |kChromeUIScheme| to extension urls, and | 571 // overrides. This changes urls in |kChromeUIScheme| to extension urls, and |
| 571 // allows to use ExtensionWebUI::GetFaviconForURL. | 572 // allows to use ExtensionWebUI::GetFaviconForURL. |
| 572 GURL url(page_url); | 573 GURL url(page_url); |
| 573 ExtensionWebUI::HandleChromeURLOverride(&url, profile); | 574 ExtensionWebUI::HandleChromeURLOverride(&url, profile); |
| 574 | 575 |
| 575 // All extensions but the bookmark manager get their favicon from the icons | 576 // All extensions but the bookmark manager get their favicon from the icons |
| 576 // part of the manifest. | 577 // part of the manifest. |
| 577 if (url.SchemeIs(extensions::kExtensionScheme) && | 578 if (url.SchemeIs(extensions::kExtensionScheme) && |
| 578 url.host() != extension_misc::kBookmarkManagerId) { | 579 url.host() != extension_misc::kBookmarkManagerId) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 #endif | 682 #endif |
| 682 | 683 |
| 683 // Android doesn't use the plugins pages. | 684 // Android doesn't use the plugins pages. |
| 684 if (page_url.host() == chrome::kChromeUIPluginsHost) | 685 if (page_url.host() == chrome::kChromeUIPluginsHost) |
| 685 return PluginsUI::GetFaviconResourceBytes(scale_factor); | 686 return PluginsUI::GetFaviconResourceBytes(scale_factor); |
| 686 | 687 |
| 687 #endif | 688 #endif |
| 688 | 689 |
| 689 return NULL; | 690 return NULL; |
| 690 } | 691 } |
| OLD | NEW |