| 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> |
| 8 |
| 7 #include "base/base64url.h" | 9 #include "base/base64url.h" |
| 8 #include "base/bind.h" | 10 #include "base/bind.h" |
| 9 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
| 10 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
| 11 #include "base/location.h" | 13 #include "base/location.h" |
| 12 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
| 13 #include "base/values.h" | 15 #include "base/values.h" |
| 14 #include "components/proximity_auth/connection.h" | 16 #include "components/proximity_auth/connection.h" |
| 15 #include "components/proximity_auth/logging/logging.h" | 17 #include "components/proximity_auth/logging/logging.h" |
| 16 #include "components/proximity_auth/messenger_observer.h" | 18 #include "components/proximity_auth/messenger_observer.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 std::string GetMessageType(const base::DictionaryValue& message) { | 62 std::string GetMessageType(const base::DictionaryValue& message) { |
| 61 std::string type; | 63 std::string type; |
| 62 message.GetString(kTypeKey, &type); | 64 message.GetString(kTypeKey, &type); |
| 63 return type; | 65 return type; |
| 64 } | 66 } |
| 65 | 67 |
| 66 } // namespace | 68 } // namespace |
| 67 | 69 |
| 68 MessengerImpl::MessengerImpl(scoped_ptr<Connection> connection, | 70 MessengerImpl::MessengerImpl(scoped_ptr<Connection> connection, |
| 69 scoped_ptr<SecureContext> secure_context) | 71 scoped_ptr<SecureContext> secure_context) |
| 70 : connection_(connection.Pass()), | 72 : connection_(std::move(connection)), |
| 71 secure_context_(secure_context.Pass()), | 73 secure_context_(std::move(secure_context)), |
| 72 weak_ptr_factory_(this) { | 74 weak_ptr_factory_(this) { |
| 73 DCHECK(connection_->IsConnected()); | 75 DCHECK(connection_->IsConnected()); |
| 74 connection_->AddObserver(this); | 76 connection_->AddObserver(this); |
| 75 | 77 |
| 76 // TODO(tengs): We need CryptAuth to report if the phone runs iOS or Android, | 78 // TODO(tengs): We need CryptAuth to report if the phone runs iOS or Android, |
| 77 // rather than relying on this heuristic. | 79 // rather than relying on this heuristic. |
| 78 if (connection_->remote_device().bluetooth_type == RemoteDevice::BLUETOOTH_LE) | 80 if (connection_->remote_device().bluetooth_type == RemoteDevice::BLUETOOTH_LE) |
| 79 PollScreenStateForIOS(); | 81 PollScreenStateForIOS(); |
| 80 } | 82 } |
| 81 | 83 |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 } else { | 351 } else { |
| 350 PA_LOG(ERROR) << "Message of unknown type '" << pending_message_->type | 352 PA_LOG(ERROR) << "Message of unknown type '" << pending_message_->type |
| 351 << "' sent."; | 353 << "' sent."; |
| 352 } | 354 } |
| 353 | 355 |
| 354 pending_message_.reset(); | 356 pending_message_.reset(); |
| 355 ProcessMessageQueue(); | 357 ProcessMessageQueue(); |
| 356 } | 358 } |
| 357 | 359 |
| 358 } // namespace proximity_auth | 360 } // namespace proximity_auth |
| OLD | NEW |