Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: content/renderer/origin_trials/trial_token.h

Issue 1653263005: [Experimental Framework] Move the trial token public key out of content and into the embedder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move /common/ code to /renderer/ Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_RENDERER_ORIGIN_TRIALS_TRIAL_TOKEN_H_ 5 #ifndef CONTENT_RENDERER_ORIGIN_TRIALS_TRIAL_TOKEN_H_
6 #define CONTENT_RENDERER_ORIGIN_TRIALS_TRIAL_TOKEN_H_ 6 #define CONTENT_RENDERER_ORIGIN_TRIALS_TRIAL_TOKEN_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 26 matching lines...) Expand all
37 // it can be parsed.) 37 // it can be parsed.)
38 static scoped_ptr<TrialToken> Parse(const std::string& token_text); 38 static scoped_ptr<TrialToken> Parse(const std::string& token_text);
39 39
40 // Returns true if this feature is appropriate for use by the given origin, 40 // Returns true if this feature is appropriate for use by the given origin,
41 // for the given feature name. This does not check whether the signature is 41 // for the given feature name. This does not check whether the signature is
42 // valid, or whether the token itself has expired. 42 // valid, or whether the token itself has expired.
43 bool IsAppropriate(const std::string& origin, 43 bool IsAppropriate(const std::string& origin,
44 const std::string& featureName) const; 44 const std::string& featureName) const;
45 45
46 // Returns true if this token has a valid signature, and has not expired. 46 // Returns true if this token has a valid signature, and has not expired.
47 bool IsValid(const base::Time& now) const; 47 bool IsValid(const base::Time& now,
48 const base::StringPiece& public_key) const;
48 49
49 std::string signature() { return signature_; } 50 std::string signature() { return signature_; }
50 std::string data() { return data_; } 51 std::string data() { return data_; }
51 GURL origin() { return origin_; } 52 GURL origin() { return origin_; }
52 std::string feature_name() { return feature_name_; } 53 std::string feature_name() { return feature_name_; }
53 uint64_t expiry_timestamp() { return expiry_timestamp_; } 54 uint64_t expiry_timestamp() { return expiry_timestamp_; }
54 55
55 protected: 56 protected:
56 friend class TrialTokenTest; 57 friend class TrialTokenTest;
57 58
(...skipping 29 matching lines...) Expand all
87 std::string feature_name_; 88 std::string feature_name_;
88 89
89 // The time until which this token should be considered valid, in UTC, as 90 // The time until which this token should be considered valid, in UTC, as
90 // seconds since the Unix epoch. 91 // seconds since the Unix epoch.
91 uint64_t expiry_timestamp_; 92 uint64_t expiry_timestamp_;
92 }; 93 };
93 94
94 } // namespace content 95 } // namespace content
95 96
96 #endif // CONTENT_RENDERER_ORIGIN_TRIALS_TRIAL_TOKEN_H_ 97 #endif // CONTENT_RENDERER_ORIGIN_TRIALS_TRIAL_TOKEN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698