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 "platform/heap/Handle.h" | 9 #include "platform/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; | 15 class ScriptPromiseResolverWithContext; |
16 | 16 |
17 class PushError { | 17 class PushError { |
18 WTF_MAKE_NONCOPYABLE(PushError); | 18 WTF_MAKE_NONCOPYABLE(PushError); |
19 public: | 19 public: |
20 // For CallbackPromiseAdapter. | 20 // For CallbackPromiseAdapter. |
21 typedef blink::WebPushError WebType; | 21 typedef blink::WebPushError WebType; |
22 static PassRefPtrWillBeRawPtr<DOMError> from(NewScriptState*, WebType* webEr
rorRaw) | 22 static PassRefPtrWillBeRawPtr<DOMError> from(ScriptPromiseResolverWithContex
t*, WebType* webErrorRaw) |
23 { | 23 { |
24 OwnPtr<WebType> webError = adoptPtr(webErrorRaw); | 24 OwnPtr<WebType> webError = adoptPtr(webErrorRaw); |
25 RefPtrWillBeRawPtr<DOMError> error = DOMError::create(errorString(webErr
or->errorType), webError->message); | 25 RefPtrWillBeRawPtr<DOMError> error = DOMError::create(errorString(webErr
or->errorType), webError->message); |
26 return error.release(); | 26 return error.release(); |
27 } | 27 } |
28 | 28 |
29 private: | 29 private: |
30 static String errorString(blink::WebPushError::ErrorType); | 30 static String errorString(blink::WebPushError::ErrorType); |
31 | 31 |
32 PushError() WTF_DELETED_FUNCTION; | 32 PushError() WTF_DELETED_FUNCTION; |
33 }; | 33 }; |
34 | 34 |
35 } // namespace WebCore | 35 } // namespace WebCore |
36 | 36 |
37 #endif // PushError_h | 37 #endif // PushError_h |
OLD | NEW |