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

Side by Side Diff: Source/modules/notifications/NotificationCenter.h

Issue 19724003: Revert "Transition modules/** to use ExceptionState" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 14 matching lines...) Expand all
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #ifndef NotificationCenter_h 32 #ifndef NotificationCenter_h
33 #define NotificationCenter_h 33 #define NotificationCenter_h
34 34
35 #include "bindings/v8/ExceptionState.h"
36 #include "bindings/v8/ScriptWrappable.h" 35 #include "bindings/v8/ScriptWrappable.h"
37 #include "core/dom/ExceptionCode.h" 36 #include "core/dom/ExceptionCode.h"
38 #include "core/dom/ScriptExecutionContext.h" 37 #include "core/dom/ScriptExecutionContext.h"
39 #include "core/html/VoidCallback.h" 38 #include "core/html/VoidCallback.h"
40 #include "core/platform/Timer.h" 39 #include "core/platform/Timer.h"
41 #include "modules/notifications/Notification.h" 40 #include "modules/notifications/Notification.h"
42 #include "wtf/OwnPtr.h" 41 #include "wtf/OwnPtr.h"
43 #include "wtf/PassRefPtr.h" 42 #include "wtf/PassRefPtr.h"
44 #include "wtf/RefCounted.h" 43 #include "wtf/RefCounted.h"
45 #include "wtf/RefPtr.h" 44 #include "wtf/RefPtr.h"
46 45
47 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) 46 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
48 47
49 namespace WebCore { 48 namespace WebCore {
50 49
51 class NotificationClient; 50 class NotificationClient;
52 class VoidCallback; 51 class VoidCallback;
53 52
54 class NotificationCenter : public RefCounted<NotificationCenter>, public ScriptW rappable, public ActiveDOMObject { 53 class NotificationCenter : public RefCounted<NotificationCenter>, public ScriptW rappable, public ActiveDOMObject {
55 public: 54 public:
56 static PassRefPtr<NotificationCenter> create(ScriptExecutionContext*, Notifi cationClient*); 55 static PassRefPtr<NotificationCenter> create(ScriptExecutionContext*, Notifi cationClient*);
57 56
58 #if ENABLE(LEGACY_NOTIFICATIONS) 57 #if ENABLE(LEGACY_NOTIFICATIONS)
59 PassRefPtr<Notification> createHTMLNotification(const String& URI, Exception State& es) 58 PassRefPtr<Notification> createHTMLNotification(const String& URI, Exception Code& ec)
60 { 59 {
61 if (!client()) { 60 if (!client()) {
62 es.throwDOMException(InvalidStateError); 61 ec = InvalidStateError;
63 return 0; 62 return 0;
64 } 63 }
65 if (URI.isEmpty()) { 64 if (URI.isEmpty()) {
66 es.throwDOMException(SyntaxError); 65 ec = SyntaxError;
67 return 0; 66 return 0;
68 } 67 }
69 return Notification::create(scriptExecutionContext()->completeURL(URI), scriptExecutionContext(), es, this); 68 return Notification::create(scriptExecutionContext()->completeURL(URI), scriptExecutionContext(), ec, this);
70 } 69 }
71 #endif 70 #endif
72 71
73 #if ENABLE(LEGACY_NOTIFICATIONS) 72 #if ENABLE(LEGACY_NOTIFICATIONS)
74 PassRefPtr<Notification> createNotification(const String& iconURI, const Str ing& title, const String& body, ExceptionState& es) 73 PassRefPtr<Notification> createNotification(const String& iconURI, const Str ing& title, const String& body, ExceptionCode& ec)
75 { 74 {
76 if (!client()) { 75 if (!client()) {
77 es.throwDOMException(InvalidStateError); 76 ec = InvalidStateError;
78 return 0; 77 return 0;
79 } 78 }
80 return Notification::create(title, body, iconURI, scriptExecutionContext (), es, this); 79 return Notification::create(title, body, iconURI, scriptExecutionContext (), ec, this);
81 } 80 }
82 #endif 81 #endif
83 82
84 NotificationClient* client() const { return m_client; } 83 NotificationClient* client() const { return m_client; }
85 84
86 #if ENABLE(LEGACY_NOTIFICATIONS) 85 #if ENABLE(LEGACY_NOTIFICATIONS)
87 int checkPermission(); 86 int checkPermission();
88 void requestPermission(PassRefPtr<VoidCallback> = 0); 87 void requestPermission(PassRefPtr<VoidCallback> = 0);
89 #endif 88 #endif
90 89
(...skipping 19 matching lines...) Expand all
110 109
111 NotificationClient* m_client; 110 NotificationClient* m_client;
112 HashSet<RefPtr<NotificationRequestCallback> > m_callbacks; 111 HashSet<RefPtr<NotificationRequestCallback> > m_callbacks;
113 }; 112 };
114 113
115 } // namespace WebCore 114 } // namespace WebCore
116 115
117 #endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) 116 #endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
118 117
119 #endif // NotificationCenter_h 118 #endif // NotificationCenter_h
OLDNEW
« no previous file with comments | « Source/modules/notifications/Notification.cpp ('k') | Source/modules/speech/SpeechRecognition.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698