| 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 #include "crypto/ec_private_key.h" |
| 5 #include "net/ssl/channel_id_store.h" | 6 #include "net/ssl/channel_id_store.h" |
| 6 | 7 |
| 7 namespace net { | 8 namespace net { |
| 8 | 9 |
| 9 ChannelIDStore::ChannelID::ChannelID() { | 10 ChannelIDStore::ChannelID::ChannelID() { |
| 10 } | 11 } |
| 11 | 12 |
| 12 ChannelIDStore::ChannelID::ChannelID( | 13 ChannelIDStore::ChannelID::ChannelID(const std::string& server_identifier, |
| 13 const std::string& server_identifier, | 14 base::Time creation_time, |
| 14 base::Time creation_time, | 15 scoped_ptr<crypto::ECPrivateKey> key) |
| 15 base::Time expiration_time, | |
| 16 const std::string& private_key, | |
| 17 const std::string& cert) | |
| 18 : server_identifier_(server_identifier), | 16 : server_identifier_(server_identifier), |
| 19 creation_time_(creation_time), | 17 creation_time_(creation_time), |
| 20 expiration_time_(expiration_time), | 18 key_(key.Pass()) { |
| 21 private_key_(private_key), | 19 } |
| 22 cert_(cert) {} | 20 |
| 21 ChannelIDStore::ChannelID::ChannelID(const ChannelID& other) |
| 22 : server_identifier_(other.server_identifier_), |
| 23 creation_time_(other.creation_time_), |
| 24 key_(other.key_ ? other.key_->Copy() : nullptr) { |
| 25 } |
| 26 |
| 27 ChannelIDStore::ChannelID& ChannelIDStore::ChannelID::operator=( |
| 28 const ChannelID& other) { |
| 29 if (&other == this) |
| 30 return *this; |
| 31 server_identifier_ = other.server_identifier_; |
| 32 creation_time_ = other.creation_time_; |
| 33 if (other.key_) |
| 34 key_.reset(other.key_->Copy()); |
| 35 return *this; |
| 36 } |
| 23 | 37 |
| 24 ChannelIDStore::ChannelID::~ChannelID() {} | 38 ChannelIDStore::ChannelID::~ChannelID() {} |
| 25 | 39 |
| 26 void ChannelIDStore::InitializeFrom(const ChannelIDList& list) { | 40 void ChannelIDStore::InitializeFrom(const ChannelIDList& list) { |
| 27 for (ChannelIDList::const_iterator i = list.begin(); i != list.end(); | 41 for (ChannelIDList::const_iterator i = list.begin(); i != list.end(); |
| 28 ++i) { | 42 ++i) { |
| 29 SetChannelID(i->server_identifier(), i->creation_time(), | 43 SetChannelID(scoped_ptr<ChannelID>(new ChannelID(*i))); |
| 30 i->expiration_time(), i->private_key(), i->cert()); | |
| 31 } | 44 } |
| 32 } | 45 } |
| 33 | 46 |
| 34 } // namespace net | 47 } // namespace net |
| OLD | NEW |