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