OLD | NEW |
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 #ifndef CHROME_BROWSER_SYNC_GLUE_BRIDGED_SYNC_NOTIFIER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_BRIDGED_SYNC_NOTIFIER_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_BRIDGED_SYNC_NOTIFIER_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_BRIDGED_SYNC_NOTIFIER_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "sync/notifier/sync_notifier.h" | 10 #include "sync/notifier/sync_notifier.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // ChromeSyncNotificationBridge. | 21 // ChromeSyncNotificationBridge. |
22 class BridgedSyncNotifier : public syncer::SyncNotifier { | 22 class BridgedSyncNotifier : public syncer::SyncNotifier { |
23 public: | 23 public: |
24 // Does not take ownership of |bridge|. Takes ownership of |delegate|. | 24 // Does not take ownership of |bridge|. Takes ownership of |delegate|. |
25 // |delegate| may be NULL. | 25 // |delegate| may be NULL. |
26 BridgedSyncNotifier(ChromeSyncNotificationBridge* bridge, | 26 BridgedSyncNotifier(ChromeSyncNotificationBridge* bridge, |
27 syncer::SyncNotifier* delegate); | 27 syncer::SyncNotifier* delegate); |
28 virtual ~BridgedSyncNotifier(); | 28 virtual ~BridgedSyncNotifier(); |
29 | 29 |
30 // SyncNotifier implementation. Passes through all calls to the delegate. | 30 // SyncNotifier implementation. Passes through all calls to the delegate. |
31 // AddObserver/RemoveObserver will also register/deregister |observer| with | 31 // UpdateRegisteredIds calls will also be forwarded to the bridge. |
32 // the bridge. | 32 virtual void UpdateRegisteredIds(syncer::SyncNotifierObserver* handler, |
33 virtual void AddObserver( | 33 const syncer::ObjectIdSet& ids) OVERRIDE; |
34 syncer::SyncNotifierObserver* observer) OVERRIDE; | |
35 virtual void RemoveObserver( | |
36 syncer::SyncNotifierObserver* observer) OVERRIDE; | |
37 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE; | 34 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE; |
38 virtual void SetStateDeprecated(const std::string& state) OVERRIDE; | 35 virtual void SetStateDeprecated(const std::string& state) OVERRIDE; |
39 virtual void UpdateCredentials( | 36 virtual void UpdateCredentials( |
40 const std::string& email, const std::string& token) OVERRIDE; | 37 const std::string& email, const std::string& token) OVERRIDE; |
41 virtual void UpdateEnabledTypes( | |
42 syncer::ModelTypeSet enabled_types) OVERRIDE; | |
43 virtual void SendNotification( | 38 virtual void SendNotification( |
44 syncer::ModelTypeSet changed_types) OVERRIDE; | 39 syncer::ModelTypeSet changed_types) OVERRIDE; |
45 | 40 |
46 private: | 41 private: |
47 // The notification bridge that we register the observers with. | 42 // The notification bridge that we register the observers with. |
48 ChromeSyncNotificationBridge* bridge_; | 43 ChromeSyncNotificationBridge* bridge_; |
49 | 44 |
50 // The delegate we are wrapping. | 45 // The delegate we are wrapping. |
51 scoped_ptr<syncer::SyncNotifier> delegate_; | 46 scoped_ptr<syncer::SyncNotifier> delegate_; |
52 }; | 47 }; |
53 | 48 |
54 } // namespace browser_sync | 49 } // namespace browser_sync |
55 | 50 |
56 #endif // CHROME_BROWSER_SYNC_GLUE_BRIDGED_SYNC_NOTIFIER_H_ | 51 #endif // CHROME_BROWSER_SYNC_GLUE_BRIDGED_SYNC_NOTIFIER_H_ |
OLD | NEW |