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

Unified Diff: ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.mm

Issue 2609363003: Remove ChromeBrowserProvider::GetFaviconForURL(). (Closed)
Patch Set: Remove incorrect include and obsolete deps. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.mm
diff --git a/ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.mm b/ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.mm
index 3488abefda2f61b9fdfcab9ef7d4c53a33667588..cf1df759faae4e85494d69fd4b786429d320797f 100644
--- a/ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.mm
+++ b/ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.mm
@@ -6,10 +6,6 @@
#include "base/bind.h"
#include "base/location.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "components/favicon/core/favicon_service.h"
-#include "components/favicon_base/favicon_types.h"
-#include "components/favicon_base/select_favicon_frames.h"
#include "ios/chrome/browser/chrome_url_constants.h"
#include "ios/chrome/browser/experimental_flags.h"
#include "ios/chrome/browser/ui/webui/about_ui.h"
@@ -24,7 +20,6 @@
#include "ios/chrome/browser/ui/webui/signin_internals_ui_ios.h"
#include "ios/chrome/browser/ui/webui/sync_internals/sync_internals_ui.h"
#include "ios/chrome/browser/ui/webui/version_ui.h"
-#include "ui/gfx/favicon_size.h"
#include "url/gurl.h"
using web::WebUIIOS;
@@ -91,23 +86,9 @@ WebUIIOSFactoryFunction GetWebUIIOSFactoryFunction(WebUIIOS* web_ui,
if (url_host == kChromeUIAppleFlagsHost)
return &NewWebUIIOS<AppleFlagsUI>;
- // NOTE: It's possible that |url| is a WebUI URL that will be handled by
- // ChromeWebUIControllerFactory. Once the iOS port is no longer using
- // ChromeWebUIControllerFactory, there should be a DLOG here noting that
- // |url| is an unknown WebUI URL.
-
return nullptr;
}
-void RunFaviconCallbackAsync(
- const favicon_base::FaviconResultsCallback& callback,
- const std::vector<favicon_base::FaviconRawBitmapResult>* results) {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE,
- base::Bind(&favicon::FaviconService::FaviconResultsCallbackRunner,
- callback, base::Owned(results)));
-}
-
} // namespace
WebUIIOSController*
@@ -130,67 +111,3 @@ ChromeWebUIIOSControllerFactory::GetInstance() {
ChromeWebUIIOSControllerFactory::ChromeWebUIIOSControllerFactory() {}
ChromeWebUIIOSControllerFactory::~ChromeWebUIIOSControllerFactory() {}
-
-void ChromeWebUIIOSControllerFactory::GetFaviconForURL(
- ios::ChromeBrowserState* browser_state,
- const GURL& page_url,
- const std::vector<int>& desired_sizes_in_pixel,
- const favicon_base::FaviconResultsCallback& callback) const {
- GURL url(page_url);
-
- std::vector<favicon_base::FaviconRawBitmapResult>* favicon_bitmap_results =
- new std::vector<favicon_base::FaviconRawBitmapResult>();
-
- // Use ui::GetSupportedScaleFactors instead of
- // favicon_base::GetFaviconScales() because chrome favicons comes from
- // resources.
- std::vector<ui::ScaleFactor> resource_scale_factors =
- ui::GetSupportedScaleFactors();
-
- std::vector<gfx::Size> candidate_sizes;
- for (size_t i = 0; i < resource_scale_factors.size(); ++i) {
- float scale = ui::GetScaleForScaleFactor(resource_scale_factors[i]);
- int candidate_edge_size =
- static_cast<int>(gfx::kFaviconSize * scale + 0.5f);
- candidate_sizes.push_back(
- gfx::Size(candidate_edge_size, candidate_edge_size));
- }
- std::vector<size_t> selected_indices;
- SelectFaviconFrameIndices(candidate_sizes, desired_sizes_in_pixel,
- &selected_indices, nullptr);
- for (size_t i = 0; i < selected_indices.size(); ++i) {
- size_t selected_index = selected_indices[i];
- ui::ScaleFactor selected_resource_scale =
- resource_scale_factors[selected_index];
-
- scoped_refptr<base::RefCountedMemory> bitmap(
- GetFaviconResourceBytes(url, selected_resource_scale));
- if (bitmap.get() && bitmap->size()) {
- favicon_base::FaviconRawBitmapResult bitmap_result;
- bitmap_result.bitmap_data = bitmap;
- // Leave |bitmap_result|'s icon URL as the default of GURL().
- bitmap_result.icon_type = favicon_base::FAVICON;
- bitmap_result.pixel_size = candidate_sizes[selected_index];
- favicon_bitmap_results->push_back(bitmap_result);
- }
- }
-
- RunFaviconCallbackAsync(callback, favicon_bitmap_results);
-}
-
-base::RefCountedMemory*
-ChromeWebUIIOSControllerFactory::GetFaviconResourceBytes(
- const GURL& page_url,
- ui::ScaleFactor scale_factor) const {
- if (!page_url.SchemeIs(kChromeUIScheme))
- return nullptr;
-
- if (page_url.host_piece() == kChromeUICrashesHost)
- return CrashesUI::GetFaviconResourceBytes(scale_factor);
- if (page_url.host_piece() == kChromeUIFlagsHost)
- return FlagsUI::GetFaviconResourceBytes(scale_factor);
- if (page_url.host_piece() == kChromeUIAppleFlagsHost)
- return AppleFlagsUI::GetFaviconResourceBytes(scale_factor);
-
- return nullptr;
-}
« no previous file with comments | « ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.h ('k') | ios/chrome/browser/ui/webui/crashes_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698