| 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 URL (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. It is valid to call NotifyFaviconsChanged() |
| 127 // with non-empty |page_urls| and an empty |icon_url| and vice versa. |
| 128 virtual void NotifyFaviconsChanged(const std::set<GURL>& page_urls, |
| 129 const GURL& icon_url) = 0; |
| 126 | 130 |
| 127 // Notify HistoryService that the user is visiting an URL. The event will | 131 // Notify HistoryService that the user is visiting an URL. The event will |
| 128 // be forwarded to the HistoryServiceObservers in the correct thread. | 132 // be forwarded to the HistoryServiceObservers in the correct thread. |
| 129 virtual void NotifyURLVisited(ui::PageTransition transition, | 133 virtual void NotifyURLVisited(ui::PageTransition transition, |
| 130 const URLRow& row, | 134 const URLRow& row, |
| 131 const RedirectList& redirects, | 135 const RedirectList& redirects, |
| 132 base::Time visit_time) = 0; | 136 base::Time visit_time) = 0; |
| 133 | 137 |
| 134 // Notify HistoryService that some URLs have been modified. The event will | 138 // Notify HistoryService that some URLs have been modified. The event will |
| 135 // be forwarded to the HistoryServiceObservers in the correct thread. | 139 // be forwarded to the HistoryServiceObservers in the correct thread. |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLNotInDB); | 501 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLNotInDB); |
| 498 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLInDB); | 502 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLInDB); |
| 499 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconMaxFaviconsPerPage); | 503 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconMaxFaviconsPerPage); |
| 500 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 504 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 501 MergeFaviconIconURLMappedToDifferentPageURL); | 505 MergeFaviconIconURLMappedToDifferentPageURL); |
| 502 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 506 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 503 MergeFaviconMaxFaviconBitmapsPerIconURL); | 507 MergeFaviconMaxFaviconBitmapsPerIconURL); |
| 504 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 508 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 505 MergeIdenticalFaviconDoesNotChangeLastUpdatedTime); | 509 MergeIdenticalFaviconDoesNotChangeLastUpdatedTime); |
| 506 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 510 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 511 FaviconChangedNotificationNewFavicon); |
| 512 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 513 FaviconChangedNotificationBitmapDataChanged); |
| 514 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 515 FaviconChangedNotificationIconMappingChanged); |
| 516 FRIEND_TEST_ALL_PREFIXES( |
| 517 HistoryBackendTest, |
| 518 FaviconChangedNotificationIconMappingAndBitmapDataChanged); |
| 519 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 520 FaviconChangedNotificationsMergeCopy); |
| 521 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, NoFaviconChangedNotifications); |
| 522 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 507 UpdateFaviconMappingsAndFetchMultipleIconTypes); | 523 UpdateFaviconMappingsAndFetchMultipleIconTypes); |
| 508 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBEmpty); | 524 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBEmpty); |
| 509 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 525 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 510 GetFaviconsFromDBNoFaviconBitmaps); | 526 GetFaviconsFromDBNoFaviconBitmaps); |
| 511 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 527 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 512 GetFaviconsFromDBSelectClosestMatch); | 528 GetFaviconsFromDBSelectClosestMatch); |
| 513 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBIconType); | 529 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBIconType); |
| 514 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBExpired); | 530 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBExpired); |
| 515 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 531 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 516 UpdateFaviconMappingsAndFetchNoDB); | 532 UpdateFaviconMappingsAndFetchNoDB); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 const GURL& page_url, | 726 const GURL& page_url, |
| 711 favicon_base::IconType icon_type, | 727 favicon_base::IconType icon_type, |
| 712 const std::vector<favicon_base::FaviconID>& icon_ids); | 728 const std::vector<favicon_base::FaviconID>& icon_ids); |
| 713 | 729 |
| 714 // Returns all the page URLs in the redirect chain for |page_url|. If there | 730 // Returns all the page URLs in the redirect chain for |page_url|. If there |
| 715 // are no known redirects for |page_url|, returns a vector with |page_url|. | 731 // are no known redirects for |page_url|, returns a vector with |page_url|. |
| 716 void GetCachedRecentRedirects(const GURL& page_url, | 732 void GetCachedRecentRedirects(const GURL& page_url, |
| 717 RedirectList* redirect_list); | 733 RedirectList* redirect_list); |
| 718 | 734 |
| 719 // Send notification that the favicon has changed for |page_url| and all its | 735 // Send notification that the favicon has changed for |page_url| and all its |
| 720 // redirects. | 736 // redirects. This should be called if the mapping between the page URL |
| 737 // (e.g. http://www.google.com) and the icon URL (e.g. |
| 738 // http://www.google.com/favicon.ico) has changed. |
| 721 void SendFaviconChangedNotificationForPageAndRedirects(const GURL& page_url); | 739 void SendFaviconChangedNotificationForPageAndRedirects(const GURL& page_url); |
| 722 | 740 |
| 741 // Send notification that the bitmap data for the favicon at |icon_url| has |
| 742 // changed. Sending this notification is important because the favicon at |
| 743 // |icon_url| may be mapped to hundreds of page URLs. |
| 744 void SendFaviconChangedNotificationForIconURL(const GURL& icon_url); |
| 745 |
| 723 // Generic stuff ------------------------------------------------------------- | 746 // Generic stuff ------------------------------------------------------------- |
| 724 | 747 |
| 725 // Processes the next scheduled HistoryDBTask, scheduling this method | 748 // Processes the next scheduled HistoryDBTask, scheduling this method |
| 726 // to be invoked again if there are more tasks that need to run. | 749 // to be invoked again if there are more tasks that need to run. |
| 727 void ProcessDBTaskImpl(); | 750 void ProcessDBTaskImpl(); |
| 728 | 751 |
| 729 // HistoryBackendNotifier: | 752 // HistoryBackendNotifier: |
| 730 void NotifyFaviconChanged(const std::set<GURL>& urls) override; | 753 void NotifyFaviconsChanged(const std::set<GURL>& page_urls, |
| 754 const GURL& icon_url) override; |
| 731 void NotifyURLVisited(ui::PageTransition transition, | 755 void NotifyURLVisited(ui::PageTransition transition, |
| 732 const URLRow& row, | 756 const URLRow& row, |
| 733 const RedirectList& redirects, | 757 const RedirectList& redirects, |
| 734 base::Time visit_time) override; | 758 base::Time visit_time) override; |
| 735 void NotifyURLsModified(const URLRows& rows) override; | 759 void NotifyURLsModified(const URLRows& rows) override; |
| 736 void NotifyURLsDeleted(bool all_history, | 760 void NotifyURLsDeleted(bool all_history, |
| 737 bool expired, | 761 bool expired, |
| 738 const URLRows& rows, | 762 const URLRows& rows, |
| 739 const std::set<GURL>& favicon_urls) override; | 763 const std::set<GURL>& favicon_urls) override; |
| 740 | 764 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 | 862 |
| 839 // List of observers | 863 // List of observers |
| 840 base::ObserverList<HistoryBackendObserver> observers_; | 864 base::ObserverList<HistoryBackendObserver> observers_; |
| 841 | 865 |
| 842 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 866 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
| 843 }; | 867 }; |
| 844 | 868 |
| 845 } // namespace history | 869 } // namespace history |
| 846 | 870 |
| 847 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ | 871 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ |
| OLD | NEW |