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

Side by Side Diff: webkit/api/public/WebNotification.h

Issue 385057: Deleted webkit/api which now lives in webkit.org (Closed)
Patch Set: Created 11 years, 1 month 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 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #ifndef WebNotification_h
32 #define WebNotification_h
33
34 #include "WebCommon.h"
35
36 #if WEBKIT_IMPLEMENTATION
37 namespace WebCore { class Notification; }
38 namespace WTF { template <typename T> class PassRefPtr; }
39 #endif
40
41 namespace WebKit {
42
43 class WebNotificationPrivate;
44 class WebURL;
45 class WebString;
46
47 // Represents access to a desktop notification.
48 class WebNotification {
49 public:
50 WebNotification() : m_private(0) { }
51 WebNotification(const WebNotification& other) : m_private(0) { assign(other); }
52
53 ~WebNotification() { reset(); }
54
55 WEBKIT_API void reset();
56 WEBKIT_API void assign(const WebNotification&);
57
58 WebNotification& operator=(const WebNotification& other)
59 {
60 assign(other);
61 return *this;
62 }
63
64 // Operators required to put WebNotification in an ordered map.
65 bool equals(const WebNotification& other) const { return m_private == other.m_private; }
66 bool lessThan(const WebNotification& other) const;
67
68 // Is the notification HTML vs. icon-title-text?
69 WEBKIT_API bool isHTML() const;
70
71 // If HTML, the URL which contains the contents of the notification.
72 WEBKIT_API WebURL url() const;
73
74 // If not HTML, the parameters for the icon-title-text notification.
75 WEBKIT_API WebString icon() const;
76 WEBKIT_API WebString title() const;
77 WEBKIT_API WebString body() const;
78
79 // Called to indicate the notification has been displayed.
80 WEBKIT_API void dispatchDisplayEvent();
81
82 // Called to indicate an error has occurred with this notification.
83 WEBKIT_API void dispatchErrorEvent(const WebString& errorMessage);
84
85 // Called to indicate the notification has been closed. If it was
86 // closed by the user (as opposed to automatically by the system),
87 // the byUser parameter will be true.
88 WEBKIT_API void dispatchCloseEvent(bool byUser);
89
90 #if WEBKIT_IMPLEMENTATION
91 WebNotification(const WTF::PassRefPtr<WebCore::Notification>&);
92 WebNotification& operator=(const WTF::PassRefPtr<WebCore::Notification>&);
93 operator WTF::PassRefPtr<WebCore::Notification>() const;
94 #endif
95
96 private:
97 void assign(WebNotificationPrivate*);
98 WebNotificationPrivate* m_private;
99 };
100
101 inline bool operator==(const WebNotification& a, const WebNotification& b)
102 {
103 return a.equals(b);
104 }
105
106 inline bool operator!=(const WebNotification& a, const WebNotification& b)
107 {
108 return !a.equals(b);
109 }
110
111 inline bool operator<(const WebNotification& a, const WebNotification& b)
112 {
113 return a.lessThan(b);
114 }
115
116 } // namespace WebKit
117
118 #endif
OLDNEW
« no previous file with comments | « webkit/api/public/WebNonCopyable.h ('k') | webkit/api/public/WebNotificationPermissionCallback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698