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

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

Issue 11745024: Synced Notification Sync Change Processor (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Synced Notifications - CR changes per Zea and DCheng 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 // This class represents the data for a single Synced Notification.
6 // It should map 1-1 to all the data in synced_notification_sepcifics.proto,
7 // and the data and render protobufs that the specifics protobuf contains.
8
9 #ifndef CHROME_BROWSER_NOTIFIER_SYNCED_NOTIFICATION_H_
10 #define CHROME_BROWSER_NOTIFIER_SYNCED_NOTIFICATION_H_
11
12 #include "googleurl/src/gurl.h"
13 #include "sync/api/sync_data.h"
14 #include "sync/protocol/sync.pb.h"
15 #include "sync/protocol/synced_notification_specifics.pb.h"
16
17 namespace notifier {
18
19 class SyncedNotification {
20 public:
21 explicit SyncedNotification(const syncer::SyncData& sync_data);
22
23 ~SyncedNotification();
24
25 // Here are some helper functions to get individual data parts out of a
26 // syncedNotification protobuf.
27 std::string GetTitle() const;
28 std::string GetAppId() const;
29 std::string GetCoalescingKey() const;
30 GURL GetOriginUrl() const;
31 GURL GetIconUrl() const;
32 std::string GetFirstExternalId() const;
33 std::string GetNotificationId() const;
34 std::string GetBody() const;
35
36 bool Equals(const SyncedNotification& other) const;
37
38 void set_has_local_changes(bool has_local_changes) {
39 has_local_changes_ = has_local_changes;
40 }
41
42 bool has_local_changes() const {
43 return has_local_changes_;
44 }
45
46 syncer::SyncData* mutable_sync_data() {
47 return &sync_data_;
48 }
49
50 void NotificationHasBeenRead();
51
52 void NotificationHasBeenDeleted();
53
54 // This gets a pointer to the SyncedNotificationSpecifics part
55 // of the sync data. This is owned by the SyncedNotification class
56 // (actually refcounted, so it is jointly owned with sync).
57 // Don't free this pointer!
58 const sync_pb::SyncedNotificationSpecifics* GetSyncedNotificationSpecifics();
59
60 private:
61 // helper function to mark a notification as read or dismissed.
62 bool SetReadState(
63 sync_pb::SyncedNotificationCoalesced_ReadState readState);
64 syncer::SyncData sync_data_;
65 // Set this to true if we make any changes to the client data.
66 bool has_local_changes_;
67
68 DISALLOW_COPY_AND_ASSIGN(SyncedNotification);
69 };
70
dcheng 2013/01/23 18:39:43 Extra newlines.
Pete Williamson 2013/01/24 01:48:11 Done.
71
72 } // namespace notifier
73
74 #endif // CHROME_BROWSER_NOTIFIER_SYNCED_NOTIFICATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698