| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 for (auto& observer : observers_) | 193 for (auto& observer : observers_) |
| 194 observer.OnRemoteStatusUpdate(update); | 194 observer.OnRemoteStatusUpdate(update); |
| 195 pending_message_.reset(); | 195 pending_message_.reset(); |
| 196 ProcessMessageQueue(); | 196 ProcessMessageQueue(); |
| 197 return; | 197 return; |
| 198 } | 198 } |
| 199 | 199 |
| 200 // The decoded message should be a JSON string. | 200 // The decoded message should be a JSON string. |
| 201 std::unique_ptr<base::Value> message_value = | 201 std::unique_ptr<base::Value> message_value = |
| 202 base::JSONReader::Read(decoded_message); | 202 base::JSONReader::Read(decoded_message); |
| 203 if (!message_value || !message_value->IsType(base::Value::TYPE_DICTIONARY)) { | 203 if (!message_value || !message_value->IsType(base::Value::Type::DICTIONARY)) { |
| 204 PA_LOG(ERROR) << "Unable to parse message as JSON:\n" << decoded_message; | 204 PA_LOG(ERROR) << "Unable to parse message as JSON:\n" << decoded_message; |
| 205 return; | 205 return; |
| 206 } | 206 } |
| 207 | 207 |
| 208 base::DictionaryValue* message; | 208 base::DictionaryValue* message; |
| 209 bool success = message_value->GetAsDictionary(&message); | 209 bool success = message_value->GetAsDictionary(&message); |
| 210 DCHECK(success); | 210 DCHECK(success); |
| 211 | 211 |
| 212 std::string type; | 212 std::string type; |
| 213 if (!message->GetString(kTypeKey, &type)) { | 213 if (!message->GetString(kTypeKey, &type)) { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 } else { | 356 } else { |
| 357 PA_LOG(ERROR) << "Message of unknown type '" << pending_message_->type | 357 PA_LOG(ERROR) << "Message of unknown type '" << pending_message_->type |
| 358 << "' sent."; | 358 << "' sent."; |
| 359 } | 359 } |
| 360 | 360 |
| 361 pending_message_.reset(); | 361 pending_message_.reset(); |
| 362 ProcessMessageQueue(); | 362 ProcessMessageQueue(); |
| 363 } | 363 } |
| 364 | 364 |
| 365 } // namespace proximity_auth | 365 } // namespace proximity_auth |
| OLD | NEW |