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

Side by Side Diff: components/proximity_auth/device_to_device_authenticator.cc

Issue 1355063004: Template methods on Timer classes instead of the classes themselves. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: timer: fixcaller Created 5 years, 3 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 #include "components/proximity_auth/device_to_device_authenticator.h" 5 #include "components/proximity_auth/device_to_device_authenticator.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "base/timer/timer.h" 8 #include "base/timer/timer.h"
9 #include "components/proximity_auth/connection.h" 9 #include "components/proximity_auth/connection.h"
10 #include "components/proximity_auth/cryptauth/secure_message_delegate.h" 10 #include "components/proximity_auth/cryptauth/secure_message_delegate.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // Create the [Hello] message to send to the remote device. 82 // Create the [Hello] message to send to the remote device.
83 state_ = State::SENDING_HELLO; 83 state_ = State::SENDING_HELLO;
84 DeviceToDeviceInitiatorOperations::CreateHelloMessage( 84 DeviceToDeviceInitiatorOperations::CreateHelloMessage(
85 public_key, connection_->remote_device().persistent_symmetric_key, 85 public_key, connection_->remote_device().persistent_symmetric_key,
86 secure_message_delegate_.get(), 86 secure_message_delegate_.get(),
87 base::Bind(&DeviceToDeviceAuthenticator::OnHelloMessageCreated, 87 base::Bind(&DeviceToDeviceAuthenticator::OnHelloMessageCreated,
88 weak_ptr_factory_.GetWeakPtr())); 88 weak_ptr_factory_.GetWeakPtr()));
89 } 89 }
90 90
91 scoped_ptr<base::Timer> DeviceToDeviceAuthenticator::CreateTimer() { 91 scoped_ptr<base::Timer> DeviceToDeviceAuthenticator::CreateTimer() {
92 return make_scoped_ptr(new base::OneShotTimer<DeviceToDeviceAuthenticator>()); 92 return make_scoped_ptr(new base::OneShotTimer());
93 } 93 }
94 94
95 void DeviceToDeviceAuthenticator::OnHelloMessageCreated( 95 void DeviceToDeviceAuthenticator::OnHelloMessageCreated(
96 const std::string& message) { 96 const std::string& message) {
97 DCHECK(state_ == State::SENDING_HELLO); 97 DCHECK(state_ == State::SENDING_HELLO);
98 if (message.empty()) { 98 if (message.empty()) {
99 Fail("Failed to create [Hello]"); 99 Fail("Failed to create [Hello]");
100 return; 100 return;
101 } 101 }
102 102
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 Succeed(); 227 Succeed();
228 else 228 else
229 Fail("Failed to send [Initiator Auth]"); 229 Fail("Failed to send [Initiator Auth]");
230 } else if (!success && state_ == State::SENT_HELLO) { 230 } else if (!success && state_ == State::SENT_HELLO) {
231 DCHECK(message.payload() == hello_message_); 231 DCHECK(message.payload() == hello_message_);
232 Fail("Failed to send [Hello]"); 232 Fail("Failed to send [Hello]");
233 } 233 }
234 } 234 }
235 235
236 } // namespace proximity_auth 236 } // namespace proximity_auth
OLDNEW
« no previous file with comments | « components/proximity_auth/ble/proximity_auth_ble_system.h ('k') | components/proximity_auth/remote_device_life_cycle_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698