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 COMPONENTS_WEBCRYPTO_STATUS_H_ |
6 #define CONTENT_CHILD_WEBCRYPTO_STATUS_H_ | 6 #define COMPONENTS_WEBCRYPTO_STATUS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include "content/common/content_export.h" | |
10 #include "third_party/WebKit/public/platform/WebCrypto.h" | 9 #include "third_party/WebKit/public/platform/WebCrypto.h" |
11 | 10 |
12 namespace content { | |
13 | |
14 namespace webcrypto { | 11 namespace webcrypto { |
15 | 12 |
16 // Status indicates whether an operation completed successfully, or with an | 13 // 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 | 14 // error. The error is used for verification in unit-tests, as well as for |
18 // display to the user. | 15 // display to the user. |
19 // | 16 // |
20 // As such, it is important that errors DO NOT reveal any sensitive material | 17 // As such, it is important that errors DO NOT reveal any sensitive material |
21 // (like key bytes). | 18 // (like key bytes). |
22 class CONTENT_EXPORT Status { | 19 class Status { |
23 public: | 20 public: |
24 Status() : type_(TYPE_ERROR) {} | 21 Status() : type_(TYPE_ERROR) {} |
25 | 22 |
26 // Returns true if the Status represents an error (any one of them). | 23 // Returns true if the Status represents an error (any one of them). |
27 bool IsError() const; | 24 bool IsError() const; |
28 | 25 |
29 // Returns true if the Status represent success. | 26 // Returns true if the Status represent success. |
30 bool IsSuccess() const; | 27 bool IsSuccess() const; |
31 | 28 |
32 // Returns a UTF-8 error message (non-localized) describing the error. | 29 // Returns a UTF-8 error message (non-localized) describing the error. |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 // Constructs a success or error without any details. | 275 // Constructs a success or error without any details. |
279 explicit Status(Type type); | 276 explicit Status(Type type); |
280 | 277 |
281 Type type_; | 278 Type type_; |
282 blink::WebCryptoErrorType error_type_; | 279 blink::WebCryptoErrorType error_type_; |
283 std::string error_details_; | 280 std::string error_details_; |
284 }; | 281 }; |
285 | 282 |
286 } // namespace webcrypto | 283 } // namespace webcrypto |
287 | 284 |
288 } // namespace content | 285 #endif // COMPONENTS_WEBCRYPTO_STATUS_H_ |
289 | |
290 #endif // CONTENT_CHILD_WEBCRYPTO_STATUS_H_ | |
OLD | NEW |