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

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

Issue 2723953002: [sync] skeleton implementation of TypedURLSyncBridge (Closed)
Patch Set: Created 3 years, 9 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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 struct DownloadRow; 46 struct DownloadRow;
47 class HistoryBackendClient; 47 class HistoryBackendClient;
48 class HistoryBackendDBBaseTest; 48 class HistoryBackendDBBaseTest;
49 class HistoryBackendObserver; 49 class HistoryBackendObserver;
50 class HistoryBackendTest; 50 class HistoryBackendTest;
51 class HistoryDatabase; 51 class HistoryDatabase;
52 struct HistoryDatabaseParams; 52 struct HistoryDatabaseParams;
53 class HistoryDBTask; 53 class HistoryDBTask;
54 class InMemoryHistoryBackend; 54 class InMemoryHistoryBackend;
55 class TypedUrlSyncableService; 55 class TypedUrlSyncableService;
56 class TypedURLSyncBridge;
56 class HistoryBackendHelper; 57 class HistoryBackendHelper;
57 class URLDatabase; 58 class URLDatabase;
58 59
59 // The maximum number of icons URLs per page which can be stored in the 60 // The maximum number of icons URLs per page which can be stored in the
60 // thumbnail database. 61 // thumbnail database.
61 static const size_t kMaxFaviconsPerPage = 8; 62 static const size_t kMaxFaviconsPerPage = 8;
62 63
63 // The maximum number of bitmaps for a single icon URL which can be stored in 64 // The maximum number of bitmaps for a single icon URL which can be stored in
64 // the thumbnail database. 65 // the thumbnail database.
65 static const size_t kMaxFaviconBitmapsPerIconURL = 8; 66 static const size_t kMaxFaviconBitmapsPerIconURL = 8;
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 // If there is no entry in the map for a given visit, that means the visit 389 // If there is no entry in the map for a given visit, that means the visit
389 // was SOURCE_BROWSED. Returns false if there is no HistoryDatabase.. 390 // was SOURCE_BROWSED. Returns false if there is no HistoryDatabase..
390 bool GetVisitsSource(const VisitVector& visits, VisitSourceMap* sources); 391 bool GetVisitsSource(const VisitVector& visits, VisitSourceMap* sources);
391 392
392 virtual bool GetURL(const GURL& url, URLRow* url_row); 393 virtual bool GetURL(const GURL& url, URLRow* url_row);
393 394
394 // Returns the syncable service for syncing typed urls. The returned service 395 // Returns the syncable service for syncing typed urls. The returned service
395 // is owned by |this| object. 396 // is owned by |this| object.
396 virtual TypedUrlSyncableService* GetTypedUrlSyncableService() const; 397 virtual TypedUrlSyncableService* GetTypedUrlSyncableService() const;
397 398
399 // Returns the sync bridge for syncing typed urls. The returned service
400 // is owned by |this| object.
401 TypedURLSyncBridge* GetTypedURLSyncBridge() const;
skym 2017/03/03 17:41:09 Why is GetTypedUrlSyncableService() virtual and th
Gang Wu 2017/03/06 08:21:24 I am not going to add unittest in this CL, so did
402
398 // Deleting ------------------------------------------------------------------ 403 // Deleting ------------------------------------------------------------------
399 404
400 virtual void DeleteURLs(const std::vector<GURL>& urls); 405 virtual void DeleteURLs(const std::vector<GURL>& urls);
401 406
402 virtual void DeleteURL(const GURL& url); 407 virtual void DeleteURL(const GURL& url);
403 408
404 // Calls ExpireHistoryBackend::ExpireHistoryBetween and commits the change. 409 // Calls ExpireHistoryBackend::ExpireHistoryBetween and commits the change.
405 void ExpireHistoryBetween(const std::set<GURL>& restrict_urls, 410 void ExpireHistoryBetween(const std::set<GURL>& restrict_urls,
406 base::Time begin_time, 411 base::Time begin_time,
407 base::Time end_time); 412 base::Time end_time);
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 // when a catastrophic error occurs. 884 // when a catastrophic error occurs.
880 std::string db_diagnostics_; 885 std::string db_diagnostics_;
881 886
882 // Map from host to index in the TopHosts list. It is updated only by 887 // Map from host to index in the TopHosts list. It is updated only by
883 // TopHosts(), so it's usually stale. 888 // TopHosts(), so it's usually stale.
884 mutable base::hash_map<std::string, int> host_ranks_; 889 mutable base::hash_map<std::string, int> host_ranks_;
885 890
886 // List of observers 891 // List of observers
887 base::ObserverList<HistoryBackendObserver> observers_; 892 base::ObserverList<HistoryBackendObserver> observers_;
888 893
889 // Used to manage syncing of the typed urls datatype. This will be null before 894 // Used to manage syncing of the typed urls datatype. They will be null before
890 // Init is called. Defined after observers_ because it unregisters itself as 895 // Init is called, and only one will be instantiated after Init is called
891 // observer during destruction. 896 // depending on switches::kSyncUSSAutocomplete. Defined after observers_
skym 2017/03/03 17:41:09 autocomplete?
Gang Wu 2017/03/06 08:21:24 Done.
897 // because it unregisters itself as observer during destruction.
892 std::unique_ptr<TypedUrlSyncableService> typed_url_syncable_service_; 898 std::unique_ptr<TypedUrlSyncableService> typed_url_syncable_service_;
899 std::unique_ptr<TypedURLSyncBridge> typed_url_sync_bridge_;
893 900
894 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); 901 DISALLOW_COPY_AND_ASSIGN(HistoryBackend);
895 }; 902 };
896 903
897 } // namespace history 904 } // namespace history
898 905
899 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ 906 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698