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

Side by Side Diff: sync/internal_api/sync_manager_impl.h

Issue 11620007: Switch from OnIPAddressChanged and OnConnectionTypeChange to OnNetworkChanged Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // SyncManager encapsulates syncable::Directory and serves as the parent of all 42 // SyncManager encapsulates syncable::Directory and serves as the parent of all
43 // other objects in the sync API. If multiple threads interact with the same 43 // other objects in the sync API. If multiple threads interact with the same
44 // local sync repository (i.e. the same sqlite database), they should share a 44 // local sync repository (i.e. the same sqlite database), they should share a
45 // single SyncManager instance. The caller should typically create one 45 // single SyncManager instance. The caller should typically create one
46 // SyncManager for the lifetime of a user session. 46 // SyncManager for the lifetime of a user session.
47 // 47 //
48 // Unless stated otherwise, all methods of SyncManager should be called on the 48 // Unless stated otherwise, all methods of SyncManager should be called on the
49 // same thread. 49 // same thread.
50 class SYNC_EXPORT_PRIVATE SyncManagerImpl : 50 class SYNC_EXPORT_PRIVATE SyncManagerImpl :
51 public SyncManager, 51 public SyncManager,
52 public net::NetworkChangeNotifier::IPAddressObserver, 52 public net::NetworkChangeNotifier::NetworkChangeObserver,
53 public net::NetworkChangeNotifier::ConnectionTypeObserver,
54 public InvalidationHandler, 53 public InvalidationHandler,
55 public JsBackend, 54 public JsBackend,
56 public SyncEngineEventListener, 55 public SyncEngineEventListener,
57 public ServerConnectionEventListener, 56 public ServerConnectionEventListener,
58 public syncable::DirectoryChangeDelegate, 57 public syncable::DirectoryChangeDelegate,
59 public SyncEncryptionHandler::Observer { 58 public SyncEncryptionHandler::Observer {
60 public: 59 public:
61 // Create an uninitialized SyncManager. Callers must Init() before using. 60 // Create an uninitialized SyncManager. Callers must Init() before using.
62 explicit SyncManagerImpl(const std::string& name); 61 explicit SyncManagerImpl(const std::string& name);
63 virtual ~SyncManagerImpl(); 62 virtual ~SyncManagerImpl();
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, 171 const syncable::ImmutableWriteTransactionInfo& write_transaction_info,
173 syncable::BaseTransaction* trans, 172 syncable::BaseTransaction* trans,
174 std::vector<int64>* entries_changed) OVERRIDE; 173 std::vector<int64>* entries_changed) OVERRIDE;
175 174
176 // InvalidationHandler implementation. 175 // InvalidationHandler implementation.
177 virtual void OnInvalidatorStateChange(InvalidatorState state) OVERRIDE; 176 virtual void OnInvalidatorStateChange(InvalidatorState state) OVERRIDE;
178 virtual void OnIncomingInvalidation( 177 virtual void OnIncomingInvalidation(
179 const ObjectIdInvalidationMap& invalidation_map, 178 const ObjectIdInvalidationMap& invalidation_map,
180 IncomingInvalidationSource source) OVERRIDE; 179 IncomingInvalidationSource source) OVERRIDE;
181 180
182 // These OnYYYChanged() methods are only called by our NetworkChangeNotifier. 181 // Called by the NetworkChangeNotifier when a significant change to the
183 // Called when IP address of primary interface changes. 182 // network connection has occurred.
184 virtual void OnIPAddressChanged() OVERRIDE; 183 virtual void OnNetworkChanged(
185 // Called when the connection type of the system has changed. 184 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE;
186 virtual void OnConnectionTypeChanged(
187 net::NetworkChangeNotifier::ConnectionType) OVERRIDE;
188 185
189 const SyncScheduler* scheduler() const; 186 const SyncScheduler* scheduler() const;
190 187
191 bool GetHasInvalidAuthTokenForTest() const; 188 bool GetHasInvalidAuthTokenForTest() const;
192 189
193 private: 190 private:
194 friend class SyncManagerTest; 191 friend class SyncManagerTest;
195 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, NudgeDelayTest); 192 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, NudgeDelayTest);
196 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, OnNotificationStateChange); 193 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, OnNotificationStateChange);
197 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, OnIncomingNotification); 194 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, OnIncomingNotification);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // changing passphrases, and in general handles sync-specific interactions 375 // changing passphrases, and in general handles sync-specific interactions
379 // with the cryptographer. 376 // with the cryptographer.
380 scoped_ptr<SyncEncryptionHandlerImpl> sync_encryption_handler_; 377 scoped_ptr<SyncEncryptionHandlerImpl> sync_encryption_handler_;
381 378
382 DISALLOW_COPY_AND_ASSIGN(SyncManagerImpl); 379 DISALLOW_COPY_AND_ASSIGN(SyncManagerImpl);
383 }; 380 };
384 381
385 } // namespace syncer 382 } // namespace syncer
386 383
387 #endif // SYNC_INTERNAL_API_SYNC_MANAGER_H_ 384 #endif // SYNC_INTERNAL_API_SYNC_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698