OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "modules/presentation/PresentationError.h" | 5 #include "modules/presentation/PresentationError.h" |
6 | 6 |
7 #include "core/dom/DOMException.h" | 7 #include "core/dom/DOMException.h" |
8 #include "core/dom/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.h" |
9 #include "public/platform/modules/presentation/WebPresentationError.h" | 9 #include "public/platform/modules/presentation/WebPresentationError.h" |
10 #include "wtf/OwnPtr.h" | |
11 | 10 |
12 namespace blink { | 11 namespace blink { |
13 | 12 |
14 // static | 13 // static |
15 DOMException* PresentationError::take(ScriptPromiseResolver*, const WebPresentat
ionError& error) | 14 DOMException* PresentationError::take(ScriptPromiseResolver*, const WebPresentat
ionError& error) |
16 { | 15 { |
17 ExceptionCode code = UnknownError; | 16 ExceptionCode code = UnknownError; |
18 switch (error.errorType) { | 17 switch (error.errorType) { |
19 case WebPresentationError::ErrorTypeNoAvailableScreens: | 18 case WebPresentationError::ErrorTypeNoAvailableScreens: |
20 case WebPresentationError::ErrorTypeNoPresentationFound: | 19 case WebPresentationError::ErrorTypeNoPresentationFound: |
21 code = NotFoundError; | 20 code = NotFoundError; |
22 break; | 21 break; |
23 case WebPresentationError::ErrorTypeSessionRequestCancelled: | 22 case WebPresentationError::ErrorTypeSessionRequestCancelled: |
24 code = AbortError; | 23 code = AbortError; |
25 break; | 24 break; |
26 case WebPresentationError::ErrorTypeAvailabilityNotSupported: | 25 case WebPresentationError::ErrorTypeAvailabilityNotSupported: |
27 code = NotSupportedError; | 26 code = NotSupportedError; |
28 break; | 27 break; |
29 case WebPresentationError::ErrorTypeUnknown: | 28 case WebPresentationError::ErrorTypeUnknown: |
30 code = UnknownError; | 29 code = UnknownError; |
31 break; | 30 break; |
32 } | 31 } |
33 | 32 |
34 return DOMException::create(code, error.message); | 33 return DOMException::create(code, error.message); |
35 } | 34 } |
36 | 35 |
37 } // namespace blink | 36 } // namespace blink |
OLD | NEW |