| 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::GetFavicon( |
| 495 const GURL& icon_url, | 495 FaviconService::GetFaviconRequest* request, |
| 496 history::IconType icon_type) { | 496 const std::vector<GURL>& icon_urls, |
| 497 history::IconType icon_type, |
| 498 const gfx::Size& desired_dip_size, |
| 499 const std::vector<ui::ScaleFactor>& desired_scale_factors) { |
| 497 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFavicon, NULL, request, | 500 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFavicon, NULL, request, |
| 498 icon_url, icon_type); | 501 icon_urls, icon_type, desired_dip_size, desired_scale_factors); |
| 499 } | |
| 500 | |
| 501 void HistoryService::UpdateFaviconMappingAndFetch( | |
| 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 } | 502 } |
| 509 | 503 |
| 510 void HistoryService::GetFaviconForURL( | 504 void HistoryService::GetFaviconForURL( |
| 511 FaviconService::GetFaviconRequest* request, | 505 FaviconService::GetFaviconRequest* request, |
| 512 const GURL& page_url, | 506 const GURL& page_url, |
| 513 int icon_types) { | 507 int icon_types, |
| 508 const gfx::Size& desired_dip_size, |
| 509 const std::vector<ui::ScaleFactor>& desired_scale_factors) { |
| 514 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFaviconForURL, NULL, request, | 510 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFaviconForURL, NULL, request, |
| 515 page_url, icon_types); | 511 page_url, icon_types, desired_dip_size, desired_scale_factors); |
| 516 } | 512 } |
| 517 | 513 |
| 518 void HistoryService::SetFavicon(const GURL& page_url, | 514 void HistoryService::UpdateFaviconMappingsAndFetch( |
| 519 const GURL& icon_url, | 515 FaviconService::GetFaviconRequest* request, |
| 520 const std::vector<unsigned char>& image_data, | 516 const GURL& page_url, |
| 521 history::IconType icon_type) { | 517 const std::vector<GURL>& icon_urls, |
| 518 history::IconType icon_type, |
| 519 const gfx::Size& desired_dip_size, |
| 520 const std::vector<ui::ScaleFactor>& desired_scale_factors) { |
| 521 Schedule(PRIORITY_NORMAL, &HistoryBackend::UpdateFaviconMappingsAndFetch, |
| 522 NULL, request, page_url, icon_urls, icon_type, desired_dip_size, |
| 523 desired_scale_factors); |
| 524 } |
| 525 |
| 526 void HistoryService::AddFavicons( |
| 527 const GURL& page_url, |
| 528 const GURL& icon_url, |
| 529 history::IconType icon_type, |
| 530 const std::vector<history::FaviconBitmapData>& favicon_bitmaps) { |
| 522 if (!CanAddURL(page_url)) | 531 if (!CanAddURL(page_url)) |
| 523 return; | 532 return; |
| 524 | 533 |
| 525 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::SetFavicon, | 534 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::AddFavicons, page_url, |
| 526 page_url, icon_url, | 535 icon_url, icon_type, favicon_bitmaps); |
| 527 scoped_refptr<base::RefCountedMemory>( | |
| 528 new base::RefCountedBytes(image_data)), | |
| 529 icon_type); | |
| 530 } | 536 } |
| 531 | 537 |
| 532 void HistoryService::SetFaviconOutOfDateForPage(const GURL& page_url) { | 538 void HistoryService::SetFavicons( |
| 533 ScheduleAndForget(PRIORITY_NORMAL, | 539 const GURL& page_url, |
| 534 &HistoryBackend::SetFaviconOutOfDateForPage, page_url); | 540 const GURL& icon_url, |
| 541 history::IconType icon_type, |
| 542 const std::vector<history::FaviconBitmapData>& favicon_bitmaps, |
| 543 const history::IconURLSizesMap& icon_url_sizes) { |
| 544 if (!CanAddURL(page_url)) |
| 545 return; |
| 546 |
| 547 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::SetFavicons, page_url, |
| 548 icon_url, icon_type, favicon_bitmaps, icon_url_sizes); |
| 535 } | 549 } |
| 536 | 550 |
| 537 void HistoryService::CloneFavicon(const GURL& old_page_url, | 551 void HistoryService::SetFaviconsOutOfDateForPage(const GURL& page_url) { |
| 552 ScheduleAndForget(PRIORITY_NORMAL, |
| 553 &HistoryBackend::SetFaviconsOutOfDateForPage, page_url); |
| 554 } |
| 555 |
| 556 void HistoryService::CloneFavicons(const GURL& old_page_url, |
| 538 const GURL& new_page_url) { | 557 const GURL& new_page_url) { |
| 539 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::CloneFavicon, | 558 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::CloneFavicons, |
| 540 old_page_url, new_page_url); | 559 old_page_url, new_page_url); |
| 541 } | 560 } |
| 542 | 561 |
| 543 void HistoryService::SetImportedFavicons( | 562 void HistoryService::SetImportedFavicons( |
| 544 const std::vector<history::ImportedFaviconUsage>& favicon_usage) { | 563 const std::vector<history::ImportedFaviconUsage>& favicon_usage) { |
| 545 ScheduleAndForget(PRIORITY_NORMAL, | 564 ScheduleAndForget(PRIORITY_NORMAL, |
| 546 &HistoryBackend::SetImportedFavicons, favicon_usage); | 565 &HistoryBackend::SetImportedFavicons, favicon_usage); |
| 547 } | 566 } |
| 548 | 567 |
| 549 void HistoryService::IterateURLs(URLEnumerator* enumerator) { | 568 void HistoryService::IterateURLs(URLEnumerator* enumerator) { |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 void HistoryService::RemoveVisitDatabaseObserver( | 952 void HistoryService::RemoveVisitDatabaseObserver( |
| 934 history::VisitDatabaseObserver* observer) { | 953 history::VisitDatabaseObserver* observer) { |
| 935 visit_database_observers_->RemoveObserver(observer); | 954 visit_database_observers_->RemoveObserver(observer); |
| 936 } | 955 } |
| 937 | 956 |
| 938 void HistoryService::NotifyVisitDBObserversOnAddVisit( | 957 void HistoryService::NotifyVisitDBObserversOnAddVisit( |
| 939 const history::BriefVisitInfo& info) { | 958 const history::BriefVisitInfo& info) { |
| 940 visit_database_observers_->Notify( | 959 visit_database_observers_->Notify( |
| 941 &history::VisitDatabaseObserver::OnAddVisit, info); | 960 &history::VisitDatabaseObserver::OnAddVisit, info); |
| 942 } | 961 } |
| OLD | NEW |