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 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ |
6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // Sets the in-memory history backend. The in-memory backend is created by | 113 // Sets the in-memory history backend. The in-memory backend is created by |
114 // the main backend. For non-unit tests, this happens on the background | 114 // the main backend. For non-unit tests, this happens on the background |
115 // thread. It is to be used on the main thread, so this would transfer | 115 // thread. It is to be used on the main thread, so this would transfer |
116 // it to the history service. Unit tests can override this behavior. | 116 // it to the history service. Unit tests can override this behavior. |
117 // | 117 // |
118 // This function is NOT guaranteed to be called. If there is an error, | 118 // This function is NOT guaranteed to be called. If there is an error, |
119 // there may be no in-memory database. | 119 // there may be no in-memory database. |
120 virtual void SetInMemoryBackend( | 120 virtual void SetInMemoryBackend( |
121 scoped_ptr<InMemoryHistoryBackend> backend) = 0; | 121 scoped_ptr<InMemoryHistoryBackend> backend) = 0; |
122 | 122 |
123 // Notify HistoryService that some URLs favicon changed that will forward | 123 // Notify HistoryService that the favicons for the given page URLs (e.g. |
124 // the events to the FaviconChangedObservers in the correct thread. | 124 // http://www.google.com) and the given icon URLs (e.g. |
125 virtual void NotifyFaviconChanged(const std::set<GURL>& urls) = 0; | 125 // http://www.google.com/favicon.ico) have changed. HistoryService notifies |
| 126 // any registered callbacks. |
| 127 virtual void NotifyFaviconsChanged(const std::vector<GURL>& page_urls, |
| 128 const std::vector<GURL>& icon_urls) = 0; |
126 | 129 |
127 // Notify HistoryService that the user is visiting an URL. The event will | 130 // Notify HistoryService that the user is visiting an URL. The event will |
128 // be forwarded to the HistoryServiceObservers in the correct thread. | 131 // be forwarded to the HistoryServiceObservers in the correct thread. |
129 virtual void NotifyURLVisited(ui::PageTransition transition, | 132 virtual void NotifyURLVisited(ui::PageTransition transition, |
130 const URLRow& row, | 133 const URLRow& row, |
131 const RedirectList& redirects, | 134 const RedirectList& redirects, |
132 base::Time visit_time) = 0; | 135 base::Time visit_time) = 0; |
133 | 136 |
134 // Notify HistoryService that some URLs have been modified. The event will | 137 // Notify HistoryService that some URLs have been modified. The event will |
135 // be forwarded to the HistoryServiceObservers in the correct thread. | 138 // be forwarded to the HistoryServiceObservers in the correct thread. |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLNotInDB); | 491 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLNotInDB); |
489 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLInDB); | 492 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLInDB); |
490 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconMaxFaviconsPerPage); | 493 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconMaxFaviconsPerPage); |
491 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 494 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
492 MergeFaviconIconURLMappedToDifferentPageURL); | 495 MergeFaviconIconURLMappedToDifferentPageURL); |
493 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 496 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
494 MergeFaviconMaxFaviconBitmapsPerIconURL); | 497 MergeFaviconMaxFaviconBitmapsPerIconURL); |
495 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 498 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
496 MergeIdenticalFaviconDoesNotChangeLastUpdatedTime); | 499 MergeIdenticalFaviconDoesNotChangeLastUpdatedTime); |
497 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 500 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 501 FaviconChangedNotificationNewFavicon); |
| 502 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 503 FaviconChangedNotificationBitmapDataChanged); |
| 504 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 505 FaviconChangedNotificationIconMappingChanged); |
| 506 FRIEND_TEST_ALL_PREFIXES( |
| 507 HistoryBackendTest, |
| 508 FaviconChangedNotificationIconMappingAndBitmapDataChanged); |
| 509 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 510 FaviconChangedNotificationsMergeCopy); |
| 511 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, NoFaviconChangedNotifications); |
| 512 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
498 UpdateFaviconMappingsAndFetchMultipleIconTypes); | 513 UpdateFaviconMappingsAndFetchMultipleIconTypes); |
499 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBEmpty); | 514 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBEmpty); |
500 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 515 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
501 GetFaviconsFromDBNoFaviconBitmaps); | 516 GetFaviconsFromDBNoFaviconBitmaps); |
502 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 517 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
503 GetFaviconsFromDBSelectClosestMatch); | 518 GetFaviconsFromDBSelectClosestMatch); |
504 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBIconType); | 519 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBIconType); |
505 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBExpired); | 520 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBExpired); |
506 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 521 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
507 UpdateFaviconMappingsAndFetchNoDB); | 522 UpdateFaviconMappingsAndFetchNoDB); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 const GURL& page_url, | 702 const GURL& page_url, |
688 favicon_base::IconType icon_type, | 703 favicon_base::IconType icon_type, |
689 const std::vector<favicon_base::FaviconID>& icon_ids); | 704 const std::vector<favicon_base::FaviconID>& icon_ids); |
690 | 705 |
691 // Returns all the page URLs in the redirect chain for |page_url|. If there | 706 // Returns all the page URLs in the redirect chain for |page_url|. If there |
692 // are no known redirects for |page_url|, returns a vector with |page_url|. | 707 // are no known redirects for |page_url|, returns a vector with |page_url|. |
693 void GetCachedRecentRedirects(const GURL& page_url, | 708 void GetCachedRecentRedirects(const GURL& page_url, |
694 RedirectList* redirect_list); | 709 RedirectList* redirect_list); |
695 | 710 |
696 // Send notification that the favicon has changed for |page_url| and all its | 711 // Send notification that the favicon has changed for |page_url| and all its |
697 // redirects. | 712 // redirects. This should be called if the mapping between the page URL |
| 713 // (e.g. http://www.google.com) and the icon URL (e.g. |
| 714 // http://www.google.com/favicon.ico) has changed. |
698 void SendFaviconChangedNotificationForPageAndRedirects(const GURL& page_url); | 715 void SendFaviconChangedNotificationForPageAndRedirects(const GURL& page_url); |
699 | 716 |
| 717 // Send notification that the bitmap data for the favicon at |icon_url| has |
| 718 // changed. Sending this notification is important because the favicon at |
| 719 // |icon_url| may be mapped to hundreds of page URLs. |
| 720 void SendFaviconChangedNotificationForIconURL(const GURL& icon_url); |
| 721 |
700 // Generic stuff ------------------------------------------------------------- | 722 // Generic stuff ------------------------------------------------------------- |
701 | 723 |
702 // Processes the next scheduled HistoryDBTask, scheduling this method | 724 // Processes the next scheduled HistoryDBTask, scheduling this method |
703 // to be invoked again if there are more tasks that need to run. | 725 // to be invoked again if there are more tasks that need to run. |
704 void ProcessDBTaskImpl(); | 726 void ProcessDBTaskImpl(); |
705 | 727 |
706 // HistoryBackendNotifier: | 728 // HistoryBackendNotifier: |
707 void NotifyFaviconChanged(const std::set<GURL>& urls) override; | 729 void NotifyFaviconsChanged(const std::vector<GURL>& page_urls, |
| 730 const std::vector<GURL>& icon_urls) override; |
708 void NotifyURLVisited(ui::PageTransition transition, | 731 void NotifyURLVisited(ui::PageTransition transition, |
709 const URLRow& row, | 732 const URLRow& row, |
710 const RedirectList& redirects, | 733 const RedirectList& redirects, |
711 base::Time visit_time) override; | 734 base::Time visit_time) override; |
712 void NotifyURLsModified(const URLRows& rows) override; | 735 void NotifyURLsModified(const URLRows& rows) override; |
713 void NotifyURLsDeleted(bool all_history, | 736 void NotifyURLsDeleted(bool all_history, |
714 bool expired, | 737 bool expired, |
715 const URLRows& rows, | 738 const URLRows& rows, |
716 const std::set<GURL>& favicon_urls) override; | 739 const std::set<GURL>& favicon_urls) override; |
717 | 740 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 | 845 |
823 // List of observers | 846 // List of observers |
824 ObserverList<HistoryBackendObserver> observers_; | 847 ObserverList<HistoryBackendObserver> observers_; |
825 | 848 |
826 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 849 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
827 }; | 850 }; |
828 | 851 |
829 } // namespace history | 852 } // namespace history |
830 | 853 |
831 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ | 854 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ |
OLD | NEW |