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

Side by Side Diff: Source/modules/push_messaging/PushError.h

Issue 236133002: Pass script state to Web API object->script wrappable converter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Also pass script state to "from" for error types. Created 6 years, 8 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PushError_h 5 #ifndef PushError_h
6 #define PushError_h 6 #define PushError_h
7 7
8 #include "core/dom/DOMError.h" 8 #include "core/dom/DOMError.h"
9 #include "heap/Handle.h" 9 #include "heap/Handle.h"
10 #include "public/platform/WebPushError.h" 10 #include "public/platform/WebPushError.h"
11 #include "wtf/OwnPtr.h" 11 #include "wtf/OwnPtr.h"
12 12
13 namespace WebCore { 13 namespace WebCore {
14 14
15 class NewScriptState;
16
15 class PushError { 17 class PushError {
16 WTF_MAKE_NONCOPYABLE(PushError); 18 WTF_MAKE_NONCOPYABLE(PushError);
17 public: 19 public:
18 // For CallbackPromiseAdapter. 20 // For CallbackPromiseAdapter.
19 typedef blink::WebPushError WebType; 21 typedef blink::WebPushError WebType;
20 static PassRefPtrWillBeRawPtr<DOMError> from(WebType* webErrorRaw) 22 static PassRefPtrWillBeRawPtr<DOMError> from(NewScriptState*, WebType* webEr rorRaw)
21 { 23 {
22 OwnPtr<WebType> webError = adoptPtr(webErrorRaw); 24 OwnPtr<WebType> webError = adoptPtr(webErrorRaw);
23 RefPtrWillBeRawPtr<DOMError> error = DOMError::create(errorString(webErr or->errorType), webError->message); 25 RefPtrWillBeRawPtr<DOMError> error = DOMError::create(errorString(webErr or->errorType), webError->message);
24 return error.release(); 26 return error.release();
25 } 27 }
26 28
27 private: 29 private:
28 static String errorString(blink::WebPushError::ErrorType); 30 static String errorString(blink::WebPushError::ErrorType);
29 31
30 PushError() WTF_DELETED_FUNCTION; 32 PushError() WTF_DELETED_FUNCTION;
31 }; 33 };
32 34
33 } // namespace WebCore 35 } // namespace WebCore
34 36
35 #endif // PushError_h 37 #endif // PushError_h
OLDNEW
« no previous file with comments | « Source/bindings/v8/CallbackPromiseAdapter.h ('k') | Source/modules/push_messaging/PushRegistration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698