Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_SYNC_DRIVER_SYNC_SERVICE_BASE_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_BASE_H_ |
| 6 #define COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_BASE_H_ | 6 #define COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_BASE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 // common functionality and member variables. Anything that can live inside the | 33 // common functionality and member variables. Anything that can live inside the |
| 34 // sync component should eventually live here instead of a concrete | 34 // sync component should eventually live here instead of a concrete |
| 35 // implementation. This is set up as a base class so things can be transferred | 35 // implementation. This is set up as a base class so things can be transferred |
| 36 // piece by piece as easily as possible. | 36 // piece by piece as easily as possible. |
| 37 class SyncServiceBase : public SyncService, public SyncEngineHost { | 37 class SyncServiceBase : public SyncService, public SyncEngineHost { |
| 38 public: | 38 public: |
| 39 SyncServiceBase(std::unique_ptr<SyncClient> sync_client, | 39 SyncServiceBase(std::unique_ptr<SyncClient> sync_client, |
| 40 std::unique_ptr<SigninManagerWrapper> signin, | 40 std::unique_ptr<SigninManagerWrapper> signin, |
| 41 const version_info::Channel& channel, | 41 const version_info::Channel& channel, |
| 42 const base::FilePath& base_directory, | 42 const base::FilePath& base_directory, |
| 43 const base::FilePath& local_sync_directory, | |
|
Nicolas Zea
2017/02/21 23:58:40
I wonder if this would be better plumbed in via th
pastarmovj
2017/02/22 14:23:14
Another great idea! :)
I think this clean up som
| |
| 43 const std::string& debug_identifier); | 44 const std::string& debug_identifier); |
| 44 ~SyncServiceBase() override; | 45 ~SyncServiceBase() override; |
| 45 | 46 |
| 46 // SyncService partial implementation. | 47 // SyncService partial implementation. |
| 47 void AddObserver(SyncServiceObserver* observer) override; | 48 void AddObserver(SyncServiceObserver* observer) override; |
| 48 void RemoveObserver(SyncServiceObserver* observer) override; | 49 void RemoveObserver(SyncServiceObserver* observer) override; |
| 49 bool HasObserver(const SyncServiceObserver* observer) const override; | 50 bool HasObserver(const SyncServiceObserver* observer) const override; |
| 50 | 51 |
| 51 protected: | 52 protected: |
| 52 // Notify all observers that a change has occurred. | 53 // Notify all observers that a change has occurred. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 | 86 |
| 86 // The path to the base directory under which sync should store its | 87 // The path to the base directory under which sync should store its |
| 87 // information. | 88 // information. |
| 88 const base::FilePath base_directory_; | 89 const base::FilePath base_directory_; |
| 89 | 90 |
| 90 // The full path to the sync data folder. The folder is not fully deleted when | 91 // The full path to the sync data folder. The folder is not fully deleted when |
| 91 // sync is disabled, since it holds both Directory and ModelTypeStore data. | 92 // sync is disabled, since it holds both Directory and ModelTypeStore data. |
| 92 // Directory files will be selectively targeted instead. | 93 // Directory files will be selectively targeted instead. |
| 93 const base::FilePath sync_data_folder_; | 94 const base::FilePath sync_data_folder_; |
| 94 | 95 |
| 96 // The full path to the folder used for storing the local sync database. | |
| 97 // It is only used when sync is running against its local backend. | |
| 98 const base::FilePath local_sync_directory_; | |
| 99 | |
| 95 // An identifier representing this instance for debugging purposes. | 100 // An identifier representing this instance for debugging purposes. |
| 96 const std::string debug_identifier_; | 101 const std::string debug_identifier_; |
| 97 | 102 |
| 98 // The class that handles getting, setting, and persisting sync | 103 // The class that handles getting, setting, and persisting sync |
| 99 // preferences. | 104 // preferences. |
| 100 SyncPrefs sync_prefs_; | 105 SyncPrefs sync_prefs_; |
| 101 | 106 |
| 102 // A utility object containing logic and state relating to encryption. It is | 107 // A utility object containing logic and state relating to encryption. It is |
| 103 // never null. | 108 // never null. |
| 104 std::unique_ptr<SyncServiceCrypto> crypto_; | 109 std::unique_ptr<SyncServiceCrypto> crypto_; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 122 | 127 |
| 123 private: | 128 private: |
| 124 bool GetLocalSyncConfig(base::FilePath* local_sync_backend_folder) const; | 129 bool GetLocalSyncConfig(base::FilePath* local_sync_backend_folder) const; |
| 125 | 130 |
| 126 DISALLOW_COPY_AND_ASSIGN(SyncServiceBase); | 131 DISALLOW_COPY_AND_ASSIGN(SyncServiceBase); |
| 127 }; | 132 }; |
| 128 | 133 |
| 129 } // namespace syncer | 134 } // namespace syncer |
| 130 | 135 |
| 131 #endif // COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_BASE_H_ | 136 #endif // COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_BASE_H_ |
| OLD | NEW |