Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(509)

Side by Side Diff: components/history/core/browser/history_backend.h

Issue 1198373002: Split HistoryClient in two objects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@1192403002
Patch Set: Add comments in ChromeHistoryBackendClient Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 24 matching lines...) Expand all
35 struct ThumbnailScore; 35 struct ThumbnailScore;
36 36
37 namespace base { 37 namespace base {
38 class MessageLoop; 38 class MessageLoop;
39 class SingleThreadTaskRunner; 39 class SingleThreadTaskRunner;
40 } 40 }
41 41
42 namespace history { 42 namespace history {
43 class CommitLaterTask; 43 class CommitLaterTask;
44 struct DownloadRow; 44 struct DownloadRow;
45 class HistoryBackendClient;
45 class HistoryBackendDBBaseTest; 46 class HistoryBackendDBBaseTest;
46 class HistoryBackendObserver; 47 class HistoryBackendObserver;
47 class HistoryBackendTest; 48 class HistoryBackendTest;
48 class HistoryClient;
49 class HistoryDatabase; 49 class HistoryDatabase;
50 struct HistoryDatabaseParams; 50 struct HistoryDatabaseParams;
51 struct HistoryDetails; 51 struct HistoryDetails;
52 class HistoryDBTask; 52 class HistoryDBTask;
53 class InMemoryHistoryBackend; 53 class InMemoryHistoryBackend;
54 class TypedUrlSyncableService; 54 class TypedUrlSyncableService;
55 class VisitFilter; 55 class VisitFilter;
56 class HistoryBackendHelper; 56 class HistoryBackendHelper;
57 57
58 // The maximum number of icons URLs per page which can be stored in the 58 // The maximum number of icons URLs per page which can be stored in the
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // be called on the history thread. 164 // be called on the history thread.
165 // 165 //
166 // |history_dir| is the directory where the history files will be placed. 166 // |history_dir| is the directory where the history files will be placed.
167 // See the definition of BroadcastNotificationsCallback above. This function 167 // See the definition of BroadcastNotificationsCallback above. This function
168 // takes ownership of the callback pointer. 168 // takes ownership of the callback pointer.
169 // 169 //
170 // |history_client| is used to determine bookmarked URLs when deleting and 170 // |history_client| is used to determine bookmarked URLs when deleting and
171 // may be null. 171 // may be null.
172 // 172 //
173 // This constructor is fast and does no I/O, so can be called at any time. 173 // This constructor is fast and does no I/O, so can be called at any time.
174 HistoryBackend(Delegate* delegate, HistoryClient* history_client, 174 HistoryBackend(Delegate* delegate,
175 scoped_ptr<HistoryBackendClient> backend_client,
175 scoped_refptr<base::SequencedTaskRunner> task_runner); 176 scoped_refptr<base::SequencedTaskRunner> task_runner);
176 177
177 // Must be called after creation but before any objects are created. If this 178 // Must be called after creation but before any objects are created. If this
178 // fails, all other functions will fail as well. (Since this runs on another 179 // fails, all other functions will fail as well. (Since this runs on another
179 // thread, we don't bother returning failure.) 180 // thread, we don't bother returning failure.)
180 // 181 //
181 // |languages| gives a list of language encodings with which the history 182 // |languages| gives a list of language encodings with which the history
182 // URLs and omnibox searches are interpreted. 183 // URLs and omnibox searches are interpreted.
183 // |force_fail| can be set during unittests to unconditionally fail to init. 184 // |force_fail| can be set during unittests to unconditionally fail to init.
184 void Init(const std::string& languages, 185 void Init(const std::string& languages,
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 // Deletes all information in the history database, except for the supplied 756 // Deletes all information in the history database, except for the supplied
756 // set of URLs in the URL table (these should correspond to the bookmarked 757 // set of URLs in the URL table (these should correspond to the bookmarked
757 // URLs). 758 // URLs).
758 // 759 //
759 // The IDs of the URLs may change. 760 // The IDs of the URLs may change.
760 bool ClearAllMainHistory(const URLRows& kept_urls); 761 bool ClearAllMainHistory(const URLRows& kept_urls);
761 762
762 // Deletes the FTS index database files, which are no longer used. 763 // Deletes the FTS index database files, which are no longer used.
763 void DeleteFTSIndexDatabases(); 764 void DeleteFTSIndexDatabases();
764 765
765 // Returns the HistoryClient, blocking until the bookmarks are loaded. This
766 // may return null during testing.
767 HistoryClient* GetHistoryClient();
768
769 // Data ---------------------------------------------------------------------- 766 // Data ----------------------------------------------------------------------
770 767
771 // Delegate. See the class definition above for more information. This will 768 // Delegate. See the class definition above for more information. This will
772 // be null before Init is called and after Cleanup, but is guaranteed 769 // be null before Init is called and after Cleanup, but is guaranteed
773 // non-null in between. 770 // non-null in between.
774 scoped_ptr<Delegate> delegate_; 771 scoped_ptr<Delegate> delegate_;
775 772
776 // Directory where database files will be stored, empty until Init is called. 773 // Directory where database files will be stored, empty until Init is called.
777 base::FilePath history_dir_; 774 base::FilePath history_dir_;
778 775
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 VisitTracker tracker_; 813 VisitTracker tracker_;
817 814
818 // A boolean variable to track whether we have already purged obsolete segment 815 // A boolean variable to track whether we have already purged obsolete segment
819 // data. 816 // data.
820 bool segment_queried_; 817 bool segment_queried_;
821 818
822 // List of QueuedHistoryDBTasks to run; 819 // List of QueuedHistoryDBTasks to run;
823 std::list<QueuedHistoryDBTask*> queued_history_db_tasks_; 820 std::list<QueuedHistoryDBTask*> queued_history_db_tasks_;
824 821
825 // Used to determine if a URL is bookmarked; may be null. 822 // Used to determine if a URL is bookmarked; may be null.
826 // 823 scoped_ptr<HistoryBackendClient> backend_client_;
827 // Use GetHistoryClient to access this, which makes sure the bookmarks are
828 // loaded before returning.
829 HistoryClient* history_client_;
830 824
831 scoped_refptr<base::SequencedTaskRunner> task_runner_; 825 scoped_refptr<base::SequencedTaskRunner> task_runner_;
832 826
833 // Used to allow embedder code to stash random data by key. Those object will 827 // Used to allow embedder code to stash random data by key. Those object will
834 // be deleted before closing the databases (hence the member variable instead 828 // be deleted before closing the databases (hence the member variable instead
835 // of inheritance from base::SupportsUserData). 829 // of inheritance from base::SupportsUserData).
836 scoped_ptr<HistoryBackendHelper> supports_user_data_helper_; 830 scoped_ptr<HistoryBackendHelper> supports_user_data_helper_;
837 831
838 // Used to manage syncing of the typed urls datatype. This will be null before 832 // Used to manage syncing of the typed urls datatype. This will be null before
839 // Init is called. 833 // Init is called.
840 scoped_ptr<TypedUrlSyncableService> typed_url_syncable_service_; 834 scoped_ptr<TypedUrlSyncableService> typed_url_syncable_service_;
841 835
842 // Listens for the system being under memory pressure. 836 // Listens for the system being under memory pressure.
843 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_; 837 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_;
844 838
845 // List of observers 839 // List of observers
846 base::ObserverList<HistoryBackendObserver> observers_; 840 base::ObserverList<HistoryBackendObserver> observers_;
847 841
848 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); 842 DISALLOW_COPY_AND_ASSIGN(HistoryBackend);
849 }; 843 };
850 844
851 } // namespace history 845 } // namespace history
852 846
853 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ 847 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_
OLDNEW
« no previous file with comments | « components/history/core/browser/expire_history_backend_unittest.cc ('k') | components/history/core/browser/history_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698