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

Side by Side Diff: content/browser/bluetooth/web_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 clean up 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_WEB_BLUETOOTH_SERVICE_IMPL_H
6 #define CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H
7
8 #include "base/macros.h"
9 #include "content/browser/bad_message.h"
10 #include "content/common/content_export.h"
11 #include "device/bluetooth/bluetooth_gatt_service.h"
12 #include "mojo/public/cpp/bindings/binding.h"
13 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj om.h"
14
15 namespace url {
16 class Origin;
17 } // namespace url
18
19 namespace content {
20
21 class BluetoothDispatcherHost;
22 class RenderFrameHost;
23 class RenderProcessHost;
24
25 class WebBluetoothServiceImpl : public blink::mojom::WebBluetoothService {
26 public:
27 WebBluetoothServiceImpl(
28 RenderFrameHost* render_frame_host,
29 mojo::InterfaceRequest<blink::mojom::WebBluetoothService> request);
Ken Rockot(use gerrit already) 2016/03/17 18:16:13 nit: we now have type aliases for requests, so |re
ortuno 2016/03/18 01:19:20 Done.
30 ~WebBluetoothServiceImpl() override;
31
32 private:
33 // WebBluetoothService methods:
34 void RemoteCharacteristicWriteValue(
35 const mojo::String& characteristic_instance_id,
36 mojo::Array<uint8_t> value,
37 const RemoteCharacteristicWriteValueCallback& callback) override;
38
39 // Callbacks for BluetoothGattCharacteristic::WriteRemoteCharacteristic.
40 void OnWriteValueSuccess(
41 const RemoteCharacteristicWriteValueCallback& callback);
42 void OnWriteValueFailed(
43 const RemoteCharacteristicWriteValueCallback& callback,
44 device::BluetoothGattService::GattErrorCode error_code);
45
46 BluetoothDispatcherHost* GetBluetoothDispatcherHost();
47 void CrashRenderer(bad_message::BadMessageReason reason);
48 url::Origin GetOrigin();
49
50 RenderFrameHost* render_frame_host_;
51 RenderProcessHost* render_process_host_;
52
53 mojo::Binding<blink::mojom::WebBluetoothService> binding_;
54
55 // |weak_ptr_on_ui_thread_| provides weak pointers, e.g. for callbacks, and
56 // because it exists and has been bound to the UI thread enforces that all
57 // copies verify they are also used on the UI thread.
58 base::WeakPtr<WebBluetoothServiceImpl> weak_ptr_on_ui_thread_;
59 base::WeakPtrFactory<WebBluetoothServiceImpl> weak_ptr_factory_;
60
61 DISALLOW_COPY_AND_ASSIGN(WebBluetoothServiceImpl);
62 };
63
64 } // namespace content
65
66 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_SERVICE_IMPL_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698