| 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 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 namespace webcrypto { | 13 namespace webcrypto { |
| 14 | 14 |
| 15 // Status indicates whether an operation completed successfully, or with an | 15 // Status indicates whether an operation completed successfully, or with an |
| 16 // error. The error is used for verification in unit-tests, as well as for | 16 // error. The error is used for verification in unit-tests, as well as for |
| 17 // display to the user. | 17 // display to the user. |
| 18 // | 18 // |
| 19 // As such, it is important that errors DO NOT reveal any sensitive material | 19 // As such, it is important that errors DO NOT reveal any sensitive material |
| 20 // (like key bytes). | 20 // (like key bytes). |
| 21 // | 21 // |
| 22 // Care must be taken with what errors are reported back to blink when doing | 22 // Care must be taken with what errors are reported back to Blink when doing |
| 23 // compound operations like unwrapping a JWK key. In this case, errors | 23 // compound operations like unwrapping a JWK key. In this case, errors |
| 24 // generated by the JWK import are not appropriate to report since the wrapped | 24 // generated by the JWK import are not appropriate to report since the wrapped |
| 25 // JWK is not visible to the caller. | 25 // JWK is not visible to the caller. |
| 26 class CONTENT_EXPORT Status { | 26 class CONTENT_EXPORT Status { |
| 27 public: | 27 public: |
| 28 Status() : type_(TYPE_ERROR) {} |
| 29 |
| 28 // Returns true if the Status represents an error (any one of them). | 30 // Returns true if the Status represents an error (any one of them). |
| 29 bool IsError() const; | 31 bool IsError() const; |
| 30 | 32 |
| 31 // Returns true if the Status represent success. | 33 // Returns true if the Status represent success. |
| 32 bool IsSuccess() const; | 34 bool IsSuccess() const; |
| 33 | 35 |
| 34 // Returns true if the Status contains a non-empty error message. | 36 // Returns true if the Status contains a non-empty error message. |
| 35 bool HasErrorDetails() const; | 37 bool HasErrorDetails() const; |
| 36 | 38 |
| 37 // Returns a UTF-8 error message (non-localized) describing the error. This | 39 // Returns a UTF-8 error message (non-localized) describing the error. This |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 192 |
| 191 Type type_; | 193 Type type_; |
| 192 std::string error_details_; | 194 std::string error_details_; |
| 193 }; | 195 }; |
| 194 | 196 |
| 195 } // namespace webcrypto | 197 } // namespace webcrypto |
| 196 | 198 |
| 197 } // namespace content | 199 } // namespace content |
| 198 | 200 |
| 199 #endif // CONTENT_CHILD_WEBCRYPTO_STATUS_H_ | 201 #endif // CONTENT_CHILD_WEBCRYPTO_STATUS_H_ |
| OLD | NEW |