Update mojo surfaces bindings and mojo/cc/ glue
[chromium-blink-merge.git] / chrome / browser / notifications / sync_notifier / chrome_notifier_service.h
blob15a9fa376c54adb418936019eec4e94e795f0e62
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_CHROME_NOTIFIER_SERVICE_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_CHROME_NOTIFIER_SERVICE_H_
8 #include "base/memory/weak_ptr.h"
9 #include "components/keyed_service/core/keyed_service.h"
11 class Profile;
12 class SyncedNotificationsShim;
14 namespace extensions {
15 struct Event;
18 namespace notifier {
20 // The ChromeNotifierService acts as the bridge between sync and the JS
21 // extension that implements the synced notifications processing code.
22 // TODO(zea): consider making this a generic bridge for extension backed
23 // datatypes.
24 class ChromeNotifierService : public KeyedService {
25 public:
26 explicit ChromeNotifierService(Profile* profile);
27 virtual ~ChromeNotifierService();
29 // KeyedService implementation.
30 virtual void Shutdown() OVERRIDE;
32 // Returns the SyncableService for syncer::SYNCED_NOTIFICATIONS and
33 // syncer::SYNCED_NOTIFICATION_APP_INFO
34 SyncedNotificationsShim* GetSyncedNotificationsShim();
36 private:
37 // Helper method for firing JS events triggered by sync.
38 void FireSyncJSEvent(scoped_ptr<extensions::Event> event);
40 // Helper method for trigger synced notification refreshes.
41 void NotifyRefreshNeeded();
43 // The owning profile.
44 Profile* const profile_;
46 // Shim connecting the JS private api to sync. // TODO(zea): delete all other
47 // code.
48 scoped_ptr<SyncedNotificationsShim> synced_notifications_shim_;
50 base::WeakPtrFactory<ChromeNotifierService> weak_ptr_factory_;
52 DISALLOW_COPY_AND_ASSIGN(ChromeNotifierService);
55 } // namespace notifier
57 #endif // CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_CHROME_NOTIFIER_SERVICE_H_