| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "content/browser/bluetooth/bluetooth_allowed_devices_map.h" | 5 #include "content/browser/bluetooth/bluetooth_allowed_devices_map.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "content/browser/bluetooth/bluetooth_allowed_devices.h" | 9 #include "content/browser/bluetooth/bluetooth_allowed_devices.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 BluetoothAllowedDevicesMap::BluetoothAllowedDevicesMap() {} | 13 BluetoothAllowedDevicesMap::BluetoothAllowedDevicesMap() {} |
| 14 | 14 |
| 15 BluetoothAllowedDevicesMap::~BluetoothAllowedDevicesMap() {} | 15 BluetoothAllowedDevicesMap::~BluetoothAllowedDevicesMap() {} |
| 16 | 16 |
| 17 content::BluetoothAllowedDevices& | 17 content::BluetoothAllowedDevices& |
| 18 BluetoothAllowedDevicesMap::GetOrCreateAllowedDevices( | 18 BluetoothAllowedDevicesMap::GetOrCreateAllowedDevices( |
| 19 const url::Origin& origin) { | 19 const url::Origin& origin) { |
| 20 // "Unique" Origins generate the same key in maps, therefore are not | 20 // Opaque origins generate the same key in maps, therefore are not |
| 21 // supported. | 21 // supported. |
| 22 CHECK(!origin.unique()); | 22 CHECK(!origin.opaque()); |
| 23 auto iter = origin_to_allowed_devices_map_.find(origin); | 23 auto iter = origin_to_allowed_devices_map_.find(origin); |
| 24 if (iter == origin_to_allowed_devices_map_.end()) { | 24 if (iter == origin_to_allowed_devices_map_.end()) { |
| 25 iter = origin_to_allowed_devices_map_.insert( | 25 iter = origin_to_allowed_devices_map_.insert( |
| 26 iter, std::make_pair(origin, content::BluetoothAllowedDevices())); | 26 iter, std::make_pair(origin, content::BluetoothAllowedDevices())); |
| 27 } | 27 } |
| 28 return iter->second; | 28 return iter->second; |
| 29 } | 29 } |
| 30 | 30 |
| 31 void BluetoothAllowedDevicesMap::Clear() { | 31 void BluetoothAllowedDevicesMap::Clear() { |
| 32 origin_to_allowed_devices_map_.clear(); | 32 origin_to_allowed_devices_map_.clear(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 } // namespace content | 35 } // namespace content |
| OLD | NEW |