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 CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
6 #define CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 namespace history { | 46 namespace history { |
47 #if defined(OS_ANDROID) | 47 #if defined(OS_ANDROID) |
48 class AndroidProviderBackend; | 48 class AndroidProviderBackend; |
49 #endif | 49 #endif |
50 | 50 |
51 class CommitLaterTask; | 51 class CommitLaterTask; |
52 struct DownloadRow; | 52 struct DownloadRow; |
53 class HistoryBackendObserver; | 53 class HistoryBackendObserver; |
54 class HistoryClient; | 54 class HistoryClient; |
| 55 struct HistoryDetails; |
55 class HistoryDBTask; | 56 class HistoryDBTask; |
56 class InMemoryHistoryBackend; | 57 class InMemoryHistoryBackend; |
57 class TypedUrlSyncableService; | 58 class TypedUrlSyncableService; |
58 class VisitFilter; | 59 class VisitFilter; |
59 | 60 |
60 // The maximum number of icons URLs per page which can be stored in the | 61 // The maximum number of icons URLs per page which can be stored in the |
61 // thumbnail database. | 62 // thumbnail database. |
62 static const size_t kMaxFaviconsPerPage = 8; | 63 static const size_t kMaxFaviconsPerPage = 8; |
63 | 64 |
64 // The maximum number of bitmaps for a single icon URL which can be stored in | 65 // The maximum number of bitmaps for a single icon URL which can be stored in |
(...skipping 27 matching lines...) Expand all Loading... |
92 // Internal history implementation which does most of the work of the history | 93 // Internal history implementation which does most of the work of the history |
93 // system. This runs on a background thread (to not block the browser when we | 94 // system. This runs on a background thread (to not block the browser when we |
94 // do expensive operations) and is NOT threadsafe, so it must only be called | 95 // do expensive operations) and is NOT threadsafe, so it must only be called |
95 // from message handlers on the background thread. Invoking on another thread | 96 // from message handlers on the background thread. Invoking on another thread |
96 // requires threadsafe refcounting. | 97 // requires threadsafe refcounting. |
97 // | 98 // |
98 // Most functions here are just the implementations of the corresponding | 99 // Most functions here are just the implementations of the corresponding |
99 // functions in the history service. These functions are not documented | 100 // functions in the history service. These functions are not documented |
100 // here, see the history service for behavior. | 101 // here, see the history service for behavior. |
101 class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, | 102 class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, |
102 public BroadcastNotificationDelegate { | 103 public ExpireHistoryBackendDelegate { |
103 public: | 104 public: |
104 // Interface implemented by the owner of the HistoryBackend object. Normally, | 105 // Interface implemented by the owner of the HistoryBackend object. Normally, |
105 // the history service implements this to send stuff back to the main thread. | 106 // the history service implements this to send stuff back to the main thread. |
106 // The unit tests can provide a different implementation if they don't have | 107 // The unit tests can provide a different implementation if they don't have |
107 // a history service object. | 108 // a history service object. |
108 class Delegate { | 109 class Delegate { |
109 public: | 110 public: |
110 virtual ~Delegate() {} | 111 virtual ~Delegate() {} |
111 | 112 |
112 // Called when the database cannot be read correctly for some reason. | 113 // Called when the database cannot be read correctly for some reason. |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 // redirects. | 789 // redirects. |
789 void SendFaviconChangedNotificationForPageAndRedirects( | 790 void SendFaviconChangedNotificationForPageAndRedirects( |
790 const GURL& page_url); | 791 const GURL& page_url); |
791 | 792 |
792 // Generic stuff ------------------------------------------------------------- | 793 // Generic stuff ------------------------------------------------------------- |
793 | 794 |
794 // Processes the next scheduled HistoryDBTask, scheduling this method | 795 // Processes the next scheduled HistoryDBTask, scheduling this method |
795 // to be invoked again if there are more tasks that need to run. | 796 // to be invoked again if there are more tasks that need to run. |
796 void ProcessDBTaskImpl(); | 797 void ProcessDBTaskImpl(); |
797 | 798 |
798 void BroadcastNotifications(int type, | 799 // Broadcasts the specified notification to the notification service on both |
799 scoped_ptr<HistoryDetails> details) override; | 800 // the main thread and the history thread if a notification service is |
800 void NotifySyncURLsModified(URLRows* rows) override; | 801 // running. |
801 void NotifySyncURLsDeleted(bool all_history, | 802 void BroadcastNotifications(int type, scoped_ptr<HistoryDetails> details); |
802 bool expired, | 803 |
803 URLRows* rows) override; | 804 // ExpireHistoryBackendDelegate: |
| 805 void NotifyURLsModified(const URLRows& rows) override; |
| 806 void NotifyURLsDeleted(bool all_history, |
| 807 bool expired, |
| 808 const URLRows& rows, |
| 809 const std::set<GURL>& favicon_urls) override; |
804 | 810 |
805 // Deleting all history ------------------------------------------------------ | 811 // Deleting all history ------------------------------------------------------ |
806 | 812 |
807 // Deletes all history. This is a special case of deleting that is separated | 813 // Deletes all history. This is a special case of deleting that is separated |
808 // from our normal dependency-following method for performance reasons. The | 814 // from our normal dependency-following method for performance reasons. The |
809 // logic lives here instead of ExpireHistoryBackend since it will cause | 815 // logic lives here instead of ExpireHistoryBackend since it will cause |
810 // re-initialization of some databases (e.g. Thumbnails) that could fail. | 816 // re-initialization of some databases (e.g. Thumbnails) that could fail. |
811 // When these databases are not valid, our pointers must be NULL, so we need | 817 // When these databases are not valid, our pointers must be NULL, so we need |
812 // to handle this type of operation to keep the pointers in sync. | 818 // to handle this type of operation to keep the pointers in sync. |
813 void DeleteAllHistory(); | 819 void DeleteAllHistory(); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 | 925 |
920 // List of observers | 926 // List of observers |
921 ObserverList<HistoryBackendObserver> observers_; | 927 ObserverList<HistoryBackendObserver> observers_; |
922 | 928 |
923 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 929 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
924 }; | 930 }; |
925 | 931 |
926 } // namespace history | 932 } // namespace history |
927 | 933 |
928 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 934 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
OLD | NEW |