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

Side by Side Diff: components/favicon/core/favicon_handler.cc

Issue 2828173002: [Refactor] Simplify HistoryBackend::UpdateFaviconMappingsAndFetchImpl() signature (Closed)
Patch Set: Merge branch 'master' into icon_type0 Created 3 years, 7 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
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 "components/favicon/core/favicon_handler.h" 5 #include "components/favicon/core/favicon_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 service_->GetFavicon( 509 service_->GetFavicon(
510 icon_url, icon_type, preferred_icon_size(), 510 icon_url, icon_type, preferred_icon_size(),
511 base::Bind(&FaviconHandler::OnFaviconData, base::Unretained(this)), 511 base::Bind(&FaviconHandler::OnFaviconData, base::Unretained(this)),
512 &cancelable_task_tracker_); 512 &cancelable_task_tracker_);
513 } else { 513 } else {
514 // Ask the history service for the icon. This does two things: 514 // Ask the history service for the icon. This does two things:
515 // 1. Attempts to fetch the favicon data from the database. 515 // 1. Attempts to fetch the favicon data from the database.
516 // 2. If the favicon exists in the database, this updates the database to 516 // 2. If the favicon exists in the database, this updates the database to
517 // include the mapping between the page url and the favicon url. 517 // include the mapping between the page url and the favicon url.
518 // This is asynchronous. The history service will call back when done. 518 // This is asynchronous. The history service will call back when done.
519 // TODO(pkotwicz): pass in all of |image_urls_| to
520 // UpdateFaviconMappingsAndFetch().
521 service_->UpdateFaviconMappingsAndFetch( 519 service_->UpdateFaviconMappingsAndFetch(
522 url_, {icon_url}, icon_type, preferred_icon_size(), 520 url_, icon_url, icon_type, preferred_icon_size(),
523 base::Bind(&FaviconHandler::OnFaviconData, base::Unretained(this)), 521 base::Bind(&FaviconHandler::OnFaviconData, base::Unretained(this)),
524 &cancelable_task_tracker_); 522 &cancelable_task_tracker_);
525 } 523 }
526 } 524 }
527 } 525 }
528 526
529 void FaviconHandler::OnFaviconData(const std::vector< 527 void FaviconHandler::OnFaviconData(const std::vector<
530 favicon_base::FaviconRawBitmapResult>& favicon_bitmap_results) { 528 favicon_base::FaviconRawBitmapResult>& favicon_bitmap_results) {
531 bool has_results = !favicon_bitmap_results.empty(); 529 bool has_results = !favicon_bitmap_results.empty();
532 bool has_valid_result = HasValidResult(favicon_bitmap_results); 530 bool has_valid_result = HasValidResult(favicon_bitmap_results);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 // A max bitmap size is specified to avoid receiving huge bitmaps in 574 // A max bitmap size is specified to avoid receiving huge bitmaps in
577 // OnDidDownloadFavicon(). See FaviconDriver::StartDownload() 575 // OnDidDownloadFavicon(). See FaviconDriver::StartDownload()
578 // for more details about the max bitmap size. 576 // for more details about the max bitmap size.
579 const int download_id = 577 const int download_id =
580 delegate_->DownloadImage(image_url, GetMaximalIconSize(handler_type_), 578 delegate_->DownloadImage(image_url, GetMaximalIconSize(handler_type_),
581 download_request_.callback()); 579 download_request_.callback());
582 DCHECK_NE(download_id, 0); 580 DCHECK_NE(download_id, 0);
583 } 581 }
584 582
585 } // namespace favicon 583 } // namespace favicon
OLDNEW
« no previous file with comments | « no previous file | components/favicon/core/favicon_handler_unittest.cc » ('j') | components/history/core/browser/history_backend.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698