Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: chrome/browser/bluetooth/bluetooth_permission_context.cc

Issue 1560263002: Store Bluetooth permissions in website settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added code to check session->chooser_permission_manager Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698