| 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/client.h" | 5 #include "components/proximity_auth/client.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "components/proximity_auth/client_observer.h" | 10 #include "components/proximity_auth/client_observer.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 response.reset(new std::string(decrypted_data)); | 170 response.reset(new std::string(decrypted_data)); |
| 171 } | 171 } |
| 172 FOR_EACH_OBSERVER( | 172 FOR_EACH_OBSERVER( |
| 173 ClientObserver, observers_, OnDecryptResponse(response.Pass())); | 173 ClientObserver, observers_, OnDecryptResponse(response.Pass())); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void Client::HandleUnlockResponseMessage(const base::DictionaryValue& message) { | 176 void Client::HandleUnlockResponseMessage(const base::DictionaryValue& message) { |
| 177 FOR_EACH_OBSERVER(ClientObserver, observers_, OnUnlockResponse(true)); | 177 FOR_EACH_OBSERVER(ClientObserver, observers_, OnUnlockResponse(true)); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void Client::OnConnectionStatusChanged(const Connection& connection, | 180 void Client::OnConnectionStatusChanged(Connection* connection, |
| 181 Connection::Status old_status, | 181 Connection::Status old_status, |
| 182 Connection::Status new_status) { | 182 Connection::Status new_status) { |
| 183 DCHECK_EQ(&connection, connection_.get()); | 183 DCHECK_EQ(connection, connection_.get()); |
| 184 if (new_status != Connection::CONNECTED) { | 184 if (new_status != Connection::CONNECTED) { |
| 185 VLOG(1) << "[Client] Secure channel disconnected..."; | 185 VLOG(1) << "[Client] Secure channel disconnected..."; |
| 186 connection_->RemoveObserver(this); | 186 connection_->RemoveObserver(this); |
| 187 connection_.reset(); | 187 connection_.reset(); |
| 188 FOR_EACH_OBSERVER(ClientObserver, observers_, OnDisconnected()); | 188 FOR_EACH_OBSERVER(ClientObserver, observers_, OnDisconnected()); |
| 189 // TODO(isherman): Determine whether it's also necessary/appropriate to fire | 189 // TODO(isherman): Determine whether it's also necessary/appropriate to fire |
| 190 // this notification from the destructor. | 190 // this notification from the destructor. |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 | 193 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 } else { | 280 } else { |
| 281 VLOG(1) << "[Client] Message of unknown type '" << pending_message_->type | 281 VLOG(1) << "[Client] Message of unknown type '" << pending_message_->type |
| 282 << "sent."; | 282 << "sent."; |
| 283 } | 283 } |
| 284 | 284 |
| 285 pending_message_.reset(); | 285 pending_message_.reset(); |
| 286 ProcessMessageQueue(); | 286 ProcessMessageQueue(); |
| 287 } | 287 } |
| 288 | 288 |
| 289 } // namespace proximity_auth | 289 } // namespace proximity_auth |
| OLD | NEW |