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

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: 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
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 history::IconType icon_type) {
498 icon_url, icon_type); 498 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFavicons, NULL, request,
499 icon_urls, icon_type);
499 } 500 }
500 501
501 void HistoryService::UpdateFaviconMappingAndFetch( 502 void HistoryService::GetFaviconsForURL(
502 FaviconService::GetFaviconRequest* request,
503 const GURL& page_url,
504 const GURL& icon_url,
505 history::IconType icon_type) {
506 Schedule(PRIORITY_NORMAL, &HistoryBackend::UpdateFaviconMappingAndFetch, NULL,
507 request, page_url, icon_url, history::FAVICON);
508 }
509
510 void HistoryService::GetFaviconForURL(
511 FaviconService::GetFaviconRequest* request, 503 FaviconService::GetFaviconRequest* request,
512 const GURL& page_url, 504 const GURL& page_url,
513 int icon_types) { 505 int icon_types) {
514 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFaviconForURL, NULL, request, 506 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFaviconsForURL, NULL, request,
515 page_url, icon_types); 507 page_url, icon_types);
516 } 508 }
517 509
518 void HistoryService::GetFaviconForID(FaviconService::GetFaviconRequest* request, 510 void HistoryService::UpdateFaviconMappingsAndFetch(
519 history::FaviconID id) { 511 FaviconService::GetFaviconRequest* request,
520 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFaviconForID, NULL, request, 512 const GURL& page_url,
521 id); 513 const std::vector<GURL>& icon_urls,
514 history::IconType icon_type) {
515 Schedule(PRIORITY_NORMAL, &HistoryBackend::UpdateFaviconMappingsAndFetch,
516 NULL, request, page_url, icon_urls, icon_type);
522 } 517 }
523 518
524 void HistoryService::SetFavicon(const GURL& page_url, 519 void HistoryService::AddFavicons(
525 const GURL& icon_url, 520 const GURL& page_url,
526 const std::vector<unsigned char>& image_data, 521 history::IconType icon_type,
527 history::IconType icon_type) { 522 const std::vector<history::FaviconDataElement>& elements) {
528 if (!CanAddURL(page_url)) 523 if (!CanAddURL(page_url))
529 return; 524 return;
530 525
531 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::SetFavicon, 526 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::AddFavicons, page_url,
532 page_url, icon_url, 527 icon_type, elements);
533 scoped_refptr<base::RefCountedMemory>(
534 new base::RefCountedBytes(image_data)),
535 icon_type);
536 } 528 }
537 529
538 void HistoryService::SetFaviconOutOfDateForPage(const GURL& page_url) { 530 void HistoryService::SetFavicons(
539 ScheduleAndForget(PRIORITY_NORMAL, 531 const GURL& page_url,
540 &HistoryBackend::SetFaviconOutOfDateForPage, page_url); 532 history::IconType icon_type,
533 const std::vector<history::FaviconDataElement>& elements,
534 const history::IconURLSizesMap& icon_url_sizes) {
535 if (!CanAddURL(page_url))
536 return;
537
538 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::SetFavicons, page_url,
539 icon_type, elements, icon_url_sizes);
541 } 540 }
542 541
543 void HistoryService::CloneFavicon(const GURL& old_page_url, 542 void HistoryService::SetFaviconsOutOfDateForPage(const GURL& page_url) {
543 ScheduleAndForget(PRIORITY_NORMAL,
544 &HistoryBackend::SetFaviconsOutOfDateForPage, page_url);
545 }
546
547 void HistoryService::CloneFavicons(const GURL& old_page_url,
544 const GURL& new_page_url) { 548 const GURL& new_page_url) {
545 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::CloneFavicon, 549 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::CloneFavicons,
546 old_page_url, new_page_url); 550 old_page_url, new_page_url);
547 } 551 }
548 552
549 void HistoryService::SetImportedFavicons( 553 void HistoryService::SetImportedFavicons(
550 const std::vector<history::ImportedFaviconUsage>& favicon_usage) { 554 const std::vector<history::ImportedFaviconUsage>& favicon_usage) {
551 ScheduleAndForget(PRIORITY_NORMAL, 555 ScheduleAndForget(PRIORITY_NORMAL,
552 &HistoryBackend::SetImportedFavicons, favicon_usage); 556 &HistoryBackend::SetImportedFavicons, favicon_usage);
553 } 557 }
554 558
555 void HistoryService::IterateURLs(URLEnumerator* enumerator) { 559 void HistoryService::IterateURLs(URLEnumerator* enumerator) {
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 void HistoryService::RemoveVisitDatabaseObserver( 943 void HistoryService::RemoveVisitDatabaseObserver(
940 history::VisitDatabaseObserver* observer) { 944 history::VisitDatabaseObserver* observer) {
941 visit_database_observers_->RemoveObserver(observer); 945 visit_database_observers_->RemoveObserver(observer);
942 } 946 }
943 947
944 void HistoryService::NotifyVisitDBObserversOnAddVisit( 948 void HistoryService::NotifyVisitDBObserversOnAddVisit(
945 const history::BriefVisitInfo& info) { 949 const history::BriefVisitInfo& info) {
946 visit_database_observers_->Notify( 950 visit_database_observers_->Notify(
947 &history::VisitDatabaseObserver::OnAddVisit, info); 951 &history::VisitDatabaseObserver::OnAddVisit, info);
948 } 952 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698