Chromium Code Reviews| Index: content/public/browser/bluetooth_allowed_devices_map_base.cc |
| diff --git a/content/public/browser/bluetooth_allowed_devices_map_base.cc b/content/public/browser/bluetooth_allowed_devices_map_base.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..03ed82a1f462cc9598a411678695d7b195398ba8 |
| --- /dev/null |
| +++ b/content/public/browser/bluetooth_allowed_devices_map_base.cc |
| @@ -0,0 +1,30 @@ |
| +// Copyright 2017 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 "content/public/browser/bluetooth_allowed_devices_map_base.h" |
| + |
| +#include <utility> |
| + |
| +#include "content/browser/bluetooth/bluetooth_allowed_devices.h" |
| + |
| +namespace content { |
| + |
| +BluetoothAllowedDevicesMapBase::BluetoothAllowedDevicesMapBase() {} |
| + |
| +BluetoothAllowedDevicesMapBase::~BluetoothAllowedDevicesMapBase() {} |
| + |
| +content::BluetoothAllowedDevices* |
| +BluetoothAllowedDevicesMapBase::GetOrCreateAllowedDevices(url::Origin origin) { |
|
jam
2017/02/01 01:18:24
See https://www.chromium.org/developers/content-mo
juncai
2017/02/01 05:19:27
Here are some context:
This CL makes each browser
jam
2017/02/02 06:13:27
This doesn't appear to be used outside of content
juncai
2017/02/03 04:47:55
Thanks for the suggestion!
Done.
|
| + // "Unique" Origins generate the same key in maps, therefore are not |
| + // supported. |
| + CHECK(!origin.unique()); |
|
dcheng
2017/02/02 05:26:03
Why is this a CHECK()? This appears to be directly
juncai
2017/02/03 04:47:55
When the WebBluetooth requestDevice() function is
|
| + auto iter = origin_to_allowed_devices_map_.find(origin); |
| + if (iter == origin_to_allowed_devices_map_.end()) { |
| + iter = origin_to_allowed_devices_map_.insert( |
| + iter, std::make_pair(origin, content::BluetoothAllowedDevices())); |
| + } |
| + return &(iter->second); |
| +} |
| + |
| +} // namespace content |