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_CHROME_SYNC_NOTIFICATION_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_CHROME_SYNC_NOTIFICATION_BRIDGE_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_CHROME_SYNC_NOTIFICATION_BRIDGE_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_CHROME_SYNC_NOTIFICATION_BRIDGE_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // each observer's OnIncomingNotification method on these | 29 // each observer's OnIncomingNotification method on these |
30 // notifications (on the sync task runner). | 30 // notifications (on the sync task runner). |
31 class ChromeSyncNotificationBridge : public content::NotificationObserver { | 31 class ChromeSyncNotificationBridge : public content::NotificationObserver { |
32 public: | 32 public: |
33 // Must be created and destroyed on the UI thread. | 33 // Must be created and destroyed on the UI thread. |
34 ChromeSyncNotificationBridge( | 34 ChromeSyncNotificationBridge( |
35 const Profile* profile, | 35 const Profile* profile, |
36 const scoped_refptr<base::SequencedTaskRunner>& sync_task_runner); | 36 const scoped_refptr<base::SequencedTaskRunner>& sync_task_runner); |
37 virtual ~ChromeSyncNotificationBridge(); | 37 virtual ~ChromeSyncNotificationBridge(); |
38 | 38 |
| 39 // Must be called on the UI thread while the sync task runner is still |
| 40 // around. No other member functions on the sync thread may be called after |
| 41 // this is called. |
| 42 void StopForShutdown(); |
| 43 |
39 // Must be called on the sync task runner. | 44 // Must be called on the sync task runner. |
40 void UpdateEnabledTypes(syncer::ModelTypeSet enabled_types); | 45 void UpdateEnabledTypes(syncer::ModelTypeSet enabled_types); |
41 // Marked virtual for tests. | 46 // Marked virtual for tests. |
| 47 virtual void RegisterHandler(syncer::SyncNotifierObserver* handler); |
42 virtual void UpdateRegisteredIds(syncer::SyncNotifierObserver* handler, | 48 virtual void UpdateRegisteredIds(syncer::SyncNotifierObserver* handler, |
43 const syncer::ObjectIdSet& ids); | 49 const syncer::ObjectIdSet& ids); |
| 50 virtual void UnregisterHandler(syncer::SyncNotifierObserver* handler); |
44 | 51 |
45 // NotificationObserver implementation. Called on UI thread. | 52 // NotificationObserver implementation. Called on UI thread. |
46 virtual void Observe(int type, | 53 virtual void Observe(int type, |
47 const content::NotificationSource& source, | 54 const content::NotificationSource& source, |
48 const content::NotificationDetails& details) OVERRIDE; | 55 const content::NotificationDetails& details) OVERRIDE; |
49 | 56 |
50 private: | 57 private: |
51 // Inner class to hold all the bits used on |sync_task_runner_|. | 58 // Inner class to hold all the bits used on |sync_task_runner_|. |
52 class Core; | 59 class Core; |
53 | 60 |
54 const scoped_refptr<base::SequencedTaskRunner> sync_task_runner_; | 61 const scoped_refptr<base::SequencedTaskRunner> sync_task_runner_; |
55 | 62 |
56 // Created on the UI thread, used only on |sync_task_runner_|. | 63 // Created on the UI thread, used only on |sync_task_runner_|. |
57 const scoped_refptr<Core> core_; | 64 const scoped_refptr<Core> core_; |
58 | 65 |
59 // Used only on the UI thread. | 66 // Used only on the UI thread. |
60 content::NotificationRegistrar registrar_; | 67 content::NotificationRegistrar registrar_; |
61 }; | 68 }; |
62 | 69 |
63 } // namespace browser_sync | 70 } // namespace browser_sync |
64 | 71 |
65 #endif // CHROME_BROWSER_SYNC_GLUE_CHROME_SYNC_NOTIFICATION_BRIDGE_H_ | 72 #endif // CHROME_BROWSER_SYNC_GLUE_CHROME_SYNC_NOTIFICATION_BRIDGE_H_ |
OLD | NEW |