OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 | 442 |
443 HistoryService::Handle HistoryService::GetPageThumbnail( | 443 HistoryService::Handle HistoryService::GetPageThumbnail( |
444 const GURL& page_url, | 444 const GURL& page_url, |
445 CancelableRequestConsumerBase* consumer, | 445 CancelableRequestConsumerBase* consumer, |
446 ThumbnailDataCallback* callback) { | 446 ThumbnailDataCallback* callback) { |
447 return Schedule(PRIORITY_NORMAL, &HistoryBackend::GetPageThumbnail, consumer, | 447 return Schedule(PRIORITY_NORMAL, &HistoryBackend::GetPageThumbnail, consumer, |
448 new history::GetPageThumbnailRequest(callback), page_url); | 448 new history::GetPageThumbnailRequest(callback), page_url); |
449 } | 449 } |
450 | 450 |
451 void HistoryService::GetFavicon(FaviconService::GetFaviconRequest* request, | 451 void HistoryService::GetFavicon(FaviconService::GetFaviconRequest* request, |
452 const GURL& icon_url) { | 452 const GURL& icon_url, |
| 453 history::IconType icon_type) { |
453 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFavicon, NULL, request, | 454 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFavicon, NULL, request, |
454 icon_url, history::FAVICON); | 455 icon_url, icon_type); |
455 } | 456 } |
456 | 457 |
457 void HistoryService::UpdateFaviconMappingAndFetch( | 458 void HistoryService::UpdateFaviconMappingAndFetch( |
458 FaviconService::GetFaviconRequest* request, | 459 FaviconService::GetFaviconRequest* request, |
459 const GURL& page_url, | 460 const GURL& page_url, |
460 const GURL& icon_url) { | 461 const GURL& icon_url, |
| 462 history::IconType icon_type) { |
461 Schedule(PRIORITY_NORMAL, &HistoryBackend::UpdateFaviconMappingAndFetch, NULL, | 463 Schedule(PRIORITY_NORMAL, &HistoryBackend::UpdateFaviconMappingAndFetch, NULL, |
462 request, page_url, icon_url, history::FAVICON); | 464 request, page_url, icon_url, history::FAVICON); |
463 } | 465 } |
464 | 466 |
465 void HistoryService::GetFaviconForURL( | 467 void HistoryService::GetFaviconForURL( |
466 FaviconService::GetFaviconRequest* request, | 468 FaviconService::GetFaviconRequest* request, |
467 const GURL& page_url) { | 469 const GURL& page_url, |
| 470 int icon_types) { |
468 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFaviconForURL, NULL, request, | 471 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFaviconForURL, NULL, request, |
469 page_url, history::FAVICON); | 472 page_url, icon_types); |
470 } | 473 } |
471 | 474 |
472 void HistoryService::SetFavicon(const GURL& page_url, | 475 void HistoryService::SetFavicon(const GURL& page_url, |
473 const GURL& icon_url, | 476 const GURL& icon_url, |
474 const std::vector<unsigned char>& image_data) { | 477 const std::vector<unsigned char>& image_data, |
| 478 history::IconType icon_type) { |
475 if (!CanAddURL(page_url)) | 479 if (!CanAddURL(page_url)) |
476 return; | 480 return; |
477 | 481 |
478 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::SetFavicon, | 482 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::SetFavicon, |
479 page_url, icon_url, | 483 page_url, icon_url, |
480 scoped_refptr<RefCountedMemory>(new RefCountedBytes(image_data)), | 484 scoped_refptr<RefCountedMemory>(new RefCountedBytes(image_data)), |
481 history::FAVICON); | 485 icon_type); |
482 } | 486 } |
483 | 487 |
484 void HistoryService::SetFaviconOutOfDateForPage(const GURL& page_url) { | 488 void HistoryService::SetFaviconOutOfDateForPage(const GURL& page_url) { |
485 ScheduleAndForget(PRIORITY_NORMAL, | 489 ScheduleAndForget(PRIORITY_NORMAL, |
486 &HistoryBackend::SetFaviconOutOfDateForPage, page_url); | 490 &HistoryBackend::SetFaviconOutOfDateForPage, page_url); |
487 } | 491 } |
488 | 492 |
489 void HistoryService::SetImportedFavicons( | 493 void HistoryService::SetImportedFavicons( |
490 const std::vector<history::ImportedFaviconUsage>& favicon_usage) { | 494 const std::vector<history::ImportedFaviconUsage>& favicon_usage) { |
491 ScheduleAndForget(PRIORITY_NORMAL, | 495 ScheduleAndForget(PRIORITY_NORMAL, |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 history::TopSites* ts = profile_->GetTopSitesWithoutCreating(); | 811 history::TopSites* ts = profile_->GetTopSitesWithoutCreating(); |
808 if (ts) | 812 if (ts) |
809 ts->MigrateFromHistory(); | 813 ts->MigrateFromHistory(); |
810 } | 814 } |
811 } | 815 } |
812 | 816 |
813 void HistoryService::OnTopSitesReady() { | 817 void HistoryService::OnTopSitesReady() { |
814 ScheduleAndForget(PRIORITY_NORMAL, | 818 ScheduleAndForget(PRIORITY_NORMAL, |
815 &HistoryBackend::MigrateThumbnailsDatabase); | 819 &HistoryBackend::MigrateThumbnailsDatabase); |
816 } | 820 } |
OLD | NEW |