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

Side by Side Diff: content/public/browser/bluetooth_allowed_devices_map_base.cc

Issue 2658473002: Refactor BluetoothAllowedDevicesMap (Closed)
Patch Set: updated test code Created 3 years, 10 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 2017 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 "content/public/browser/bluetooth_allowed_devices_map_base.h"
6
7 #include <utility>
8
9 #include "content/browser/bluetooth/bluetooth_allowed_devices.h"
10
11 namespace content {
12
13 BluetoothAllowedDevicesMapBase::BluetoothAllowedDevicesMapBase() {}
14
15 BluetoothAllowedDevicesMapBase::~BluetoothAllowedDevicesMapBase() {}
16
17 content::BluetoothAllowedDevices*
18 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.
19 // "Unique" Origins generate the same key in maps, therefore are not
20 // supported.
21 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
22 auto iter = origin_to_allowed_devices_map_.find(origin);
23 if (iter == origin_to_allowed_devices_map_.end()) {
24 iter = origin_to_allowed_devices_map_.insert(
25 iter, std::make_pair(origin, content::BluetoothAllowedDevices()));
26 }
27 return &(iter->second);
28 }
29
30 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698