Index: chrome/browser/bluetooth/bluetooth_permission_context.cc |
diff --git a/chrome/browser/bluetooth/bluetooth_permission_context.cc b/chrome/browser/bluetooth/bluetooth_permission_context.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..003fbad2675dabbe5bd5ebe48fc858ca76db13f9 |
--- /dev/null |
+++ b/chrome/browser/bluetooth/bluetooth_permission_context.cc |
@@ -0,0 +1,34 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/bluetooth/bluetooth_permission_context.h" |
+ |
+#include "base/values.h" |
+ |
+namespace { |
+ |
+const char kDeviceAddressKey[] = "device-address"; |
+const char kDeviceNameKey[] = "device-name"; |
+const char kDeviceUUIDsKey[] = "device-uuids"; |
+ |
+} // namespace |
+ |
+BluetoothPermissionContext::BluetoothPermissionContext(Profile* profile) |
+ : ChooserContextBase(profile, |
+ CONTENT_SETTINGS_TYPE_BLUETOOTH_CHOOSER_DATA) {} |
+ |
+BluetoothPermissionContext::~BluetoothPermissionContext() {} |
+ |
+bool BluetoothPermissionContext::IsValidObject( |
+ const base::DictionaryValue& object) { |
+ std::string* null_string_ptr = nullptr; |
+ // To be backward-compatible with preferences written by previous versions of |
+ // Chrome. |
+ return object.size() == 3 && object.HasKey(kDeviceAddressKey) && |
+ object.GetString(kDeviceAddressKey, null_string_ptr) && |
+ object.HasKey(kDeviceNameKey) && |
+ object.GetString(kDeviceNameKey, null_string_ptr) && |
+ object.HasKey(kDeviceUUIDsKey) && |
+ object.GetList(kDeviceUUIDsKey, nullptr); |
+} |