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

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

Issue 1898643002: Refactor device::BluetoothGattXXX classes to split into remote/local. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 #ifndef CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_
6 #define CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ 6 #define CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "content/browser/bad_message.h" 13 #include "content/browser/bad_message.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "content/public/browser/web_contents_observer.h" 15 #include "content/public/browser/web_contents_observer.h"
16 #include "device/bluetooth/bluetooth_adapter.h" 16 #include "device/bluetooth/bluetooth_adapter.h"
17 #include "device/bluetooth/bluetooth_gatt_characteristic.h"
18 #include "device/bluetooth/bluetooth_gatt_notify_session.h" 17 #include "device/bluetooth/bluetooth_gatt_notify_session.h"
19 #include "device/bluetooth/bluetooth_gatt_service.h" 18 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h"
19 #include "device/bluetooth/bluetooth_remote_gatt_service.h"
20 #include "mojo/public/cpp/bindings/binding.h" 20 #include "mojo/public/cpp/bindings/binding.h"
21 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj om.h" 21 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj om.h"
22 22
23 namespace url { 23 namespace url {
24 class Origin; 24 class Origin;
25 } // namespace url 25 } // namespace url
26 26
27 namespace content { 27 namespace content {
28 28
29 class BluetoothDispatcherHost; 29 class BluetoothDispatcherHost;
(...skipping 25 matching lines...) Expand all
55 55
56 private: 56 private:
57 // WebContentsObserver: 57 // WebContentsObserver:
58 // These functions should always check that the affected RenderFrameHost 58 // These functions should always check that the affected RenderFrameHost
59 // is this->render_frame_host_ and not some other frame in the same tab. 59 // is this->render_frame_host_ and not some other frame in the same tab.
60 void DidFinishNavigation(NavigationHandle* navigation_handle) override; 60 void DidFinishNavigation(NavigationHandle* navigation_handle) override;
61 61
62 // BluetoothAdapter::Observer: 62 // BluetoothAdapter::Observer:
63 void GattCharacteristicValueChanged( 63 void GattCharacteristicValueChanged(
64 device::BluetoothAdapter* adapter, 64 device::BluetoothAdapter* adapter,
65 device::BluetoothGattCharacteristic* characteristic, 65 device::BluetoothRemoteGattCharacteristic* characteristic,
66 const std::vector<uint8_t>& value) override; 66 const std::vector<uint8_t>& value) override;
67 67
68 // Notifies the WebBluetoothServiceClient that characteristic 68 // Notifies the WebBluetoothServiceClient that characteristic
69 // |characteristic_instance_id| changed it's value. We only do this for 69 // |characteristic_instance_id| changed it's value. We only do this for
70 // characteristics that have been returned to the client in the past. 70 // characteristics that have been returned to the client in the past.
71 void NotifyCharacteristicValueChanged( 71 void NotifyCharacteristicValueChanged(
72 const std::string& characteristic_instance_id, 72 const std::string& characteristic_instance_id,
73 std::vector<uint8_t> value); 73 std::vector<uint8_t> value);
74 74
75 // WebBluetoothService methods: 75 // WebBluetoothService methods:
76 void SetClient( 76 void SetClient(
77 blink::mojom::WebBluetoothServiceClientAssociatedPtrInfo client) override; 77 blink::mojom::WebBluetoothServiceClientAssociatedPtrInfo client) override;
78 78
79 // WebBluetoothService methods: 79 // WebBluetoothService methods:
80 void RemoteCharacteristicReadValue( 80 void RemoteCharacteristicReadValue(
81 const mojo::String& characteristic_instance_id, 81 const mojo::String& characteristic_instance_id,
82 const RemoteCharacteristicReadValueCallback& callback) override; 82 const RemoteCharacteristicReadValueCallback& callback) override;
83 void RemoteCharacteristicWriteValue( 83 void RemoteCharacteristicWriteValue(
84 const mojo::String& characteristic_instance_id, 84 const mojo::String& characteristic_instance_id,
85 mojo::Array<uint8_t> value, 85 mojo::Array<uint8_t> value,
86 const RemoteCharacteristicWriteValueCallback& callback) override; 86 const RemoteCharacteristicWriteValueCallback& callback) override;
87 void RemoteCharacteristicStartNotifications( 87 void RemoteCharacteristicStartNotifications(
88 const mojo::String& characteristic_instance_id, 88 const mojo::String& characteristic_instance_id,
89 const RemoteCharacteristicStartNotificationsCallback& callback) override; 89 const RemoteCharacteristicStartNotificationsCallback& callback) override;
90 void RemoteCharacteristicStopNotifications( 90 void RemoteCharacteristicStopNotifications(
91 const mojo::String& characteristic_instance_id, 91 const mojo::String& characteristic_instance_id,
92 const RemoteCharacteristicStopNotificationsCallback& callback) override; 92 const RemoteCharacteristicStopNotificationsCallback& callback) override;
93 93
94 // Callbacks for BluetoothGattCharacteristic::ReadRemoteCharacteristic. 94 // Callbacks for BluetoothRemoteGattCharacteristic::ReadRemoteCharacteristic.
95 void OnReadValueSuccess(const RemoteCharacteristicReadValueCallback& callback, 95 void OnReadValueSuccess(const RemoteCharacteristicReadValueCallback& callback,
96 const std::vector<uint8_t>& value); 96 const std::vector<uint8_t>& value);
97 void OnReadValueFailed( 97 void OnReadValueFailed(
98 const RemoteCharacteristicReadValueCallback& callback, 98 const RemoteCharacteristicReadValueCallback& callback,
99 device::BluetoothGattService::GattErrorCode error_code); 99 device::BluetoothRemoteGattService::GattErrorCode error_code);
100 100
101 // Callbacks for BluetoothGattCharacteristic::WriteRemoteCharacteristic. 101 // Callbacks for BluetoothRemoteGattCharacteristic::WriteRemoteCharacteristic.
102 void OnWriteValueSuccess( 102 void OnWriteValueSuccess(
103 const RemoteCharacteristicWriteValueCallback& callback); 103 const RemoteCharacteristicWriteValueCallback& callback);
104 void OnWriteValueFailed( 104 void OnWriteValueFailed(
105 const RemoteCharacteristicWriteValueCallback& callback, 105 const RemoteCharacteristicWriteValueCallback& callback,
106 device::BluetoothGattService::GattErrorCode error_code); 106 device::BluetoothRemoteGattService::GattErrorCode error_code);
107 107
108 // Callbacks for BluetoothGattCharacteristic::StartNotifySession. 108 // Callbacks for BluetoothRemoteGattCharacteristic::StartNotifySession.
109 void OnStartNotifySessionSuccess( 109 void OnStartNotifySessionSuccess(
110 const RemoteCharacteristicStartNotificationsCallback& callback, 110 const RemoteCharacteristicStartNotificationsCallback& callback,
111 std::unique_ptr<device::BluetoothGattNotifySession> notify_session); 111 std::unique_ptr<device::BluetoothGattNotifySession> notify_session);
112 void OnStartNotifySessionFailed( 112 void OnStartNotifySessionFailed(
113 const RemoteCharacteristicStartNotificationsCallback& callback, 113 const RemoteCharacteristicStartNotificationsCallback& callback,
114 device::BluetoothGattService::GattErrorCode error_code); 114 device::BluetoothRemoteGattService::GattErrorCode error_code);
115 115
116 // Callback for BluetoothGattNotifySession::Stop. 116 // Callback for BluetoothGattNotifySession::Stop.
117 void OnStopNotifySessionComplete( 117 void OnStopNotifySessionComplete(
118 const std::string& characteristic_instance_id, 118 const std::string& characteristic_instance_id,
119 const RemoteCharacteristicStopNotificationsCallback& callback); 119 const RemoteCharacteristicStopNotificationsCallback& callback);
120 120
121 RenderProcessHost* GetRenderProcessHost(); 121 RenderProcessHost* GetRenderProcessHost();
122 BluetoothDispatcherHost* GetBluetoothDispatcherHost(); 122 BluetoothDispatcherHost* GetBluetoothDispatcherHost();
123 void CrashRendererAndClosePipe(bad_message::BadMessageReason reason); 123 void CrashRendererAndClosePipe(bad_message::BadMessageReason reason);
124 url::Origin GetOrigin(); 124 url::Origin GetOrigin();
(...skipping 18 matching lines...) Expand all
143 mojo::Binding<blink::mojom::WebBluetoothService> binding_; 143 mojo::Binding<blink::mojom::WebBluetoothService> binding_;
144 144
145 base::WeakPtrFactory<WebBluetoothServiceImpl> weak_ptr_factory_; 145 base::WeakPtrFactory<WebBluetoothServiceImpl> weak_ptr_factory_;
146 146
147 DISALLOW_COPY_AND_ASSIGN(WebBluetoothServiceImpl); 147 DISALLOW_COPY_AND_ASSIGN(WebBluetoothServiceImpl);
148 }; 148 };
149 149
150 } // namespace content 150 } // namespace content
151 151
152 #endif // CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ 152 #endif // CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698