OLD | NEW |
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 |
OLD | NEW |