| 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 | |
| 51 // Returns true if the Status represents an error (any one of them). | 49 // Returns true if the Status represents an error (any one of them). |
| 52 bool IsError() const; | 50 bool IsError() const; |
| 53 | 51 |
| 54 // Returns true if the Status represent success. | 52 // Returns true if the Status represent success. |
| 55 bool IsSuccess() const; | 53 bool IsSuccess() const; |
| 56 | 54 |
| 57 // Returns a UTF-8 error message (non-localized) describing the error. | 55 // Returns a UTF-8 error message (non-localized) describing the error. |
| 58 const std::string& error_details() const { return error_details_; } | 56 const std::string& error_details() const { return error_details_; } |
| 59 | 57 |
| 60 blink::WebCryptoErrorType error_type() const { return error_type_; } | 58 blink::WebCryptoErrorType error_type() const { return error_type_; } |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 Type type_; | 219 Type type_; |
| 222 blink::WebCryptoErrorType error_type_; | 220 blink::WebCryptoErrorType error_type_; |
| 223 std::string error_details_; | 221 std::string error_details_; |
| 224 }; | 222 }; |
| 225 | 223 |
| 226 } // namespace webcrypto | 224 } // namespace webcrypto |
| 227 | 225 |
| 228 } // namespace content | 226 } // namespace content |
| 229 | 227 |
| 230 #endif // CONTENT_CHILD_WEBCRYPTO_STATUS_H_ | 228 #endif // CONTENT_CHILD_WEBCRYPTO_STATUS_H_ |
| OLD | NEW |