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

Side by Side Diff: chrome/browser/extensions/app_notification.h

Issue 12680004: Remove chrome/ code to handle App Notifications (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflicts. Created 7 years, 9 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 | Annotate | Revision Log
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_EXTENSIONS_APP_NOTIFICATION_H_
6 #define CHROME_BROWSER_EXTENSIONS_APP_NOTIFICATION_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/time.h"
12 #include "base/memory/linked_ptr.h"
13 #include "base/values.h"
14 #include "googleurl/src/gurl.h"
15
16 namespace extensions {
17
18 // This class is used to represent a notification for an installed app, to be
19 // displayed on the New Tab Page.
20 class AppNotification {
21 public:
22 // Creates an instance with the given properties.
23 // If |is_local| is true, notification is not synced.
24 // If |guid| is empty, a new guid is automatically created.
25 AppNotification(bool is_local,
26 const base::Time& creation_time,
27 const std::string& guid,
28 const std::string& extension_id,
29 const std::string& title,
30 const std::string& body);
31 ~AppNotification();
32
33 // Returns a new object that is a copy of this one.
34 // Caller owns the returned instance.
35 AppNotification* Copy();
36
37 // Setters for optional properties.
38 void set_link_url(const GURL& url) { link_url_ = url; }
39 void set_link_text(const std::string& text) { link_text_ = text; }
40 void set_creation_time(const base::Time& creation_time) {
41 creation_time_ = creation_time;
42 }
43
44 // Accessors.
45 bool is_local() const { return is_local_; }
46 const base::Time creation_time() const { return creation_time_; }
47 const std::string& guid() const { return guid_; }
48 const std::string& extension_id() const { return extension_id_; }
49 const std::string& title() const { return title_; }
50 const std::string& body() const { return body_; }
51 const GURL& link_url() const { return link_url_; }
52 const std::string& link_text() const { return link_text_; }
53
54 // Useful methods for serialization.
55 void ToDictionaryValue(DictionaryValue* result) const;
56 static AppNotification* FromDictionaryValue(const DictionaryValue& value);
57
58 // Return whether |other| is equal to this object. Useful for tests.
59 bool Equals(const AppNotification& other) const;
60 std::string ToString() const;
61
62 private:
63 // If you add to the list of data members, make sure to add appropriate checks
64 // to the Equals, Copy and {To,From}DictionaryValue methods, keeping in mind
65 // backwards compatibility.
66
67 // Whether notification is local only, which means it is not synced
68 // across machines.
69 bool is_local_;
70 base::Time creation_time_;
71 std::string guid_;
72 std::string extension_id_;
73 std::string title_;
74 std::string body_;
75 GURL link_url_;
76 std::string link_text_;
77
78 DISALLOW_COPY_AND_ASSIGN(AppNotification);
79 };
80
81 // A list of AppNotification's.
82 typedef std::vector<linked_ptr<AppNotification> > AppNotificationList;
83
84 // A way to copy an AppNotificationList, which uses AppNotification::Copy on
85 // each element.
86 // Caller owns the returned instance.
87 AppNotificationList* CopyAppNotificationList(const AppNotificationList& source);
88
89 } // namespace extensions
90
91 #endif // CHROME_BROWSER_EXTENSIONS_APP_NOTIFICATION_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/identity/identity_api.h ('k') | chrome/browser/extensions/app_notification.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698