OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 5 #ifndef SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
6 #define SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 6 #define SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 public ServerConnectionEventListener, | 61 public ServerConnectionEventListener, |
62 public syncable::DirectoryChangeDelegate, | 62 public syncable::DirectoryChangeDelegate, |
63 public SyncEncryptionHandler::Observer, | 63 public SyncEncryptionHandler::Observer, |
64 public NudgeHandler { | 64 public NudgeHandler { |
65 public: | 65 public: |
66 // Create an uninitialized SyncManager. Callers must Init() before using. | 66 // Create an uninitialized SyncManager. Callers must Init() before using. |
67 explicit SyncManagerImpl(const std::string& name); | 67 explicit SyncManagerImpl(const std::string& name); |
68 virtual ~SyncManagerImpl(); | 68 virtual ~SyncManagerImpl(); |
69 | 69 |
70 // SyncManager implementation. | 70 // SyncManager implementation. |
71 virtual void Init(InitArgs* args) OVERRIDE; | 71 virtual void Init(InitArgs* args) override; |
72 virtual ModelTypeSet InitialSyncEndedTypes() OVERRIDE; | 72 virtual ModelTypeSet InitialSyncEndedTypes() override; |
73 virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken( | 73 virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken( |
74 ModelTypeSet types) OVERRIDE; | 74 ModelTypeSet types) override; |
75 virtual bool PurgePartiallySyncedTypes() OVERRIDE; | 75 virtual bool PurgePartiallySyncedTypes() override; |
76 virtual void UpdateCredentials(const SyncCredentials& credentials) OVERRIDE; | 76 virtual void UpdateCredentials(const SyncCredentials& credentials) override; |
77 virtual void StartSyncingNormally( | 77 virtual void StartSyncingNormally( |
78 const ModelSafeRoutingInfo& routing_info) OVERRIDE; | 78 const ModelSafeRoutingInfo& routing_info) override; |
79 virtual void ConfigureSyncer( | 79 virtual void ConfigureSyncer( |
80 ConfigureReason reason, | 80 ConfigureReason reason, |
81 ModelTypeSet to_download, | 81 ModelTypeSet to_download, |
82 ModelTypeSet to_purge, | 82 ModelTypeSet to_purge, |
83 ModelTypeSet to_journal, | 83 ModelTypeSet to_journal, |
84 ModelTypeSet to_unapply, | 84 ModelTypeSet to_unapply, |
85 const ModelSafeRoutingInfo& new_routing_info, | 85 const ModelSafeRoutingInfo& new_routing_info, |
86 const base::Closure& ready_task, | 86 const base::Closure& ready_task, |
87 const base::Closure& retry_task) OVERRIDE; | 87 const base::Closure& retry_task) override; |
88 virtual void SetInvalidatorEnabled(bool invalidator_enabled) OVERRIDE; | 88 virtual void SetInvalidatorEnabled(bool invalidator_enabled) override; |
89 virtual void OnIncomingInvalidation( | 89 virtual void OnIncomingInvalidation( |
90 syncer::ModelType type, | 90 syncer::ModelType type, |
91 scoped_ptr<InvalidationInterface> invalidation) OVERRIDE; | 91 scoped_ptr<InvalidationInterface> invalidation) override; |
92 virtual void AddObserver(SyncManager::Observer* observer) OVERRIDE; | 92 virtual void AddObserver(SyncManager::Observer* observer) override; |
93 virtual void RemoveObserver(SyncManager::Observer* observer) OVERRIDE; | 93 virtual void RemoveObserver(SyncManager::Observer* observer) override; |
94 virtual SyncStatus GetDetailedStatus() const OVERRIDE; | 94 virtual SyncStatus GetDetailedStatus() const override; |
95 virtual void SaveChanges() OVERRIDE; | 95 virtual void SaveChanges() override; |
96 virtual void ShutdownOnSyncThread(ShutdownReason reason) OVERRIDE; | 96 virtual void ShutdownOnSyncThread(ShutdownReason reason) override; |
97 virtual UserShare* GetUserShare() OVERRIDE; | 97 virtual UserShare* GetUserShare() override; |
98 virtual syncer::SyncContextProxy* GetSyncContextProxy() OVERRIDE; | 98 virtual syncer::SyncContextProxy* GetSyncContextProxy() override; |
99 virtual const std::string cache_guid() OVERRIDE; | 99 virtual const std::string cache_guid() override; |
100 virtual bool ReceivedExperiment(Experiments* experiments) OVERRIDE; | 100 virtual bool ReceivedExperiment(Experiments* experiments) override; |
101 virtual bool HasUnsyncedItems() OVERRIDE; | 101 virtual bool HasUnsyncedItems() override; |
102 virtual SyncEncryptionHandler* GetEncryptionHandler() OVERRIDE; | 102 virtual SyncEncryptionHandler* GetEncryptionHandler() override; |
103 virtual ScopedVector<syncer::ProtocolEvent> | 103 virtual ScopedVector<syncer::ProtocolEvent> |
104 GetBufferedProtocolEvents() OVERRIDE; | 104 GetBufferedProtocolEvents() override; |
105 virtual scoped_ptr<base::ListValue> GetAllNodesForType( | 105 virtual scoped_ptr<base::ListValue> GetAllNodesForType( |
106 syncer::ModelType type) OVERRIDE; | 106 syncer::ModelType type) override; |
107 virtual void RegisterDirectoryTypeDebugInfoObserver( | 107 virtual void RegisterDirectoryTypeDebugInfoObserver( |
108 syncer::TypeDebugInfoObserver* observer) OVERRIDE; | 108 syncer::TypeDebugInfoObserver* observer) override; |
109 virtual void UnregisterDirectoryTypeDebugInfoObserver( | 109 virtual void UnregisterDirectoryTypeDebugInfoObserver( |
110 syncer::TypeDebugInfoObserver* observer) OVERRIDE; | 110 syncer::TypeDebugInfoObserver* observer) override; |
111 virtual bool HasDirectoryTypeDebugInfoObserver( | 111 virtual bool HasDirectoryTypeDebugInfoObserver( |
112 syncer::TypeDebugInfoObserver* observer) OVERRIDE; | 112 syncer::TypeDebugInfoObserver* observer) override; |
113 virtual void RequestEmitDebugInfo() OVERRIDE; | 113 virtual void RequestEmitDebugInfo() override; |
114 | 114 |
115 // SyncEncryptionHandler::Observer implementation. | 115 // SyncEncryptionHandler::Observer implementation. |
116 virtual void OnPassphraseRequired( | 116 virtual void OnPassphraseRequired( |
117 PassphraseRequiredReason reason, | 117 PassphraseRequiredReason reason, |
118 const sync_pb::EncryptedData& pending_keys) OVERRIDE; | 118 const sync_pb::EncryptedData& pending_keys) override; |
119 virtual void OnPassphraseAccepted() OVERRIDE; | 119 virtual void OnPassphraseAccepted() override; |
120 virtual void OnBootstrapTokenUpdated( | 120 virtual void OnBootstrapTokenUpdated( |
121 const std::string& bootstrap_token, | 121 const std::string& bootstrap_token, |
122 BootstrapTokenType type) OVERRIDE; | 122 BootstrapTokenType type) override; |
123 virtual void OnEncryptedTypesChanged( | 123 virtual void OnEncryptedTypesChanged( |
124 ModelTypeSet encrypted_types, | 124 ModelTypeSet encrypted_types, |
125 bool encrypt_everything) OVERRIDE; | 125 bool encrypt_everything) override; |
126 virtual void OnEncryptionComplete() OVERRIDE; | 126 virtual void OnEncryptionComplete() override; |
127 virtual void OnCryptographerStateChanged( | 127 virtual void OnCryptographerStateChanged( |
128 Cryptographer* cryptographer) OVERRIDE; | 128 Cryptographer* cryptographer) override; |
129 virtual void OnPassphraseTypeChanged( | 129 virtual void OnPassphraseTypeChanged( |
130 PassphraseType type, | 130 PassphraseType type, |
131 base::Time explicit_passphrase_time) OVERRIDE; | 131 base::Time explicit_passphrase_time) override; |
132 | 132 |
133 // SyncEngineEventListener implementation. | 133 // SyncEngineEventListener implementation. |
134 virtual void OnSyncCycleEvent(const SyncCycleEvent& event) OVERRIDE; | 134 virtual void OnSyncCycleEvent(const SyncCycleEvent& event) override; |
135 virtual void OnActionableError(const SyncProtocolError& error) OVERRIDE; | 135 virtual void OnActionableError(const SyncProtocolError& error) override; |
136 virtual void OnRetryTimeChanged(base::Time retry_time) OVERRIDE; | 136 virtual void OnRetryTimeChanged(base::Time retry_time) override; |
137 virtual void OnThrottledTypesChanged(ModelTypeSet throttled_types) OVERRIDE; | 137 virtual void OnThrottledTypesChanged(ModelTypeSet throttled_types) override; |
138 virtual void OnMigrationRequested(ModelTypeSet types) OVERRIDE; | 138 virtual void OnMigrationRequested(ModelTypeSet types) override; |
139 virtual void OnProtocolEvent(const ProtocolEvent& event) OVERRIDE; | 139 virtual void OnProtocolEvent(const ProtocolEvent& event) override; |
140 | 140 |
141 // ServerConnectionEventListener implementation. | 141 // ServerConnectionEventListener implementation. |
142 virtual void OnServerConnectionEvent( | 142 virtual void OnServerConnectionEvent( |
143 const ServerConnectionEvent& event) OVERRIDE; | 143 const ServerConnectionEvent& event) override; |
144 | 144 |
145 // JsBackend implementation. | 145 // JsBackend implementation. |
146 virtual void SetJsEventHandler( | 146 virtual void SetJsEventHandler( |
147 const WeakHandle<JsEventHandler>& event_handler) OVERRIDE; | 147 const WeakHandle<JsEventHandler>& event_handler) override; |
148 | 148 |
149 // DirectoryChangeDelegate implementation. | 149 // DirectoryChangeDelegate implementation. |
150 // This listener is called upon completion of a syncable transaction, and | 150 // This listener is called upon completion of a syncable transaction, and |
151 // builds the list of sync-engine initiated changes that will be forwarded to | 151 // builds the list of sync-engine initiated changes that will be forwarded to |
152 // the SyncManager's Observers. | 152 // the SyncManager's Observers. |
153 virtual void HandleTransactionCompleteChangeEvent( | 153 virtual void HandleTransactionCompleteChangeEvent( |
154 ModelTypeSet models_with_changes) OVERRIDE; | 154 ModelTypeSet models_with_changes) override; |
155 virtual ModelTypeSet HandleTransactionEndingChangeEvent( | 155 virtual ModelTypeSet HandleTransactionEndingChangeEvent( |
156 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, | 156 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, |
157 syncable::BaseTransaction* trans) OVERRIDE; | 157 syncable::BaseTransaction* trans) override; |
158 virtual void HandleCalculateChangesChangeEventFromSyncApi( | 158 virtual void HandleCalculateChangesChangeEventFromSyncApi( |
159 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, | 159 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, |
160 syncable::BaseTransaction* trans, | 160 syncable::BaseTransaction* trans, |
161 std::vector<int64>* entries_changed) OVERRIDE; | 161 std::vector<int64>* entries_changed) override; |
162 virtual void HandleCalculateChangesChangeEventFromSyncer( | 162 virtual void HandleCalculateChangesChangeEventFromSyncer( |
163 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, | 163 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, |
164 syncable::BaseTransaction* trans, | 164 syncable::BaseTransaction* trans, |
165 std::vector<int64>* entries_changed) OVERRIDE; | 165 std::vector<int64>* entries_changed) override; |
166 | 166 |
167 // Handle explicit requests to fetch updates for the given types. | 167 // Handle explicit requests to fetch updates for the given types. |
168 virtual void RefreshTypes(ModelTypeSet types) OVERRIDE; | 168 virtual void RefreshTypes(ModelTypeSet types) override; |
169 | 169 |
170 // These OnYYYChanged() methods are only called by our NetworkChangeNotifier. | 170 // These OnYYYChanged() methods are only called by our NetworkChangeNotifier. |
171 // Called when IP address of primary interface changes. | 171 // Called when IP address of primary interface changes. |
172 virtual void OnIPAddressChanged() OVERRIDE; | 172 virtual void OnIPAddressChanged() override; |
173 // Called when the connection type of the system has changed. | 173 // Called when the connection type of the system has changed. |
174 virtual void OnConnectionTypeChanged( | 174 virtual void OnConnectionTypeChanged( |
175 net::NetworkChangeNotifier::ConnectionType) OVERRIDE; | 175 net::NetworkChangeNotifier::ConnectionType) override; |
176 | 176 |
177 // NudgeHandler implementation. | 177 // NudgeHandler implementation. |
178 virtual void NudgeForInitialDownload(syncer::ModelType type) OVERRIDE; | 178 virtual void NudgeForInitialDownload(syncer::ModelType type) override; |
179 virtual void NudgeForCommit(syncer::ModelType type) OVERRIDE; | 179 virtual void NudgeForCommit(syncer::ModelType type) override; |
180 virtual void NudgeForRefresh(syncer::ModelType type) OVERRIDE; | 180 virtual void NudgeForRefresh(syncer::ModelType type) override; |
181 | 181 |
182 const SyncScheduler* scheduler() const; | 182 const SyncScheduler* scheduler() const; |
183 | 183 |
184 bool GetHasInvalidAuthTokenForTest() const; | 184 bool GetHasInvalidAuthTokenForTest() const; |
185 | 185 |
186 protected: | 186 protected: |
187 // Helper functions. Virtual for testing. | 187 // Helper functions. Virtual for testing. |
188 virtual void NotifyInitializationSuccess(); | 188 virtual void NotifyInitializationSuccess(); |
189 virtual void NotifyInitializationFailure(); | 189 virtual void NotifyInitializationFailure(); |
190 | 190 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 scoped_ptr<SyncEncryptionHandlerImpl> sync_encryption_handler_; | 345 scoped_ptr<SyncEncryptionHandlerImpl> sync_encryption_handler_; |
346 | 346 |
347 base::WeakPtrFactory<SyncManagerImpl> weak_ptr_factory_; | 347 base::WeakPtrFactory<SyncManagerImpl> weak_ptr_factory_; |
348 | 348 |
349 DISALLOW_COPY_AND_ASSIGN(SyncManagerImpl); | 349 DISALLOW_COPY_AND_ASSIGN(SyncManagerImpl); |
350 }; | 350 }; |
351 | 351 |
352 } // namespace syncer | 352 } // namespace syncer |
353 | 353 |
354 #endif // SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 354 #endif // SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
OLD | NEW |