OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2015 Google Inc. All rights reserved. | 2 * Copyright (C) 2015 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 21 matching lines...) Expand all Loading... |
32 #define MediaErrorState_h | 32 #define MediaErrorState_h |
33 | 33 |
34 #include "bindings/core/v8/ExceptionState.h" | 34 #include "bindings/core/v8/ExceptionState.h" |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 class NavigatorUserMediaError; | 38 class NavigatorUserMediaError; |
39 | 39 |
40 // A class that is able to be used like ExceptionState for carrying | 40 // A class that is able to be used like ExceptionState for carrying |
41 // information about an error up the stack, but it is up to the higher | 41 // information about an error up the stack, but it is up to the higher |
42 // level code whether it produces a DOMerror or a NavigatorUserMediaError. | 42 // level code whether it produces a DOMException or a NavigatorUserMediaError. |
43 class MediaErrorState { | 43 class MediaErrorState { |
44 public: | 44 public: |
45 MediaErrorState(); | 45 MediaErrorState(); |
46 void throwTypeError(const String& message); | 46 void throwTypeError(const String& message); |
47 void throwDOMException(const ExceptionCode&, const String& message); | 47 void throwDOMException(const ExceptionCode&, const String& message); |
48 void throwConstraintError(const String& message, const String& constraint); | 48 void throwConstraintError(const String& message, const String& constraint); |
49 void reset(); | 49 void reset(); |
50 | 50 |
51 bool hadException(); | 51 bool hadException(); |
52 bool canGenerateException(); | 52 bool canGenerateException(); |
53 void raiseException(ExceptionState&); | 53 void raiseException(ExceptionState&); |
| 54 String getErrorMessage(); |
54 NavigatorUserMediaError* createError(); | 55 NavigatorUserMediaError* createError(); |
55 private: | 56 private: |
56 enum ErrorType { | 57 enum ErrorType { |
57 NoError, | 58 NoError, |
58 TypeError, | 59 TypeError, |
59 DOMError, | 60 DOMException, |
60 ConstraintError | 61 ConstraintError |
61 }; | 62 }; |
62 ErrorType m_errorType; | 63 ErrorType m_errorType; |
63 String m_name; | 64 String m_name; |
64 ExceptionCode m_code; | 65 ExceptionCode m_code; |
65 String m_message; | 66 String m_message; |
66 String m_constraint; | 67 String m_constraint; |
67 }; | 68 }; |
68 | 69 |
69 } // namespace blink | 70 } // namespace blink |
70 | 71 |
71 #endif // MediaErrorState_h | 72 #endif // MediaErrorState_h |
OLD | NEW |