Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1008)

Side by Side Diff: chrome/browser/notifier/chrome_notifier_service.h

Issue 11745024: Synced Notification Sync Change Processor (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Synced Notifications Change Processor - CR Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_vector.h"
10 #include "base/threading/non_thread_safe.h"
11 #include "chrome/browser/notifier/synced_notification.h"
12 #include "chrome/browser/profiles/profile_keyed_service.h"
13 #include "sync/api/syncable_service.h"
14
15 class Profile;
16 class NotificationUIManager;
17
18 namespace notifier {
19
20 // The ChromeNotifierService holds notifications which represent the state of
21 // delivered notifications for chrome. These are obtained from the sync service
22 // and kept up to date.
23 class ChromeNotifierService : public syncer::SyncableService,
24 public ProfileKeyedService {
25
26 public:
27 ChromeNotifierService(Profile* profile, NotificationUIManager* manager);
28 virtual ~ChromeNotifierService();
29
30 // Methods from ProfileKeyedService.
31 virtual void Shutdown() OVERRIDE;
32
33 // syncer::SyncableService implementation.
34 virtual syncer::SyncMergeResult MergeDataAndStartSyncing(
35 syncer::ModelType type,
36 const syncer::SyncDataList& initial_sync_data,
37 scoped_ptr<syncer::SyncChangeProcessor> sync_processor,
38 scoped_ptr<syncer::SyncErrorFactory> error_handler) OVERRIDE;
39 virtual void StopSyncing(syncer::ModelType type) OVERRIDE;
40 virtual syncer::SyncDataList GetAllSyncData(
41 syncer::ModelType type) const OVERRIDE;
42 virtual syncer::SyncError ProcessSyncChanges(
43 const tracked_objects::Location& from_here,
44 const syncer::SyncChangeList& change_list) OVERRIDE;
45
46 // Convert from internal representation to SyncData representation.
47 static const syncer::SyncData CreateSyncDataFromNotification(
dcheng 2013/01/25 22:23:48 const here has no effect.
Pete Williamson 2013/01/26 02:17:09 Done.
48 const SyncedNotification& notification);
49
50 // Convert from SyncData representation to internal representation.
51 static SyncedNotification* CreateNotificationFromSyncData(
52 const syncer::SyncData& sync_data);
53
54 // Add a notification to our list. This takes ownership of the pointer.
55 void Add(scoped_ptr<notifier::SyncedNotification> notification);
dcheng 2013/01/25 22:23:48 This should be made private. For testing purposes,
Pete Williamson 2013/01/26 02:17:09 Done.
56
57 void Show(notifier::SyncedNotification* notification);
dcheng 2013/01/25 22:23:48 Ditto. This should be private as well, unless ther
Pete Williamson 2013/01/26 02:17:09 Done.
58
59 // Get a pointer to a notification. ChromeNotifierService owns this pointer.
60 // The caller must not free it.
61 notifier::SyncedNotification* FindNotificationById(const std::string& id);
62
63 private:
64 // Back pointer to the owning profile.
65 Profile* profile_;
66 NotificationUIManager* notification_manager_;
67
68 // TODO(petewil): consider whether a map would better suit our data.
69 // If there are many entries, lookup time may trump locality of reference.
70 ScopedVector<notifier::SyncedNotification> notification_data_;
71
72 DISALLOW_COPY_AND_ASSIGN(ChromeNotifierService);
73 };
74
75 } // namespace notifier
76
77 #endif // CHROME_BROWSER_NOTIFIER_CHROME_NOTIFIER_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698