Chromium Code Reviews| 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(ScriptPromiseResolver*, | 14 DOMException* PresentationError::take(const WebPresentationError& error) { |
|
mlamouri (slow - plz ping)
2016/12/13 13:56:12
For next time, in the spirit of keeping the CLs at
zhaobin
2016/12/14 02:25:09
Sure :)
| |
| 15 const WebPresentationError& error) { | |
| 16 ExceptionCode code = UnknownError; | 15 ExceptionCode code = UnknownError; |
| 17 switch (error.errorType) { | 16 switch (error.errorType) { |
| 18 case WebPresentationError::ErrorTypeNoAvailableScreens: | 17 case WebPresentationError::ErrorTypeNoAvailableScreens: |
| 19 case WebPresentationError::ErrorTypeNoPresentationFound: | 18 case WebPresentationError::ErrorTypeNoPresentationFound: |
| 20 code = NotFoundError; | 19 code = NotFoundError; |
| 21 break; | 20 break; |
| 22 case WebPresentationError::ErrorTypeSessionRequestCancelled: | 21 case WebPresentationError::ErrorTypeSessionRequestCancelled: |
| 23 code = NotAllowedError; | 22 code = NotAllowedError; |
| 24 break; | 23 break; |
| 25 case WebPresentationError::ErrorTypeAvailabilityNotSupported: | 24 case WebPresentationError::ErrorTypeAvailabilityNotSupported: |
| 26 code = NotSupportedError; | 25 code = NotSupportedError; |
| 27 break; | 26 break; |
| 28 case WebPresentationError::ErrorTypeUnknown: | 27 case WebPresentationError::ErrorTypeUnknown: |
| 29 code = UnknownError; | 28 code = UnknownError; |
| 30 break; | 29 break; |
| 31 } | 30 } |
| 32 | 31 |
| 33 return DOMException::create(code, error.message); | 32 return DOMException::create(code, error.message); |
| 34 } | 33 } |
| 35 | 34 |
| 36 } // namespace blink | 35 } // namespace blink |
| OLD | NEW |