OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CONTENT_CHILD_WEBCRYPTO_STATUS_H_ | 5 #ifndef CONTENT_CHILD_WEBCRYPTO_STATUS_H_ |
6 #define CONTENT_CHILD_WEBCRYPTO_STATUS_H_ | 6 #define CONTENT_CHILD_WEBCRYPTO_STATUS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 #include "third_party/WebKit/public/platform/WebCrypto.h" | 10 #include "third_party/WebKit/public/platform/WebCrypto.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 namespace webcrypto { | 34 namespace webcrypto { |
35 | 35 |
36 // Status indicates whether an operation completed successfully, or with an | 36 // Status indicates whether an operation completed successfully, or with an |
37 // error. The error is used for verification in unit-tests, as well as for | 37 // error. The error is used for verification in unit-tests, as well as for |
38 // display to the user. | 38 // display to the user. |
39 // | 39 // |
40 // As such, it is important that errors DO NOT reveal any sensitive material | 40 // As such, it is important that errors DO NOT reveal any sensitive material |
41 // (like key bytes). | 41 // (like key bytes). |
42 // | 42 // |
43 // Care must be taken with what errors are reported back to blink when doing | 43 // Care must be taken with what errors are reported back to Blink when doing |
44 // compound operations like unwrapping a JWK key. In this case, errors | 44 // compound operations like unwrapping a JWK key. In this case, errors |
45 // generated by the JWK import are not appropriate to report since the wrapped | 45 // generated by the JWK import are not appropriate to report since the wrapped |
46 // JWK is not visible to the caller. | 46 // JWK is not visible to the caller. |
47 class CONTENT_EXPORT Status { | 47 class CONTENT_EXPORT Status { |
48 public: | 48 public: |
| 49 Status() : type_(TYPE_ERROR) {} |
| 50 |
49 // Returns true if the Status represents an error (any one of them). | 51 // Returns true if the Status represents an error (any one of them). |
50 bool IsError() const; | 52 bool IsError() const; |
51 | 53 |
52 // Returns true if the Status represent success. | 54 // Returns true if the Status represent success. |
53 bool IsSuccess() const; | 55 bool IsSuccess() const; |
54 | 56 |
55 // Returns a UTF-8 error message (non-localized) describing the error. | 57 // Returns a UTF-8 error message (non-localized) describing the error. |
56 const std::string& error_details() const { return error_details_; } | 58 const std::string& error_details() const { return error_details_; } |
57 | 59 |
58 blink::WebCryptoErrorType error_type() const { return error_type_; } | 60 blink::WebCryptoErrorType error_type() const { return error_type_; } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 Type type_; | 221 Type type_; |
220 blink::WebCryptoErrorType error_type_; | 222 blink::WebCryptoErrorType error_type_; |
221 std::string error_details_; | 223 std::string error_details_; |
222 }; | 224 }; |
223 | 225 |
224 } // namespace webcrypto | 226 } // namespace webcrypto |
225 | 227 |
226 } // namespace content | 228 } // namespace content |
227 | 229 |
228 #endif // CONTENT_CHILD_WEBCRYPTO_STATUS_H_ | 230 #endif // CONTENT_CHILD_WEBCRYPTO_STATUS_H_ |
OLD | NEW |