OLD | NEW |
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 Loading... |
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, |
| 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 favicon_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 favicon_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::SetFavicons( |
| 535 const GURL& page_url, |
| 536 history::IconType icon_type, |
| 537 const std::vector<history::FaviconBitmapData>& favicon_bitmap_data, |
| 538 const history::IconURLSizesMap& icon_url_sizes) { |
528 if (!CanAddURL(page_url)) | 539 if (!CanAddURL(page_url)) |
529 return; | 540 return; |
530 | 541 |
531 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::SetFavicon, | 542 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::SetFavicons, page_url, |
532 page_url, icon_url, | 543 icon_type, favicon_bitmap_data, icon_url_sizes); |
533 scoped_refptr<base::RefCountedMemory>( | |
534 new base::RefCountedBytes(image_data)), | |
535 icon_type); | |
536 } | 544 } |
537 | 545 |
538 void HistoryService::SetFaviconOutOfDateForPage(const GURL& page_url) { | 546 void HistoryService::SetFaviconsOutOfDateForPage(const GURL& page_url) { |
539 ScheduleAndForget(PRIORITY_NORMAL, | 547 ScheduleAndForget(PRIORITY_NORMAL, |
540 &HistoryBackend::SetFaviconOutOfDateForPage, page_url); | 548 &HistoryBackend::SetFaviconsOutOfDateForPage, page_url); |
541 } | 549 } |
542 | 550 |
543 void HistoryService::CloneFavicon(const GURL& old_page_url, | 551 void HistoryService::CloneFavicons(const GURL& old_page_url, |
544 const GURL& new_page_url) { | 552 const GURL& new_page_url) { |
545 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::CloneFavicon, | 553 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::CloneFavicons, |
546 old_page_url, new_page_url); | 554 old_page_url, new_page_url); |
547 } | 555 } |
548 | 556 |
549 void HistoryService::SetImportedFavicons( | 557 void HistoryService::SetImportedFavicons( |
550 const std::vector<history::ImportedFaviconUsage>& favicon_usage) { | 558 const std::vector<history::ImportedFaviconUsage>& favicon_usage) { |
551 ScheduleAndForget(PRIORITY_NORMAL, | 559 ScheduleAndForget(PRIORITY_NORMAL, |
552 &HistoryBackend::SetImportedFavicons, favicon_usage); | 560 &HistoryBackend::SetImportedFavicons, favicon_usage); |
553 } | 561 } |
554 | 562 |
555 void HistoryService::IterateURLs(URLEnumerator* enumerator) { | 563 void HistoryService::IterateURLs(URLEnumerator* enumerator) { |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 void HistoryService::RemoveVisitDatabaseObserver( | 947 void HistoryService::RemoveVisitDatabaseObserver( |
940 history::VisitDatabaseObserver* observer) { | 948 history::VisitDatabaseObserver* observer) { |
941 visit_database_observers_->RemoveObserver(observer); | 949 visit_database_observers_->RemoveObserver(observer); |
942 } | 950 } |
943 | 951 |
944 void HistoryService::NotifyVisitDBObserversOnAddVisit( | 952 void HistoryService::NotifyVisitDBObserversOnAddVisit( |
945 const history::BriefVisitInfo& info) { | 953 const history::BriefVisitInfo& info) { |
946 visit_database_observers_->Notify( | 954 visit_database_observers_->Notify( |
947 &history::VisitDatabaseObserver::OnAddVisit, info); | 955 &history::VisitDatabaseObserver::OnAddVisit, info); |
948 } | 956 } |
OLD | NEW |