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

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

Issue 10823037: Revert r148496 "Refactor sync-specific parts out of SyncNotifier/SyncNotifierObserver" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « sync/notifier/p2p_notifier_unittest.cc ('k') | sync/notifier/sync_notifier_factory_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "sync/notifier/invalidation_util.h"
16 15
17 namespace syncer { 16 namespace syncer {
18 class SyncNotifierObserver; 17 class SyncNotifierObserver;
19 18
20 class SyncNotifier { 19 class SyncNotifier {
21 public: 20 public:
22 SyncNotifier() {} 21 SyncNotifier() {}
23 virtual ~SyncNotifier() {} 22 virtual ~SyncNotifier() {}
24 23
25 // Updates the set of ObjectIds associated with a given |handler|. Passing an 24 virtual void AddObserver(SyncNotifierObserver* observer) = 0;
26 // empty ObjectIdSet will unregister |handler|. If two different handlers 25 virtual void RemoveObserver(SyncNotifierObserver* observer) = 0;
27 // attempt to register for the same object ID, the first registration wins.
28 virtual void UpdateRegisteredIds(SyncNotifierObserver* handler,
29 const ObjectIdSet& ids) = 0;
30 26
31 // SetUniqueId must be called once, before any call to 27 // SetUniqueId must be called once, before any call to
32 // UpdateCredentials. |unique_id| should be a non-empty globally 28 // UpdateCredentials. |unique_id| should be a non-empty globally
33 // unique string. 29 // unique string.
34 virtual void SetUniqueId(const std::string& unique_id) = 0; 30 virtual void SetUniqueId(const std::string& unique_id) = 0;
35 31
36 // SetState must be called once, before any call to 32 // SetState must be called once, before any call to
37 // UpdateCredentials. |state| may be empty. 33 // UpdateCredentials. |state| may be empty.
38 // Deprecated in favour of InvalidationStateTracker persistence. 34 // Deprecated in favour of InvalidationStateTracker persistence.
39 virtual void SetStateDeprecated(const std::string& state) = 0; 35 virtual void SetStateDeprecated(const std::string& state) = 0;
40 36
41 // The observers won't be notified of any notifications until 37 // The observers won't be notified of any notifications until
42 // UpdateCredentials is called at least once. It can be called more than 38 // UpdateCredentials is called at least once. It can be called more than
43 // once. 39 // once.
44 virtual void UpdateCredentials( 40 virtual void UpdateCredentials(
45 const std::string& email, const std::string& token) = 0; 41 const std::string& email, const std::string& token) = 0;
46 42
43 virtual void UpdateEnabledTypes(ModelTypeSet enabled_types) = 0;
44
47 // This is here only to support the old p2p notification implementation, 45 // This is here only to support the old p2p notification implementation,
48 // which is still used by sync integration tests. 46 // which is still used by sync integration tests.
49 // TODO(akalin): Remove this once we move the integration tests off p2p 47 // TODO(akalin): Remove this once we move the integration tests off p2p
50 // notifications. 48 // notifications.
51 virtual void SendNotification(ModelTypeSet changed_types) = 0; 49 virtual void SendNotification(ModelTypeSet changed_types) = 0;
52 }; 50 };
53 } // namespace syncer 51 } // namespace syncer
54 52
55 #endif // SYNC_NOTIFIER_SYNC_NOTIFIER_H_ 53 #endif // SYNC_NOTIFIER_SYNC_NOTIFIER_H_
OLDNEW
« no previous file with comments | « sync/notifier/p2p_notifier_unittest.cc ('k') | sync/notifier/sync_notifier_factory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698