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

Side by Side Diff: sync/notifier/sync_notifier.h

Issue 10702074: Refactor sync-specific parts out of SyncNotifier/SyncNotifierObserver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor cleanup Created 8 years, 5 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 (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 // Interface to the sync notifier, which is an object that receives 5 // Interface to the sync notifier, which is an object that receives
6 // notifications when updates are available for a set of sync types. 6 // notifications when updates are available for a set of sync types.
7 // All the observers are notified when such an event happens. 7 // All the observers are notified when such an event happens.
8 8
9 #ifndef SYNC_NOTIFIER_SYNC_NOTIFIER_H_ 9 #ifndef SYNC_NOTIFIER_SYNC_NOTIFIER_H_
10 #define SYNC_NOTIFIER_SYNC_NOTIFIER_H_ 10 #define SYNC_NOTIFIER_SYNC_NOTIFIER_H_
11 11
12 #include <string> 12 #include <string>
13 13
14 #include "sync/internal_api/public/base/model_type.h" 14 #include "sync/internal_api/public/base/model_type.h"
15 15
16 namespace syncer { 16 namespace syncer {
17 class SyncNotifierObserver; 17 class SyncNotifierObserver;
18 18
19 class SyncNotifier { 19 class SyncNotifier {
20 public: 20 public:
21 SyncNotifier() {} 21 SyncNotifier() {}
22 virtual ~SyncNotifier() {} 22 virtual ~SyncNotifier() {}
23 23
24 virtual void AddObserver(SyncNotifierObserver* observer) = 0; 24 virtual void AddHandler(SyncNotifierObserver* observer) = 0;
25 virtual void RemoveObserver(SyncNotifierObserver* observer) = 0; 25 virtual void RemoveHandler(SyncNotifierObserver* observer) = 0;
26 virtual void ReloadHandlers() = 0;
akalin 2012/07/11 00:10:24 I know ReloadHandlers was in my design doc. It wa
dcheng 2012/07/11 05:45:28 Add/Remove would push some of the diffing logic to
26 27
27 // SetUniqueId must be called once, before any call to 28 // SetUniqueId must be called once, before any call to
28 // UpdateCredentials. |unique_id| should be a non-empty globally 29 // UpdateCredentials. |unique_id| should be a non-empty globally
29 // unique string. 30 // unique string.
30 virtual void SetUniqueId(const std::string& unique_id) = 0; 31 virtual void SetUniqueId(const std::string& unique_id) = 0;
31 32
32 // SetState must be called once, before any call to 33 // SetState must be called once, before any call to
33 // UpdateCredentials. |state| may be empty. 34 // UpdateCredentials. |state| may be empty.
34 // Deprecated in favour of InvalidationStateTracker persistence. 35 // Deprecated in favour of InvalidationStateTracker persistence.
35 virtual void SetStateDeprecated(const std::string& state) = 0; 36 virtual void SetStateDeprecated(const std::string& state) = 0;
36 37
37 // The observers won't be notified of any notifications until 38 // The observers won't be notified of any notifications until
38 // UpdateCredentials is called at least once. It can be called more than 39 // UpdateCredentials is called at least once. It can be called more than
39 // once. 40 // once.
40 virtual void UpdateCredentials( 41 virtual void UpdateCredentials(
41 const std::string& email, const std::string& token) = 0; 42 const std::string& email, const std::string& token) = 0;
42 43
43 virtual void UpdateEnabledTypes(syncer::ModelTypeSet enabled_types) = 0;
44
45 // This is here only to support the old p2p notification implementation, 44 // This is here only to support the old p2p notification implementation,
46 // which is still used by sync integration tests. 45 // which is still used by sync integration tests.
47 // TODO(akalin): Remove this once we move the integration tests off p2p 46 // TODO(akalin): Remove this once we move the integration tests off p2p
48 // notifications. 47 // notifications.
49 virtual void SendNotification(syncer::ModelTypeSet changed_types) = 0; 48 virtual void SendNotification(syncer::ModelTypeSet changed_types) = 0;
50 }; 49 };
51 } // namespace syncer 50 } // namespace syncer
52 51
53 #endif // SYNC_NOTIFIER_SYNC_NOTIFIER_H_ 52 #endif // SYNC_NOTIFIER_SYNC_NOTIFIER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698