Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_NOTIFIER_CHROME_NOTIFIER_SERVICE_H_ | |
| 6 #define CHROME_BROWSER_NOTIFIER_CHROME_NOTIFIER_SERVICE_H_ | |
| 7 | |
|
Nicolas Zea
2013/01/05 01:18:48
remove extra newline
Pete Williamson
2013/01/18 18:58:39
Done.
| |
| 8 | |
| 9 #include "base/basictypes.h" | |
| 10 #include "base/logging.h" | |
|
dcheng
2013/01/07 20:42:10
Why do you need this header here?
Pete Williamson
2013/01/18 18:58:39
Done.
| |
| 11 #include "base/memory/scoped_vector.h" | |
| 12 #include "chrome/browser/notifier/synced_notification.h" | |
| 13 #include "chrome/browser/profiles/profile_keyed_service.h" | |
| 14 #include "sync/api/syncable_service.h" | |
| 15 | |
| 16 // The ChromeNotifierService holds an array of notifications which | |
| 17 // represent the state of outstanding notifications for chrome. | |
|
dcheng
2013/01/07 20:42:10
What is an outstanding notification? Is the "array
Pete Williamson
2013/01/18 18:58:39
Comment clarified to remove the word array and exp
Pete Williamson
2013/01/18 18:58:39
Comment clarified, the words array and outstanding
| |
| 18 // This array is obtained from the sync service and kept up to date. | |
| 19 class ChromeNotifierService : public syncer::SyncableService, | |
| 20 public ProfileKeyedService { | |
| 21 | |
| 22 public: | |
| 23 ChromeNotifierService(); | |
| 24 virtual ~ChromeNotifierService(); | |
| 25 | |
| 26 // Methods from ProfileKeyedService. | |
| 27 virtual void Shutdown() OVERRIDE; | |
| 28 | |
| 29 // syncer::SyncableService implementation. | |
| 30 virtual syncer::SyncMergeResult MergeDataAndStartSyncing( | |
| 31 syncer::ModelType type, | |
| 32 const syncer::SyncDataList& initial_sync_data, | |
| 33 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | |
| 34 scoped_ptr<syncer::SyncErrorFactory> error_handler) OVERRIDE; | |
| 35 virtual void StopSyncing(syncer::ModelType type) OVERRIDE; | |
| 36 virtual syncer::SyncDataList GetAllSyncData( | |
| 37 syncer::ModelType type) const OVERRIDE; | |
| 38 virtual syncer::SyncError ProcessSyncChanges( | |
| 39 const tracked_objects::Location& from_here, | |
| 40 const syncer::SyncChangeList& change_list) OVERRIDE; | |
| 41 | |
| 42 // Convert from internal representation to SyncData representation. | |
| 43 static syncer::SyncData CreateSyncDataFromNotification( | |
| 44 sync_pb::SyncedNotification& notification); | |
| 45 | |
| 46 // Convert from SyncData representation to internal representation. | |
| 47 static sync_pb::SyncedNotification* CreateNotificationFromSyncData( | |
| 48 const syncer::SyncData& sync_data); | |
|
dcheng
2013/01/07 20:42:10
These static methods don't really feel like they b
| |
| 49 | |
| 50 bool Add(sync_pb::SyncedNotification* notification); | |
|
dcheng
2013/01/07 20:42:10
Who calls this? What does the return value mean?
Pete Williamson
2013/01/18 18:58:39
This is called by unit tests and by other function
| |
| 51 | |
| 52 // Get a pointer to a notification. ChromeNotifierService owns this pointer. | |
| 53 // The caller must not free the it. | |
| 54 sync_pb::SyncedNotification* GetNotification(const std::string& value); | |
| 55 | |
| 56 private: | |
| 57 void LogContents(); | |
|
dcheng
2013/01/07 20:42:10
Please describe what this method does. Is it only
Pete Williamson
2013/01/18 18:58:39
Removed.
| |
| 58 | |
| 59 // For now keep data in a vector, later likely move to a map. | |
|
dcheng
2013/01/07 20:42:10
I feel like this comment ought to be a TODO or sim
Pete Williamson
2013/01/18 18:58:39
Done.
| |
| 60 ScopedVector<sync_pb::SyncedNotification> our_data_; | |
|
dcheng
2013/01/07 20:42:10
While pronouns don't always need to avoided, I don
Pete Williamson
2013/01/18 18:58:39
Changed to "notification_data"
| |
| 61 }; | |
|
dcheng
2013/01/07 20:42:10
DISALLOW_COPY_AND_ASSIGN.
Pete Williamson
2013/01/18 18:58:39
Done.
| |
| 62 | |
|
dcheng
2013/01/07 20:42:10
Extra new line. In general, you don't really need
Pete Williamson
2013/01/18 18:58:39
Done.
| |
| 63 | |
| 64 #endif // CHROME_BROWSER_NOTIFIER_CHROME_NOTIFIER_SERVICE_H_ | |
| OLD | NEW |