| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "remoting/host/pairing_registry_delegate_win.h" | 5 #include "remoting/host/pairing_registry_delegate_win.h" |
| 6 | 6 |
| 7 #include "base/json/json_string_value_serializer.h" | 7 #include "base/json/json_string_value_serializer.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 std::wstring value_json; | 42 std::wstring value_json; |
| 43 LONG result = key.ReadValue(value_name, &value_json); | 43 LONG result = key.ReadValue(value_name, &value_json); |
| 44 if (result != ERROR_SUCCESS) { | 44 if (result != ERROR_SUCCESS) { |
| 45 SetLastError(result); | 45 SetLastError(result); |
| 46 PLOG(ERROR) << "Cannot read value '" << value_name << "'"; | 46 PLOG(ERROR) << "Cannot read value '" << value_name << "'"; |
| 47 return nullptr; | 47 return nullptr; |
| 48 } | 48 } |
| 49 | 49 |
| 50 // Parse the value. | 50 // Parse the value. |
| 51 std::string value_json_utf8 = base::WideToUTF8(value_json); | 51 std::string value_json_utf8 = base::WideToUTF8(value_json); |
| 52 JSONStringValueSerializer serializer(&value_json_utf8); | 52 JSONStringValueDeserializer deserializer(value_json_utf8); |
| 53 int error_code; | 53 int error_code; |
| 54 std::string error_message; | 54 std::string error_message; |
| 55 scoped_ptr<base::Value> value(serializer.Deserialize(&error_code, | 55 scoped_ptr<base::Value> value(deserializer.Deserialize(&error_code, |
| 56 &error_message)); | 56 &error_message)); |
| 57 if (!value) { | 57 if (!value) { |
| 58 LOG(ERROR) << "Failed to parse '" << value_name << "': " << error_message | 58 LOG(ERROR) << "Failed to parse '" << value_name << "': " << error_message |
| 59 << " (" << error_code << ")."; | 59 << " (" << error_code << ")."; |
| 60 return nullptr; | 60 return nullptr; |
| 61 } | 61 } |
| 62 | 62 |
| 63 if (!value->IsType(base::Value::TYPE_DICTIONARY)) { | 63 if (!value->IsType(base::Value::TYPE_DICTIONARY)) { |
| 64 LOG(ERROR) << "Failed to parse '" << value_name << "': not a dictionary."; | 64 LOG(ERROR) << "Failed to parse '" << value_name << "': not a dictionary."; |
| 65 return nullptr; | 65 return nullptr; |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 } | 259 } |
| 260 | 260 |
| 261 return true; | 261 return true; |
| 262 } | 262 } |
| 263 | 263 |
| 264 scoped_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() { | 264 scoped_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() { |
| 265 return make_scoped_ptr(new PairingRegistryDelegateWin()); | 265 return make_scoped_ptr(new PairingRegistryDelegateWin()); |
| 266 } | 266 } |
| 267 | 267 |
| 268 } // namespace remoting | 268 } // namespace remoting |
| OLD | NEW |