OLD | NEW |
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 #include "content/common/origin_trials/trial_token.h" | 5 #include "content/common/origin_trials/trial_token.h" |
6 | 6 |
7 #include <openssl/curve25519.h> | 7 #include <openssl/curve25519.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/base64.h" | 11 #include "base/base64.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
19 #include "url/origin.h" | 19 #include "url/origin.h" |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 // Version 1 is the only token version currently supported | 25 // Version 1 is the only token version currently supported |
26 const uint8_t kVersion1 = 1; | 26 const uint8_t kVersion1 = 1; |
27 | 27 |
28 const char* kFieldSeparator = "|"; | 28 const char kFieldSeparator[] = "|"; |
29 | 29 |
30 } // namespace | 30 } // namespace |
31 | 31 |
32 TrialToken::~TrialToken() {} | 32 TrialToken::~TrialToken() {} |
33 | 33 |
34 scoped_ptr<TrialToken> TrialToken::Parse(const std::string& token_text) { | 34 scoped_ptr<TrialToken> TrialToken::Parse(const std::string& token_text) { |
35 if (token_text.empty()) { | 35 if (token_text.empty()) { |
36 return nullptr; | 36 return nullptr; |
37 } | 37 } |
38 | 38 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 const std::string& feature_name, | 150 const std::string& feature_name, |
151 uint64_t expiry_timestamp) | 151 uint64_t expiry_timestamp) |
152 : version_(version), | 152 : version_(version), |
153 signature_(signature), | 153 signature_(signature), |
154 data_(data), | 154 data_(data), |
155 origin_(origin), | 155 origin_(origin), |
156 feature_name_(feature_name), | 156 feature_name_(feature_name), |
157 expiry_time_(base::Time::FromDoubleT(expiry_timestamp)) {} | 157 expiry_time_(base::Time::FromDoubleT(expiry_timestamp)) {} |
158 | 158 |
159 } // namespace content | 159 } // namespace content |
OLD | NEW |