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

Side by Side Diff: trunk/src/chrome/browser/favicon/favicon_service.cc

Issue 370663002: Revert 281304 "Pass an instance of FaviconClient to FaviconService." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 5 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/favicon/favicon_service.h" 5 #include "chrome/browser/favicon/favicon_service.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/hash.h" 9 #include "base/hash.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 std::vector<float> scales = favicon_base::GetFaviconScales(); 70 std::vector<float> scales = favicon_base::GetFaviconScales();
71 std::vector<int> sizes_in_pixel; 71 std::vector<int> sizes_in_pixel;
72 for (size_t i = 0; i < scales.size(); ++i) { 72 for (size_t i = 0; i < scales.size(); ++i) {
73 sizes_in_pixel.push_back(std::ceil(size_in_dip * scales[i])); 73 sizes_in_pixel.push_back(std::ceil(size_in_dip * scales[i]));
74 } 74 }
75 return sizes_in_pixel; 75 return sizes_in_pixel;
76 } 76 }
77 77
78 } // namespace 78 } // namespace
79 79
80 FaviconService::FaviconService(Profile* profile, FaviconClient* favicon_client) 80 FaviconService::FaviconService(Profile* profile)
81 : history_service_( 81 : history_service_(HistoryServiceFactory::GetForProfile(
82 HistoryServiceFactory::GetForProfile(profile, 82 profile, Profile::EXPLICIT_ACCESS)),
83 Profile::EXPLICIT_ACCESS)), 83 profile_(profile) {
84 profile_(profile),
85 favicon_client_(favicon_client) {
86 } 84 }
87 85
88 // static 86 // static
89 void FaviconService::FaviconResultsCallbackRunner( 87 void FaviconService::FaviconResultsCallbackRunner(
90 const favicon_base::FaviconResultsCallback& callback, 88 const favicon_base::FaviconResultsCallback& callback,
91 const std::vector<favicon_base::FaviconRawBitmapResult>* results) { 89 const std::vector<favicon_base::FaviconRawBitmapResult>* results) {
92 callback.Run(*results); 90 callback.Run(*results);
93 } 91 }
94 92
95 base::CancelableTaskTracker::TaskId FaviconService::GetFaviconImage( 93 base::CancelableTaskTracker::TaskId FaviconService::GetFaviconImage(
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false, 431 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false,
434 &resized_bitmap_data)) { 432 &resized_bitmap_data)) {
435 callback.Run(favicon_base::FaviconRawBitmapResult()); 433 callback.Run(favicon_base::FaviconRawBitmapResult());
436 return; 434 return;
437 } 435 }
438 436
439 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( 437 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector(
440 &resized_bitmap_data); 438 &resized_bitmap_data);
441 callback.Run(bitmap_result); 439 callback.Run(bitmap_result);
442 } 440 }
OLDNEW
« no previous file with comments | « trunk/src/chrome/browser/favicon/favicon_service.h ('k') | trunk/src/chrome/browser/favicon/favicon_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698