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

Side by Side Diff: content/browser/bluetooth/bluetooth_dispatcher_host.cc

Issue 1058373002: bluetooth: Move requestDevice() to UI thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « content/browser/bluetooth/bluetooth_dispatcher_host.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_dispatcher_host.h" 5 #include "content/browser/bluetooth/bluetooth_dispatcher_host.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "content/common/bluetooth/bluetooth_messages.h" 8 #include "content/common/bluetooth/bluetooth_messages.h"
9 #include "device/bluetooth/bluetooth_adapter.h" 9 #include "device/bluetooth/bluetooth_adapter.h"
10 #include "device/bluetooth/bluetooth_adapter_factory.h" 10 #include "device/bluetooth/bluetooth_adapter_factory.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 scoped_refptr<device::BluetoothAdapter> adapter) { 59 scoped_refptr<device::BluetoothAdapter> adapter) {
60 if (adapter_.get()) 60 if (adapter_.get())
61 adapter_->RemoveObserver(this); 61 adapter_->RemoveObserver(this);
62 adapter_ = adapter; 62 adapter_ = adapter;
63 if (adapter_.get()) 63 if (adapter_.get())
64 adapter_->AddObserver(this); 64 adapter_->AddObserver(this);
65 } 65 }
66 66
67 void BluetoothDispatcherHost::OnRequestDevice(int thread_id, int request_id) { 67 void BluetoothDispatcherHost::OnRequestDevice(int thread_id, int request_id) {
68 DCHECK_CURRENTLY_ON(BrowserThread::IO); 68 DCHECK_CURRENTLY_ON(BrowserThread::IO);
69 BrowserThread::PostTask(BrowserThread::UI,
70 FROM_HERE,
71 base::Bind(
72 &BluetoothDispatcherHost::OnRequestDeviceOnUI,
73 this, thread_id, request_id));
74 }
75
76 void BluetoothDispatcherHost::OnRequestDeviceOnUI(int thread_id,
77 int request_id) {
78 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
69 // TODO(scheib) Extend this very simple mock implementation by using 79 // TODO(scheib) Extend this very simple mock implementation by using
70 // device/bluetooth/test mock adapter and related classes. 80 // device/bluetooth/test mock adapter and related classes.
71 switch (bluetooth_mock_data_set_) { 81 switch (bluetooth_mock_data_set_) {
72 case MockData::NOT_MOCKING: { 82 case MockData::NOT_MOCKING: {
73 // TODO(scheib): Filter devices by services: crbug.com/440594 83 // TODO(scheib): Filter devices by services: crbug.com/440594
74 // TODO(scheib): Device selection UI: crbug.com/436280 84 // TODO(scheib): Device selection UI: crbug.com/436280
75 // TODO(scheib): Utilize BluetoothAdapter::Observer::DeviceAdded/Removed. 85 // TODO(scheib): Utilize BluetoothAdapter::Observer::DeviceAdded/Removed.
76 BluetoothAdapter::DeviceList devices; 86 BluetoothAdapter::DeviceList devices;
77 if (adapter_.get()) 87 if (adapter_.get())
78 devices = adapter_->GetDevices(); 88 devices = adapter_->GetDevices();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 bluetooth_request_device_reject_type_ = BluetoothError::SECURITY; 150 bluetooth_request_device_reject_type_ = BluetoothError::SECURITY;
141 } else if (name == "ResolveRequestDevice_Empty" || // TODO(scheib): Remove. 151 } else if (name == "ResolveRequestDevice_Empty" || // TODO(scheib): Remove.
142 name == "Single Empty Device") { 152 name == "Single Empty Device") {
143 bluetooth_mock_data_set_ = MockData::RESOLVE; 153 bluetooth_mock_data_set_ = MockData::RESOLVE;
144 } else { 154 } else {
145 bluetooth_mock_data_set_ = MockData::NOT_MOCKING; 155 bluetooth_mock_data_set_ = MockData::NOT_MOCKING;
146 } 156 }
147 } 157 }
148 158
149 } // namespace content 159 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/bluetooth/bluetooth_dispatcher_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698