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

Side by Side Diff: content/browser/bluetooth/bluetooth_service_impl.h

Issue 1775953004: bluetooth: Move writeValue to mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Moar cleanup Created 4 years, 9 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 2016 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 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_SERVICE_IMPL_H
6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_SERVICE_IMPL_H
7
8 #include "base/macros.h"
9 #include "content/browser/bad_message.h"
10 #include "content/common/bluetooth/bluetooth_service.mojom.h"
11 #include "content/common/content_export.h"
12 #include "device/bluetooth/bluetooth_adapter.h"
13 #include "device/bluetooth/bluetooth_gatt_service.h"
14 #include "mojo/public/cpp/bindings/strong_binding.h"
15
16 namespace url {
17 class Origin;
18 } // namespace url
19
20 namespace content {
21
22 class BluetoothDispatcherHost;
23
24 class BluetoothServiceImpl : public mojom::BluetoothService {
25 public:
26 static void Create(int render_process_id,
27 mojo::InterfaceRequest<mojom::BluetoothService> request);
28
29 private:
30 BluetoothServiceImpl(mojo::InterfaceRequest<mojom::BluetoothService> request,
31 int render_process_id);
32 ~BluetoothServiceImpl() override;
33
34 // WebBluetoothService methods:
35 void RemoteCharacteristicWriteValue(
36 int frame_routing_id,
37 const mojo::String& characteristic_instance_id,
38 mojo::Array<uint8_t> value,
39 const RemoteCharacteristicWriteValueCallback& callback) override;
40
41 void OnWriteValueSuccess(
42 const RemoteCharacteristicWriteValueCallback& callback);
43 void OnWriteValueFailed(
44 const RemoteCharacteristicWriteValueCallback& callback,
45 device::BluetoothGattService::GattErrorCode error_code);
46
47 BluetoothDispatcherHost* GetBluetoothDispatcherHost();
48 void CrashRenderer(bad_message::BadMessageReason reason);
49 url::Origin GetOrigin(int frame_routing_id);
50
51 int render_process_id_;
52 scoped_refptr<device::BluetoothAdapter> adapter_;
53
54 mojo::StrongBinding<BluetoothService> binding_;
55
56 // |weak_ptr_on_ui_thread_| provides weak pointers, e.g. for callbacks, and
57 // because it exists and has been bound to the UI thread enforces that all
58 // copies verify they are also used on the UI thread.
59 base::WeakPtr<BluetoothServiceImpl> weak_ptr_on_ui_thread_;
60 base::WeakPtrFactory<BluetoothServiceImpl> weak_ptr_factory_;
61
62 DISALLOW_COPY_AND_ASSIGN(BluetoothServiceImpl);
63 };
64
65 } // namespace content
66
67 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_SERVICE_IMPL_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698