OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/bluetooth/bluetooth_permission_context.h" |
| 6 |
| 7 #include "base/values.h" |
| 8 |
| 9 namespace { |
| 10 |
| 11 const char kDeviceAddressKey[] = "device-address"; |
| 12 const char kDeviceNameKey[] = "device-name"; |
| 13 const char kDeviceUUIDsKey[] = "device-uuids"; |
| 14 |
| 15 } // namespace |
| 16 |
| 17 BluetoothPermissionContext::BluetoothPermissionContext(Profile* profile) |
| 18 : ChooserContextBase(profile, |
| 19 CONTENT_SETTINGS_TYPE_BLUETOOTH_CHOOSER_DATA) {} |
| 20 |
| 21 BluetoothPermissionContext::~BluetoothPermissionContext() {} |
| 22 |
| 23 bool BluetoothPermissionContext::IsValidObject( |
| 24 const base::DictionaryValue& object) { |
| 25 std::string* null_string_ptr = nullptr; |
| 26 // To be backward-compatible with preferences written by previous versions of |
| 27 // Chrome. |
| 28 return object.size() == 3 && object.HasKey(kDeviceAddressKey) && |
| 29 object.GetString(kDeviceAddressKey, null_string_ptr) && |
| 30 object.HasKey(kDeviceNameKey) && |
| 31 object.GetString(kDeviceNameKey, null_string_ptr) && |
| 32 object.HasKey(kDeviceUUIDsKey) && |
| 33 object.GetList(kDeviceUUIDsKey, nullptr); |
| 34 } |
OLD | NEW |