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

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

Issue 407513002: Revert of Bypass the favicon_service when importing favicons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
« no previous file with comments | « chrome/browser/favicon/favicon_service.h ('k') | chrome/browser/history/history_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_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"
11 #include "chrome/browser/history/history_backend.h" 11 #include "chrome/browser/history/history_backend.h"
12 #include "chrome/browser/history/history_service.h" 12 #include "chrome/browser/history/history_service.h"
13 #include "chrome/browser/history/history_service_factory.h" 13 #include "chrome/browser/history/history_service_factory.h"
14 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" 14 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
15 #include "chrome/common/importer/imported_favicon_usage.h"
15 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
16 #include "components/favicon_base/favicon_types.h" 17 #include "components/favicon_base/favicon_types.h"
17 #include "components/favicon_base/favicon_util.h" 18 #include "components/favicon_base/favicon_util.h"
18 #include "components/favicon_base/select_favicon_frames.h" 19 #include "components/favicon_base/select_favicon_frames.h"
19 #include "extensions/common/constants.h" 20 #include "extensions/common/constants.h"
20 #include "third_party/skia/include/core/SkBitmap.h" 21 #include "third_party/skia/include/core/SkBitmap.h"
21 #include "ui/gfx/codec/png_codec.h" 22 #include "ui/gfx/codec/png_codec.h"
22 #include "ui/gfx/favicon_size.h" 23 #include "ui/gfx/favicon_size.h"
23 #include "ui/gfx/image/image_skia.h" 24 #include "ui/gfx/image/image_skia.h"
24 25
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 if (history_service_) 277 if (history_service_)
277 history_service_->SetFaviconsOutOfDateForPage(page_url); 278 history_service_->SetFaviconsOutOfDateForPage(page_url);
278 } 279 }
279 280
280 void FaviconService::CloneFavicon(const GURL& old_page_url, 281 void FaviconService::CloneFavicon(const GURL& old_page_url,
281 const GURL& new_page_url) { 282 const GURL& new_page_url) {
282 if (history_service_) 283 if (history_service_)
283 history_service_->CloneFavicons(old_page_url, new_page_url); 284 history_service_->CloneFavicons(old_page_url, new_page_url);
284 } 285 }
285 286
287 void FaviconService::SetImportedFavicons(
288 const std::vector<ImportedFaviconUsage>& favicon_usage) {
289 if (history_service_)
290 history_service_->SetImportedFavicons(favicon_usage);
291 }
292
286 void FaviconService::MergeFavicon( 293 void FaviconService::MergeFavicon(
287 const GURL& page_url, 294 const GURL& page_url,
288 const GURL& icon_url, 295 const GURL& icon_url,
289 favicon_base::IconType icon_type, 296 favicon_base::IconType icon_type,
290 scoped_refptr<base::RefCountedMemory> bitmap_data, 297 scoped_refptr<base::RefCountedMemory> bitmap_data,
291 const gfx::Size& pixel_size) { 298 const gfx::Size& pixel_size) {
292 if (history_service_) { 299 if (history_service_) {
293 history_service_->MergeFavicon(page_url, icon_url, icon_type, bitmap_data, 300 history_service_->MergeFavicon(page_url, icon_url, icon_type, bitmap_data,
294 pixel_size); 301 pixel_size);
295 } 302 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false, 433 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false,
427 &resized_bitmap_data)) { 434 &resized_bitmap_data)) {
428 callback.Run(favicon_base::FaviconRawBitmapResult()); 435 callback.Run(favicon_base::FaviconRawBitmapResult());
429 return; 436 return;
430 } 437 }
431 438
432 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( 439 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector(
433 &resized_bitmap_data); 440 &resized_bitmap_data);
434 callback.Run(bitmap_result); 441 callback.Run(bitmap_result);
435 } 442 }
OLDNEW
« no previous file with comments | « chrome/browser/favicon/favicon_service.h ('k') | chrome/browser/history/history_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698