OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 WebTrialTokenValidator_h | 5 #ifndef THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_WEBTRIALTOKENVALIDATOR_H_ |
6 #define WebTrialTokenValidator_h | 6 #define THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_WEBTRIALTOKENVALIDATOR_H_ |
7 | 7 |
8 #include "public/platform/WebCallbacks.h" | 8 #include "public/platform/WebCallbacks.h" |
9 #include "public/platform/WebSecurityOrigin.h" | 9 #include "public/platform/WebSecurityOrigin.h" |
10 #include "public/platform/WebString.h" | 10 #include "public/platform/WebString.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 // This interface abstracts the task of validating a token for an experimental | 14 // This interface abstracts the task of validating a token for an experimental |
15 // feature. Experimental features can be turned on and off at runtime for a | 15 // feature. Experimental features can be turned on and off at runtime for a |
16 // specific renderer, depending on the presence of a valid token provided by | 16 // specific renderer, depending on the presence of a valid token provided by |
17 // the origin. | 17 // the origin. |
18 // | 18 // |
19 // More documentation on the design of the experimental framework is at | 19 // For more information, see https://github.com/jpchase/OriginTrials. |
20 // https://docs.google.com/document/d/1qVP2CK1lbfmtIJRIm6nwuEFFhGhYbtThLQPo3CSTt
mg | |
21 | 20 |
22 class WebTrialTokenValidator { | 21 class WebTrialTokenValidator { |
23 public: | 22 public: |
| 23 enum TokenValidationResult { |
| 24 TokenValidationResultSuccess = 0, |
| 25 TokenValidationResultExpired, |
| 26 TokenValidationResultInvalidSignature, |
| 27 TokenValidationResultMalformed, |
| 28 TokenValidationResultNotSupported, |
| 29 TokenValidationResultWrongFeature, |
| 30 TokenValidationResultWrongOrigin, |
| 31 }; |
| 32 |
24 virtual ~WebTrialTokenValidator() {} | 33 virtual ~WebTrialTokenValidator() {} |
25 | 34 |
26 // Returns true if the given token is valid for the specified origin and | 35 // Returns true if the given token is valid for the specified origin and |
27 // feature name. | 36 // feature name. |
28 virtual bool validateToken(const WebString& token, const WebSecurityOrigin&,
const WebString& featureName) = 0; | 37 virtual TokenValidationResult validateToken( |
| 38 const WebString& token, |
| 39 const WebSecurityOrigin&, |
| 40 const WebString& featureName) |
| 41 = 0; |
29 }; | 42 }; |
30 | 43 |
31 } // namespace blink | 44 } // namespace blink |
32 | 45 |
33 #endif // WebTrialTokenValidator_h | 46 #endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_WEBTRIALTOKENVALIDATOR_H_ |
OLD | NEW |