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 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 // static | 13 // static |
14 DOMException* PresentationError::take(const WebPresentationError& error) { | 14 DOMException* PresentationError::take(const WebPresentationError& error) { |
15 ExceptionCode code = UnknownError; | 15 ExceptionCode code = UnknownError; |
16 switch (error.errorType) { | 16 switch (error.errorType) { |
17 case WebPresentationError::ErrorTypeNoAvailableScreens: | 17 case WebPresentationError::ErrorTypeNoAvailableScreens: |
18 case WebPresentationError::ErrorTypeNoPresentationFound: | 18 case WebPresentationError::ErrorTypeNoPresentationFound: |
19 code = NotFoundError; | 19 code = NotFoundError; |
20 break; | 20 break; |
21 case WebPresentationError::ErrorTypeSessionRequestCancelled: | 21 case WebPresentationError::ErrorTypePresentationRequestCancelled: |
22 code = NotAllowedError; | 22 code = NotAllowedError; |
23 break; | 23 break; |
24 case WebPresentationError::ErrorTypeAvailabilityNotSupported: | 24 case WebPresentationError::ErrorTypeAvailabilityNotSupported: |
25 code = NotSupportedError; | 25 code = NotSupportedError; |
26 break; | 26 break; |
27 case WebPresentationError::ErrorTypePreviousStartInProgress: | 27 case WebPresentationError::ErrorTypePreviousStartInProgress: |
28 code = OperationError; | 28 code = OperationError; |
29 break; | 29 break; |
30 case WebPresentationError::ErrorTypeUnknown: | 30 case WebPresentationError::ErrorTypeUnknown: |
31 code = UnknownError; | 31 code = UnknownError; |
32 break; | 32 break; |
33 } | 33 } |
34 | 34 |
35 return DOMException::create(code, error.message); | 35 return DOMException::create(code, error.message); |
36 } | 36 } |
37 | 37 |
38 } // namespace blink | 38 } // namespace blink |
OLD | NEW |