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