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_NOTIFIER_BRIDGED_SYNC_NOTIFIER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_BRIDGED_SYNC_NOTIFIER_H_ |
6 #define CHROME_BROWSER_SYNC_NOTIFIER_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 "chrome/browser/sync/notifier/sync_notifier.h" | 10 #include "chrome/browser/sync/notifier/sync_notifier.h" |
11 | 11 |
12 namespace sync_notifier { | 12 namespace browser_sync { |
13 | 13 |
14 class ChromeSyncNotificationBridge; | 14 class ChromeSyncNotificationBridge; |
15 | 15 |
16 // A SyncNotifier implementation that wraps a ChromeSyncNotificationBridge | 16 // A SyncNotifier implementation that wraps a ChromeSyncNotificationBridge |
17 // and a SyncNotifier delegate (which it takes ownership of). All SyncNotifier | 17 // and a SyncNotifier delegate (which it takes ownership of). All SyncNotifier |
18 // calls are passed straight through to the delegate, with the exception of | 18 // calls are passed straight through to the delegate, with the exception of |
19 // AddObserver/RemoveObserver, which also result in the observer being | 19 // AddObserver/RemoveObserver, which also result in the observer being |
20 // registered/deregistered with the ChromeSyncNotificationBridge. | 20 // registered/deregistered with the ChromeSyncNotificationBridge. |
21 class BridgedSyncNotifier : public SyncNotifier { | 21 class BridgedSyncNotifier : public sync_notifier::SyncNotifier { |
22 public: | 22 public: |
23 // Does not take ownership of |bridge|. Takes ownership of |delegate|. | 23 // Does not take ownership of |bridge|. Takes ownership of |delegate|. |
24 BridgedSyncNotifier(ChromeSyncNotificationBridge* bridge, | 24 BridgedSyncNotifier(ChromeSyncNotificationBridge* bridge, |
25 SyncNotifier* delegate); | 25 sync_notifier::SyncNotifier* delegate); |
26 virtual ~BridgedSyncNotifier(); | 26 virtual ~BridgedSyncNotifier(); |
27 | 27 |
28 // SyncNotifier implementation. Passes through all calls to the delegate. | 28 // SyncNotifier implementation. Passes through all calls to the delegate. |
29 // AddObserver/RemoveObserver will also register/deregister |observer| with | 29 // AddObserver/RemoveObserver will also register/deregister |observer| with |
30 // the bridge. | 30 // the bridge. |
31 virtual void AddObserver(SyncNotifierObserver* observer) OVERRIDE; | 31 virtual void AddObserver( |
32 virtual void RemoveObserver(SyncNotifierObserver* observer) OVERRIDE; | 32 sync_notifier::SyncNotifierObserver* observer) OVERRIDE; |
| 33 virtual void RemoveObserver( |
| 34 sync_notifier::SyncNotifierObserver* observer) OVERRIDE; |
33 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE; | 35 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE; |
34 virtual void SetState(const std::string& state) OVERRIDE; | 36 virtual void SetState(const std::string& state) OVERRIDE; |
35 virtual void UpdateCredentials( | 37 virtual void UpdateCredentials( |
36 const std::string& email, const std::string& token) OVERRIDE; | 38 const std::string& email, const std::string& token) OVERRIDE; |
37 virtual void UpdateEnabledTypes( | 39 virtual void UpdateEnabledTypes( |
38 syncable::ModelTypeSet enabled_types) OVERRIDE; | 40 syncable::ModelTypeSet enabled_types) OVERRIDE; |
39 virtual void SendNotification( | 41 virtual void SendNotification( |
40 syncable::ModelTypeSet changed_types) OVERRIDE; | 42 syncable::ModelTypeSet changed_types) OVERRIDE; |
41 | 43 |
42 private: | 44 private: |
43 // The notification bridge that we register the observers with. | 45 // The notification bridge that we register the observers with. |
44 ChromeSyncNotificationBridge* bridge_; | 46 ChromeSyncNotificationBridge* bridge_; |
45 | 47 |
46 // The delegate we are wrapping. | 48 // The delegate we are wrapping. |
47 scoped_ptr<SyncNotifier> delegate_; | 49 scoped_ptr<sync_notifier::SyncNotifier> delegate_; |
48 }; | 50 }; |
49 | 51 |
50 } // namespace sync_notifier | 52 } // namespace browser_sync |
51 | 53 |
52 #endif // CHROME_BROWSER_SYNC_NOTIFIER_BRIDGED_SYNC_NOTIFIER_H_ | 54 #endif // CHROME_BROWSER_SYNC_GLUE_BRIDGED_SYNC_NOTIFIER_H_ |
OLD | NEW |