zea | f09345c | 2015-10-27 05:29:50 | [diff] [blame] | 1 | // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef COMPONENTS_SYNC_SESSIONS_SYNC_SESSIONS_CLIENT_H_ |
| 6 | #define COMPONENTS_SYNC_SESSIONS_SYNC_SESSIONS_CLIENT_H_ |
| 7 | |
danakj | 5b9c7ed6 | 2016-04-22 23:33:37 | [diff] [blame] | 8 | #include <memory> |
| 9 | |
zea | f09345c | 2015-10-27 05:29:50 | [diff] [blame] | 10 | #include "base/macros.h" |
| 11 | |
| 12 | class GURL; |
| 13 | |
zea | 9c7707d | 2015-11-03 21:41:14 | [diff] [blame] | 14 | namespace bookmarks { |
| 15 | class BookmarkModel; |
| 16 | } |
| 17 | |
zea | 9c7707d | 2015-11-03 21:41:14 | [diff] [blame] | 18 | namespace favicon { |
| 19 | class FaviconService; |
| 20 | } |
| 21 | |
| 22 | namespace history { |
| 23 | class HistoryService; |
| 24 | } |
| 25 | |
zea | f09345c | 2015-10-27 05:29:50 | [diff] [blame] | 26 | namespace sync_sessions { |
| 27 | |
maxbogue | a79d99b7 | 2016-09-15 15:59:16 | [diff] [blame] | 28 | class LocalSessionEventRouter; |
| 29 | class SyncedWindowDelegatesGetter; |
| 30 | |
zea | f09345c | 2015-10-27 05:29:50 | [diff] [blame] | 31 | // Interface for clients of a sync sessions datatype. Should be used as a getter |
| 32 | // for services and data the Sync Sessions datatype depends on. |
| 33 | class SyncSessionsClient { |
| 34 | public: |
| 35 | SyncSessionsClient(); |
| 36 | virtual ~SyncSessionsClient(); |
| 37 | |
zea | 9c7707d | 2015-11-03 21:41:14 | [diff] [blame] | 38 | // Getters for services that sessions depends on. |
| 39 | virtual bookmarks::BookmarkModel* GetBookmarkModel() = 0; |
| 40 | virtual favicon::FaviconService* GetFaviconService() = 0; |
| 41 | virtual history::HistoryService* GetHistoryService() = 0; |
| 42 | |
zea | f09345c | 2015-10-27 05:29:50 | [diff] [blame] | 43 | // Checks if the given url is considered interesting enough to sync. Most urls |
| 44 | // are considered interesting. Examples of ones that are not are invalid urls, |
| 45 | // files, and chrome internal pages. |
| 46 | // TODO(zea): make this a standalone function if the url constants are |
| 47 | // componentized. |
| 48 | virtual bool ShouldSyncURL(const GURL& url) const = 0; |
| 49 | |
| 50 | // Returns the SyncedWindowDelegatesGetter for this client. |
maxbogue | a79d99b7 | 2016-09-15 15:59:16 | [diff] [blame] | 51 | virtual SyncedWindowDelegatesGetter* GetSyncedWindowDelegatesGetter() = 0; |
zea | f09345c | 2015-10-27 05:29:50 | [diff] [blame] | 52 | |
blundell | e95da1e | 2015-10-28 11:58:04 | [diff] [blame] | 53 | // Returns a LocalSessionEventRouter instance that is customized for the |
| 54 | // embedder's context. |
pnoland | 1901afa5 | 2017-03-23 21:24:00 | [diff] [blame] | 55 | virtual LocalSessionEventRouter* GetLocalSessionEventRouter() = 0; |
blundell | e95da1e | 2015-10-28 11:58:04 | [diff] [blame] | 56 | |
zea | f09345c | 2015-10-27 05:29:50 | [diff] [blame] | 57 | // TODO(zea): add getters for the history and favicon services for the favicon |
| 58 | // cache to consume once it's componentized. |
| 59 | |
| 60 | private: |
| 61 | DISALLOW_COPY_AND_ASSIGN(SyncSessionsClient); |
| 62 | }; |
| 63 | |
| 64 | } // namespace sync_sessions |
| 65 | |
| 66 | #endif // COMPONENTS_SYNC_SESSIONS_SYNC_SESSIONS_CLIENT_H_ |