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 "net/quic/crypto/channel_id_chromium.h" | 5 #include "net/quic/crypto/channel_id_chromium.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 void OnIOComplete(int result); | 82 void OnIOComplete(int result); |
83 int DoGetChannelIDKey(int result); | 83 int DoGetChannelIDKey(int result); |
84 int DoGetChannelIDKeyComplete(int result); | 84 int DoGetChannelIDKeyComplete(int result); |
85 | 85 |
86 // Channel ID source to notify when this jobs completes. | 86 // Channel ID source to notify when this jobs completes. |
87 ChannelIDSourceChromium* const channel_id_source_; | 87 ChannelIDSourceChromium* const channel_id_source_; |
88 | 88 |
89 ChannelIDService* const channel_id_service_; | 89 ChannelIDService* const channel_id_service_; |
90 | 90 |
91 scoped_ptr<crypto::ECPrivateKey> channel_id_crypto_key_; | 91 scoped_ptr<crypto::ECPrivateKey> channel_id_crypto_key_; |
92 ChannelIDService::RequestHandle channel_id_request_handle_; | 92 ChannelIDService::Request channel_id_request_; |
93 | 93 |
94 // |hostname| specifies the hostname for which we need a channel ID. | 94 // |hostname| specifies the hostname for which we need a channel ID. |
95 std::string hostname_; | 95 std::string hostname_; |
96 | 96 |
97 scoped_ptr<ChannelIDSourceCallback> callback_; | 97 scoped_ptr<ChannelIDSourceCallback> callback_; |
98 | 98 |
99 scoped_ptr<ChannelIDKey> channel_id_key_; | 99 scoped_ptr<ChannelIDKey> channel_id_key_; |
100 | 100 |
101 State next_state_; | 101 State next_state_; |
102 | 102 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 int ChannelIDSourceChromium::Job::DoGetChannelIDKey(int result) { | 177 int ChannelIDSourceChromium::Job::DoGetChannelIDKey(int result) { |
178 next_state_ = STATE_GET_CHANNEL_ID_KEY_COMPLETE; | 178 next_state_ = STATE_GET_CHANNEL_ID_KEY_COMPLETE; |
179 | 179 |
180 return channel_id_service_->GetOrCreateChannelID( | 180 return channel_id_service_->GetOrCreateChannelID( |
181 hostname_, &channel_id_crypto_key_, | 181 hostname_, &channel_id_crypto_key_, |
182 base::Bind(&ChannelIDSourceChromium::Job::OnIOComplete, | 182 base::Bind(&ChannelIDSourceChromium::Job::OnIOComplete, |
183 base::Unretained(this)), | 183 base::Unretained(this)), |
184 &channel_id_request_handle_); | 184 &channel_id_request_); |
185 } | 185 } |
186 | 186 |
187 int ChannelIDSourceChromium::Job::DoGetChannelIDKeyComplete(int result) { | 187 int ChannelIDSourceChromium::Job::DoGetChannelIDKeyComplete(int result) { |
188 DCHECK_EQ(STATE_NONE, next_state_); | 188 DCHECK_EQ(STATE_NONE, next_state_); |
189 if (result != OK) { | 189 if (result != OK) { |
190 DLOG(WARNING) << "Failed to look up channel ID: " << ErrorToString(result); | 190 DLOG(WARNING) << "Failed to look up channel ID: " << ErrorToString(result); |
191 return result; | 191 return result; |
192 } | 192 } |
193 | 193 |
194 if (!channel_id_crypto_key_) { | 194 if (!channel_id_crypto_key_) { |
(...skipping 28 matching lines...) Expand all Loading... |
223 } | 223 } |
224 return status; | 224 return status; |
225 } | 225 } |
226 | 226 |
227 void ChannelIDSourceChromium::OnJobComplete(Job* job) { | 227 void ChannelIDSourceChromium::OnJobComplete(Job* job) { |
228 active_jobs_.erase(job); | 228 active_jobs_.erase(job); |
229 delete job; | 229 delete job; |
230 } | 230 } |
231 | 231 |
232 } // namespace net | 232 } // namespace net |
OLD | NEW |