| 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 "components/proximity_auth/messenger_impl.h" | 5 #include "components/proximity_auth/messenger_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/base64url.h" | 9 #include "base/base64url.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 pending_message_.reset(new PendingMessage(queued_messages_.front())); | 171 pending_message_.reset(new PendingMessage(queued_messages_.front())); |
| 172 queued_messages_.pop_front(); | 172 queued_messages_.pop_front(); |
| 173 | 173 |
| 174 secure_context_->Encode(pending_message_->json_message, | 174 secure_context_->Encode(pending_message_->json_message, |
| 175 base::Bind(&MessengerImpl::OnMessageEncoded, | 175 base::Bind(&MessengerImpl::OnMessageEncoded, |
| 176 weak_ptr_factory_.GetWeakPtr())); | 176 weak_ptr_factory_.GetWeakPtr())); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void MessengerImpl::OnMessageEncoded(const std::string& encoded_message) { | 179 void MessengerImpl::OnMessageEncoded(const std::string& encoded_message) { |
| 180 connection_->SendMessage(base::WrapUnique(new WireMessage(encoded_message))); | 180 connection_->SendMessage(base::MakeUnique<WireMessage>(encoded_message)); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void MessengerImpl::OnMessageDecoded(const std::string& decoded_message) { | 183 void MessengerImpl::OnMessageDecoded(const std::string& decoded_message) { |
| 184 // TODO(tengs): Unify the iOS status update protocol with the existing Android | 184 // TODO(tengs): Unify the iOS status update protocol with the existing Android |
| 185 // protocol, so we don't have this special case. | 185 // protocol, so we don't have this special case. |
| 186 if (decoded_message == kScreenUnlocked || decoded_message == kScreenLocked) { | 186 if (decoded_message == kScreenUnlocked || decoded_message == kScreenLocked) { |
| 187 RemoteStatusUpdate update; | 187 RemoteStatusUpdate update; |
| 188 update.user_presence = | 188 update.user_presence = |
| 189 (decoded_message == kScreenUnlocked ? USER_PRESENT : USER_ABSENT); | 189 (decoded_message == kScreenUnlocked ? USER_PRESENT : USER_ABSENT); |
| 190 update.secure_screen_lock_state = SECURE_SCREEN_LOCK_ENABLED; | 190 update.secure_screen_lock_state = SECURE_SCREEN_LOCK_ENABLED; |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 } else { | 352 } else { |
| 353 PA_LOG(ERROR) << "Message of unknown type '" << pending_message_->type | 353 PA_LOG(ERROR) << "Message of unknown type '" << pending_message_->type |
| 354 << "' sent."; | 354 << "' sent."; |
| 355 } | 355 } |
| 356 | 356 |
| 357 pending_message_.reset(); | 357 pending_message_.reset(); |
| 358 ProcessMessageQueue(); | 358 ProcessMessageQueue(); |
| 359 } | 359 } |
| 360 | 360 |
| 361 } // namespace proximity_auth | 361 } // namespace proximity_auth |
| OLD | NEW |