[Ozone-Gbm] Explicitly crash if trying software rendering on GBM
[chromium-blink-merge.git] / content / browser / bluetooth / bluetooth_dispatcher_host.h
blob8d96af78dbf49035810b4effc9ad6846040791f3
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_
8 #include "base/basictypes.h"
9 #include "content/common/bluetooth/bluetooth_error.h"
10 #include "content/public/browser/browser_message_filter.h"
11 #include "device/bluetooth/bluetooth_adapter.h"
13 namespace content {
15 // Dispatches and sends bluetooth related messages sent to/from a child
16 // process BluetoothDispatcher from/to the main browser process.
17 // Constructed on the main (UI) thread and receives IPC on the IO thread.
18 // Intended to be instantiated by the RenderProcessHost and installed as
19 // a filter on the channel. BrowserMessageFilter is refcounted and typically
20 // lives as long as it is installed on a channel.
21 class BluetoothDispatcherHost : public BrowserMessageFilter,
22 public device::BluetoothAdapter::Observer {
23 public:
24 // Creates a BluetoothDispatcherHost.
25 static scoped_refptr<BluetoothDispatcherHost> Create();
27 // BrowserMessageFilter:
28 bool OnMessageReceived(const IPC::Message& message) override;
30 protected:
31 BluetoothDispatcherHost();
32 ~BluetoothDispatcherHost() override;
34 private:
35 // Set |adapter_| to a BluetoothAdapter instance and register observers,
36 // releasing references to previous |adapter_|.
37 void set_adapter(scoped_refptr<device::BluetoothAdapter> adapter);
39 // IPC Handlers, see definitions in bluetooth_messages.h.
40 void OnRequestDevice(int thread_id, int request_id);
41 void OnSetBluetoothMockDataSetForTesting(const std::string& name);
43 // A BluetoothAdapter instance representing an adapter of the system.
44 scoped_refptr<device::BluetoothAdapter> adapter_;
46 enum class MockData { NOT_MOCKING, REJECT, RESOLVE };
47 MockData bluetooth_mock_data_set_;
48 BluetoothError bluetooth_request_device_reject_type_;
50 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost);
53 } // namespace content
55 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_