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

Side by Side Diff: chrome/browser/history/history.cc

Issue 10802066: Adds support for saving favicon size into history database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes as requested Created 8 years, 3 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 // The history system runs on a background thread so that potentially slow 5 // The history system runs on a background thread so that potentially slow
6 // database operations don't delay the browser. This backend processing is 6 // database operations don't delay the browser. This backend processing is
7 // represented by HistoryBackend. The HistoryService's job is to dispatch to 7 // represented by HistoryBackend. The HistoryService's job is to dispatch to
8 // that thread. 8 // that thread.
9 // 9 //
10 // Main thread History thread 10 // Main thread History thread
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 } 484 }
485 485
486 HistoryService::Handle HistoryService::GetPageThumbnail( 486 HistoryService::Handle HistoryService::GetPageThumbnail(
487 const GURL& page_url, 487 const GURL& page_url,
488 CancelableRequestConsumerBase* consumer, 488 CancelableRequestConsumerBase* consumer,
489 const ThumbnailDataCallback& callback) { 489 const ThumbnailDataCallback& callback) {
490 return Schedule(PRIORITY_NORMAL, &HistoryBackend::GetPageThumbnail, consumer, 490 return Schedule(PRIORITY_NORMAL, &HistoryBackend::GetPageThumbnail, consumer,
491 new history::GetPageThumbnailRequest(callback), page_url); 491 new history::GetPageThumbnailRequest(callback), page_url);
492 } 492 }
493 493
494 void HistoryService::GetFavicon(FaviconService::GetFaviconRequest* request, 494 void HistoryService::GetFavicons(
495 const GURL& icon_url, 495 FaviconService::GetFaviconRequest* request,
496 history::IconType icon_type) { 496 const std::vector<GURL>& icon_urls,
497 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFavicon, NULL, request, 497 int icon_types,
498 icon_url, icon_type); 498 int desired_size_in_dip,
sky 2012/09/04 17:22:31 What is desired_size_in_dip? Why is it an int?
pkotwicz 2012/09/04 19:47:55 I have updated the comments in history.h. |desired
499 const std::vector<ui::ScaleFactor>& desired_scale_factors) {
500 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFavicons, NULL, request,
501 icon_urls, icon_types, desired_size_in_dip, desired_scale_factors);
499 } 502 }
500 503
501 void HistoryService::UpdateFaviconMappingAndFetch( 504 void HistoryService::GetFaviconsForURL(
502 FaviconService::GetFaviconRequest* request, 505 FaviconService::GetFaviconRequest* request,
503 const GURL& page_url, 506 const GURL& page_url,
504 const GURL& icon_url, 507 int icon_types,
505 history::IconType icon_type) { 508 int desired_size_in_dip,
506 Schedule(PRIORITY_NORMAL, &HistoryBackend::UpdateFaviconMappingAndFetch, NULL, 509 const std::vector<ui::ScaleFactor>& desired_scale_factors) {
507 request, page_url, icon_url, history::FAVICON); 510 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFaviconsForURL, NULL, request,
508 } 511 page_url, icon_types, desired_size_in_dip, desired_scale_factors);
509
510 void HistoryService::GetFaviconForURL(
511 FaviconService::GetFaviconRequest* request,
512 const GURL& page_url,
513 int icon_types) {
514 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFaviconForURL, NULL, request,
515 page_url, icon_types);
516 } 512 }
517 513
518 void HistoryService::GetFaviconForID(FaviconService::GetFaviconRequest* request, 514 void HistoryService::GetFaviconForID(FaviconService::GetFaviconRequest* request,
519 history::FaviconID id) { 515 history::FaviconID id,
516 int desired_size_in_dip,
517 ui::ScaleFactor desired_scale_factor) {
520 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFaviconForID, NULL, request, 518 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFaviconForID, NULL, request,
521 id); 519 id, desired_size_in_dip, desired_scale_factor);
522 } 520 }
523 521
524 void HistoryService::SetFavicon(const GURL& page_url, 522 void HistoryService::UpdateFaviconMappingsAndFetch(
525 const GURL& icon_url, 523 FaviconService::GetFaviconRequest* request,
526 const std::vector<unsigned char>& image_data, 524 const GURL& page_url,
527 history::IconType icon_type) { 525 const std::vector<GURL>& icon_urls,
526 int icon_types,
527 int desired_size_in_dip,
528 const std::vector<ui::ScaleFactor>& desired_scale_factors) {
529 Schedule(PRIORITY_NORMAL, &HistoryBackend::UpdateFaviconMappingsAndFetch,
530 NULL, request, page_url, icon_urls, icon_types, desired_size_in_dip,
531 desired_scale_factors);
532 }
533
534 void HistoryService::MergeFavicon(
535 const GURL& page_url,
536 const GURL& icon_url,
537 history::IconType icon_type,
538 scoped_refptr<base::RefCountedMemory> bitmap_data,
539 const gfx::Size& pixel_size) {
528 if (!CanAddURL(page_url)) 540 if (!CanAddURL(page_url))
529 return; 541 return;
530 542
531 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::SetFavicon, 543 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::MergeFavicon, page_url,
532 page_url, icon_url, 544 icon_url, icon_type, bitmap_data, pixel_size);
533 scoped_refptr<base::RefCountedMemory>(
534 new base::RefCountedBytes(image_data)),
535 icon_type);
536 } 545 }
537 546
538 void HistoryService::SetFaviconOutOfDateForPage(const GURL& page_url) { 547 void HistoryService::SetFavicons(
539 ScheduleAndForget(PRIORITY_NORMAL, 548 const GURL& page_url,
540 &HistoryBackend::SetFaviconOutOfDateForPage, page_url); 549 history::IconType icon_type,
550 const std::vector<history::FaviconBitmapData>& favicon_bitmap_data,
551 const history::IconURLSizesMap& icon_url_sizes) {
552 if (!CanAddURL(page_url))
553 return;
554
555 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::SetFavicons, page_url,
556 icon_type, favicon_bitmap_data, icon_url_sizes);
541 } 557 }
542 558
543 void HistoryService::CloneFavicon(const GURL& old_page_url, 559 void HistoryService::SetFaviconsOutOfDateForPage(const GURL& page_url) {
560 ScheduleAndForget(PRIORITY_NORMAL,
561 &HistoryBackend::SetFaviconsOutOfDateForPage, page_url);
562 }
563
564 void HistoryService::CloneFavicons(const GURL& old_page_url,
544 const GURL& new_page_url) { 565 const GURL& new_page_url) {
545 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::CloneFavicon, 566 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::CloneFavicons,
546 old_page_url, new_page_url); 567 old_page_url, new_page_url);
547 } 568 }
548 569
549 void HistoryService::SetImportedFavicons( 570 void HistoryService::SetImportedFavicons(
550 const std::vector<history::ImportedFaviconUsage>& favicon_usage) { 571 const std::vector<history::ImportedFaviconUsage>& favicon_usage) {
551 ScheduleAndForget(PRIORITY_NORMAL, 572 ScheduleAndForget(PRIORITY_NORMAL,
552 &HistoryBackend::SetImportedFavicons, favicon_usage); 573 &HistoryBackend::SetImportedFavicons, favicon_usage);
553 } 574 }
554 575
555 void HistoryService::IterateURLs(URLEnumerator* enumerator) { 576 void HistoryService::IterateURLs(URLEnumerator* enumerator) {
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 void HistoryService::RemoveVisitDatabaseObserver( 960 void HistoryService::RemoveVisitDatabaseObserver(
940 history::VisitDatabaseObserver* observer) { 961 history::VisitDatabaseObserver* observer) {
941 visit_database_observers_->RemoveObserver(observer); 962 visit_database_observers_->RemoveObserver(observer);
942 } 963 }
943 964
944 void HistoryService::NotifyVisitDBObserversOnAddVisit( 965 void HistoryService::NotifyVisitDBObserversOnAddVisit(
945 const history::BriefVisitInfo& info) { 966 const history::BriefVisitInfo& info) {
946 visit_database_observers_->Notify( 967 visit_database_observers_->Notify(
947 &history::VisitDatabaseObserver::OnAddVisit, info); 968 &history::VisitDatabaseObserver::OnAddVisit, info);
948 } 969 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698