| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_EXTENSIONS_API_SYNCED_NOTIFICATIONS_PRIVATE_SYNCED_NOTIFI
CATIONS_SHIM_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SYNCED_NOTIFICATIONS_PRIVATE_SYNCED_NOTIFI
CATIONS_SHIM_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_SYNCED_NOTIFICATIONS_PRIVATE_SYNCED_NOTIFI
CATIONS_SHIM_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_SYNCED_NOTIFICATIONS_PRIVATE_SYNCED_NOTIFI
CATIONS_SHIM_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "chrome/common/extensions/api/synced_notifications_private.h" | 12 #include "chrome/common/extensions/api/synced_notifications_private.h" |
| 13 #include "sync/api/syncable_service.h" | 13 #include "sync/api/syncable_service.h" |
| 14 | 14 |
| 15 namespace extensions { | 15 namespace extensions { |
| 16 struct Event; | 16 struct Event; |
| 17 } | 17 } |
| 18 | 18 |
| 19 // Shim for SYNCED_NOTIFICATIONS and SYNCED_NOTIFICATIONS_APP_INFO datatypes | 19 // Shim for SYNCED_NOTIFICATIONS and SYNCED_NOTIFICATIONS_APP_INFO datatypes |
| 20 // to interface with their extension backed sync code. | 20 // to interface with their extension backed sync code. |
| 21 class SyncedNotificationsShim : public syncer::SyncableService { | 21 class SyncedNotificationsShim : public syncer::SyncableService { |
| 22 public: | 22 public: |
| 23 // Callback for firing extension events. | 23 // Callback for firing extension events. |
| 24 typedef base::Callback<void(scoped_ptr<extensions::Event>)> EventLauncher; | 24 typedef base::Callback<void(scoped_ptr<extensions::Event>)> EventLauncher; |
| 25 | 25 |
| 26 explicit SyncedNotificationsShim(const EventLauncher& event_launcher); | 26 explicit SyncedNotificationsShim(const EventLauncher& event_launcher, |
| 27 const base::Closure& refresh_request); |
| 27 virtual ~SyncedNotificationsShim(); | 28 virtual ~SyncedNotificationsShim(); |
| 28 | 29 |
| 29 // SyncableService interface. | 30 // SyncableService interface. |
| 30 virtual syncer::SyncMergeResult MergeDataAndStartSyncing( | 31 virtual syncer::SyncMergeResult MergeDataAndStartSyncing( |
| 31 syncer::ModelType type, | 32 syncer::ModelType type, |
| 32 const syncer::SyncDataList& initial_sync_data, | 33 const syncer::SyncDataList& initial_sync_data, |
| 33 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 34 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
| 34 scoped_ptr<syncer::SyncErrorFactory> error_handler) OVERRIDE; | 35 scoped_ptr<syncer::SyncErrorFactory> error_handler) OVERRIDE; |
| 35 virtual void StopSyncing(syncer::ModelType type) OVERRIDE; | 36 virtual void StopSyncing(syncer::ModelType type) OVERRIDE; |
| 36 virtual syncer::SyncError ProcessSyncChanges( | 37 virtual syncer::SyncError ProcessSyncChanges( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 51 refresh_status, | 52 refresh_status, |
| 52 const std::string& new_context); | 53 const std::string& new_context); |
| 53 | 54 |
| 54 // Returns whether both sync notification datatypes are up and running. | 55 // Returns whether both sync notification datatypes are up and running. |
| 55 bool IsSyncReady() const; | 56 bool IsSyncReady() const; |
| 56 | 57 |
| 57 private: | 58 private: |
| 58 // Callback to trigger firing extension events. | 59 // Callback to trigger firing extension events. |
| 59 EventLauncher event_launcher_; | 60 EventLauncher event_launcher_; |
| 60 | 61 |
| 62 // Callback to trigger synced notification refresh. |
| 63 base::Closure refresh_request_; |
| 64 |
| 61 // The sync change processors, initialized via MergeDataAndStartSyncing. | 65 // The sync change processors, initialized via MergeDataAndStartSyncing. |
| 62 scoped_ptr<syncer::SyncChangeProcessor> notifications_change_processor_; | 66 scoped_ptr<syncer::SyncChangeProcessor> notifications_change_processor_; |
| 63 scoped_ptr<syncer::SyncChangeProcessor> app_info_change_processor_; | 67 scoped_ptr<syncer::SyncChangeProcessor> app_info_change_processor_; |
| 64 | 68 |
| 65 DISALLOW_COPY_AND_ASSIGN(SyncedNotificationsShim); | 69 DISALLOW_COPY_AND_ASSIGN(SyncedNotificationsShim); |
| 66 }; | 70 }; |
| 67 | 71 |
| 68 #endif // CHROME_BROWSER_EXTENSIONS_API_SYNCED_NOTIFICATIONS_PRIVATE_SYNCED_NOT
IFICATIONS_SHIM_H_ | 72 #endif // CHROME_BROWSER_EXTENSIONS_API_SYNCED_NOTIFICATIONS_PRIVATE_SYNCED_NOT
IFICATIONS_SHIM_H_ |
| OLD | NEW |