diff options
author | munjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-21 04:45:49 +0000 |
---|---|---|
committer | munjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-21 04:45:49 +0000 |
commit | 7f22e35fd5c25325c2b44dad757d33b2fc4b745a (patch) | |
tree | 6fcda6ffdf8dfdcf0378c5da2fb8fbb0e1b49db1 /chrome/browser/extensions/app_notification.h | |
parent | 645ef96b909147f0787f4afa53f39594cb78b211 (diff) | |
download | chromium_src-7f22e35fd5c25325c2b44dad757d33b2fc4b745a.zip chromium_src-7f22e35fd5c25325c2b44dad757d33b2fc4b745a.tar.gz chromium_src-7f22e35fd5c25325c2b44dad757d33b2fc4b745a.tar.bz2 |
Implement SyncableService in AppNotificationsManager:
- Implement all methods of SyncableService
- Modify existing methods that change the model (Add and ClearAll) to push changes to sync.
- Add some extra properties to AppNotification: guid and extension id
- Disallow operations on model until storage is loaded.
- Ton of unit tests for sync methods
Review URL: http://codereview.chromium.org/8355030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106678 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/app_notification.h')
-rw-r--r-- | chrome/browser/extensions/app_notification.h | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/chrome/browser/extensions/app_notification.h b/chrome/browser/extensions/app_notification.h index 8fd7743..bd20b68 100644 --- a/chrome/browser/extensions/app_notification.h +++ b/chrome/browser/extensions/app_notification.h @@ -17,14 +17,28 @@ // displayed on the New Tab Page. class AppNotification { public: - AppNotification(const std::string& title, const std::string& body); + // Creates an instance with the given properties. + // If |is_local| is true, notification is not synced. + // If |guid| is empty, a new guid is automatically created. + AppNotification(bool is_local, + const std::string& guid, + const std::string& extension_id, + const std::string& title, + const std::string& body); ~AppNotification(); + // Returns a new object that is a copy of this one. + // Caller owns the returned instance. + AppNotification* Copy(); + // Setters for optional properties. void set_link_url(const GURL& url) { link_url_ = url; } void set_link_text(const std::string& text) { link_text_ = text; } // Accessors. + bool is_local() const { return is_local_; } + const std::string& guid() const { return guid_; } + const std::string& extension_id() const { return extension_id_; } const std::string& title() const { return title_; } const std::string& body() const { return body_; } const GURL& link_url() const { return link_url_; } @@ -39,8 +53,14 @@ class AppNotification { private: // If you add to the list of data members, make sure to add appropriate checks - // to the Equals and {To,From}DictionaryValue methods, keeping in mind + // to the Equals, Copy and {To,From}DictionaryValue methods, keeping in mind // backwards compatibility. + + // Whether notification is local only, which means it is not synced + // across machines. + bool is_local_; + std::string guid_; + std::string extension_id_; std::string title_; std::string body_; GURL link_url_; @@ -52,4 +72,9 @@ class AppNotification { // A list of AppNotification's. typedef std::vector<linked_ptr<AppNotification> > AppNotificationList; +// A way to copy an AppNotificationList, which uses AppNotification::Copy on +// each element. +// Caller owns the returned instance. +AppNotificationList* CopyAppNotificationList(const AppNotificationList& source); + #endif // CHROME_BROWSER_EXTENSIONS_APP_NOTIFICATION_H_ |