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

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

Issue 10828263: Moving FaviconService to a ProfileKeyedService. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: resyncing with library after revert Created 8 years, 4 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
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model.cc ('k') | chrome/browser/favicon/favicon_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_handler.h" 5 #include "chrome/browser/favicon/favicon_handler.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/memory/ref_counted_memory.h" 13 #include "base/memory/ref_counted_memory.h"
14 #include "chrome/browser/bookmarks/bookmark_model.h" 14 #include "chrome/browser/bookmarks/bookmark_model.h"
15 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 15 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
16 #include "chrome/browser/favicon/favicon_service_factory.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/common/icon_messages.h" 18 #include "chrome/common/icon_messages.h"
18 #include "content/public/browser/favicon_status.h" 19 #include "content/public/browser/favicon_status.h"
19 #include "content/public/browser/navigation_entry.h" 20 #include "content/public/browser/navigation_entry.h"
20 #include "skia/ext/image_operations.h" 21 #include "skia/ext/image_operations.h"
21 #include "ui/gfx/codec/png_codec.h" 22 #include "ui/gfx/codec/png_codec.h"
22 #include "ui/gfx/image/image.h" 23 #include "ui/gfx/image/image.h"
23 #include "ui/gfx/image/image_util.h" 24 #include "ui/gfx/image/image_util.h"
24 25
25 using content::NavigationEntry; 26 using content::NavigationEntry;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 151
151 int FaviconHandler::DownloadImage( 152 int FaviconHandler::DownloadImage(
152 const GURL& image_url, 153 const GURL& image_url,
153 int image_size, 154 int image_size,
154 history::IconType icon_type, 155 history::IconType icon_type,
155 const FaviconTabHelper::ImageDownloadCallback& callback) { 156 const FaviconTabHelper::ImageDownloadCallback& callback) {
156 return ScheduleDownload(GURL(), image_url, image_size, icon_type, callback); 157 return ScheduleDownload(GURL(), image_url, image_size, icon_type, callback);
157 } 158 }
158 159
159 FaviconService* FaviconHandler::GetFaviconService() { 160 FaviconService* FaviconHandler::GetFaviconService() {
160 return profile_->GetFaviconService(Profile::EXPLICIT_ACCESS); 161 return FaviconServiceFactory::GetForProfile(
162 profile_, Profile::EXPLICIT_ACCESS);
161 } 163 }
162 164
163 bool FaviconHandler::UpdateFaviconCandidate(const GURL& url, 165 bool FaviconHandler::UpdateFaviconCandidate(const GURL& url,
164 const GURL& image_url, 166 const GURL& image_url,
165 const gfx::Image& image, 167 const gfx::Image& image,
166 float score, 168 float score,
167 history::IconType icon_type) { 169 history::IconType icon_type) {
168 bool update_candidate = false; 170 bool update_candidate = false;
169 SkBitmap bitmap = *(image.ToSkBitmap()); 171 SkBitmap bitmap = *(image.ToSkBitmap());
170 bool exact_match = score == 1; 172 bool exact_match = score == 1;
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 CancelableRequestConsumerBase* consumer, 367 CancelableRequestConsumerBase* consumer,
366 const FaviconService::FaviconDataCallback& callback) { 368 const FaviconService::FaviconDataCallback& callback) {
367 GetFaviconService()->GetFavicon(icon_url, icon_type, consumer, callback); 369 GetFaviconService()->GetFavicon(icon_url, icon_type, consumer, callback);
368 } 370 }
369 371
370 void FaviconHandler::GetFaviconForURL( 372 void FaviconHandler::GetFaviconForURL(
371 const GURL& page_url, 373 const GURL& page_url,
372 int icon_types, 374 int icon_types,
373 CancelableRequestConsumerBase* consumer, 375 CancelableRequestConsumerBase* consumer,
374 const FaviconService::FaviconDataCallback& callback) { 376 const FaviconService::FaviconDataCallback& callback) {
375 GetFaviconService()->GetFaviconForURL(page_url, icon_types, consumer, 377 GetFaviconService()->GetFaviconForURL(profile_, page_url, icon_types,
376 callback); 378 consumer, callback);
377 } 379 }
378 380
379 void FaviconHandler::SetHistoryFavicon( 381 void FaviconHandler::SetHistoryFavicon(
380 const GURL& page_url, 382 const GURL& page_url,
381 const GURL& icon_url, 383 const GURL& icon_url,
382 const std::vector<unsigned char>& image_data, 384 const std::vector<unsigned char>& image_data,
383 history::IconType icon_type) { 385 history::IconType icon_type) {
384 GetFaviconService()->SetFavicon(page_url, icon_url, image_data, icon_type); 386 GetFaviconService()->SetFavicon(page_url, icon_url, image_data, icon_type);
385 } 387 }
386 388
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 int height = bitmap.height(); 534 int height = bitmap.height();
533 if (width > 0 && height > 0) { 535 if (width > 0 && height > 0) {
534 gfx::CalculateFaviconTargetSize(&width, &height); 536 gfx::CalculateFaviconTargetSize(&width, &height);
535 return gfx::Image(skia::ImageOperations::Resize( 537 return gfx::Image(skia::ImageOperations::Resize(
536 bitmap, skia::ImageOperations::RESIZE_LANCZOS3, 538 bitmap, skia::ImageOperations::RESIZE_LANCZOS3,
537 width, height)); 539 width, height));
538 } 540 }
539 541
540 return image; 542 return image;
541 } 543 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model.cc ('k') | chrome/browser/favicon/favicon_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698