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

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

Issue 56143002: Make FaviconService() use Porfile as parameter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unit test but break the DEPS Created 7 years, 1 month 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
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 "base/hash.h" 7 #include "base/hash.h"
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "chrome/browser/favicon/favicon_util.h" 9 #include "chrome/browser/favicon/favicon_util.h"
10 #include "chrome/browser/history/history_backend.h" 10 #include "chrome/browser/history/history_backend.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 CancelableTaskTracker::TaskId id = tracker->NewTrackedTaskId(&is_canceled_cb); 56 CancelableTaskTracker::TaskId id = tracker->NewTrackedTaskId(&is_canceled_cb);
57 FaviconService::FaviconResultsCallback cancelable_cb = 57 FaviconService::FaviconResultsCallback cancelable_cb =
58 Bind(&CancelOrRunFaviconResultsCallback, is_canceled_cb, callback); 58 Bind(&CancelOrRunFaviconResultsCallback, is_canceled_cb, callback);
59 ChromeWebUIControllerFactory::GetInstance()->GetFaviconForURL(profile, 59 ChromeWebUIControllerFactory::GetInstance()->GetFaviconForURL(profile,
60 page_url, desired_scale_factors, cancelable_cb); 60 page_url, desired_scale_factors, cancelable_cb);
61 return id; 61 return id;
62 } 62 }
63 63
64 } // namespace 64 } // namespace
65 65
66 FaviconService::FaviconService(HistoryService* history_service) 66 FaviconService::FaviconService(Profile* profile)
67 : history_service_(history_service) { 67 : history_service_(HistoryServiceFactory::GetForProfile(
68 profile, Profile::EXPLICIT_ACCESS)),
69 profile_(profile) {
68 } 70 }
69 71
70 // static 72 // static
71 void FaviconService::FaviconResultsCallbackRunner( 73 void FaviconService::FaviconResultsCallbackRunner(
72 const FaviconResultsCallback& callback, 74 const FaviconResultsCallback& callback,
73 const std::vector<chrome::FaviconBitmapResult>* results) { 75 const std::vector<chrome::FaviconBitmapResult>* results) {
74 callback.Run(*results); 76 callback.Run(*results);
75 } 77 }
76 78
77 CancelableTaskTracker::TaskId FaviconService::GetFaviconImage( 79 CancelableTaskTracker::TaskId FaviconService::GetFaviconImage(
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 318
317 FaviconService::~FaviconService() {} 319 FaviconService::~FaviconService() {}
318 320
319 CancelableTaskTracker::TaskId FaviconService::GetFaviconForURLImpl( 321 CancelableTaskTracker::TaskId FaviconService::GetFaviconForURLImpl(
320 const FaviconForURLParams& params, 322 const FaviconForURLParams& params,
321 const std::vector<ui::ScaleFactor>& desired_scale_factors, 323 const std::vector<ui::ScaleFactor>& desired_scale_factors,
322 const FaviconResultsCallback& callback, 324 const FaviconResultsCallback& callback,
323 CancelableTaskTracker* tracker) { 325 CancelableTaskTracker* tracker) {
324 if (params.page_url.SchemeIs(chrome::kChromeUIScheme) || 326 if (params.page_url.SchemeIs(chrome::kChromeUIScheme) ||
325 params.page_url.SchemeIs(extensions::kExtensionScheme)) { 327 params.page_url.SchemeIs(extensions::kExtensionScheme)) {
326 return GetFaviconForChromeURL(params.profile, params.page_url, 328 return GetFaviconForChromeURL(profile_, params.page_url,
327 desired_scale_factors, callback, tracker); 329 desired_scale_factors, callback, tracker);
328 } else if (history_service_) { 330 } else if (history_service_) {
329 return history_service_->GetFaviconsForURL(params.page_url, 331 return history_service_->GetFaviconsForURL(params.page_url,
330 params.icon_types, 332 params.icon_types,
331 params.desired_size_in_dip, 333 params.desired_size_in_dip,
332 desired_scale_factors, 334 desired_scale_factors,
333 callback, 335 callback,
334 tracker); 336 tracker);
335 } 337 }
336 return RunWithEmptyResultAsync(callback, tracker); 338 return RunWithEmptyResultAsync(callback, tracker);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false, 397 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false,
396 &resized_bitmap_data)) { 398 &resized_bitmap_data)) {
397 callback.Run(chrome::FaviconBitmapResult()); 399 callback.Run(chrome::FaviconBitmapResult());
398 return; 400 return;
399 } 401 }
400 402
401 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( 403 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector(
402 &resized_bitmap_data); 404 &resized_bitmap_data);
403 callback.Run(bitmap_result); 405 callback.Run(bitmap_result);
404 } 406 }
OLDNEW
« no previous file with comments | « chrome/browser/favicon/favicon_service.h ('k') | chrome/browser/favicon/favicon_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698