Chromium Code Reviews| Index: content/browser/bluetooth/web_bluetooth_service_impl.h |
| diff --git a/content/browser/bluetooth/web_bluetooth_service_impl.h b/content/browser/bluetooth/web_bluetooth_service_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..77b59e0b484a942314408b2d7355119dde4ed1aa |
| --- /dev/null |
| +++ b/content/browser/bluetooth/web_bluetooth_service_impl.h |
| @@ -0,0 +1,66 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H |
| +#define CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H |
| + |
| +#include "base/macros.h" |
| +#include "content/browser/bad_message.h" |
| +#include "content/common/content_export.h" |
| +#include "device/bluetooth/bluetooth_gatt_service.h" |
| +#include "mojo/public/cpp/bindings/binding.h" |
| +#include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.mojom.h" |
| + |
| +namespace url { |
| +class Origin; |
| +} // namespace url |
| + |
| +namespace content { |
| + |
| +class BluetoothDispatcherHost; |
| +class RenderFrameHost; |
| +class RenderProcessHost; |
| + |
| +class WebBluetoothServiceImpl : public blink::mojom::WebBluetoothService { |
| + public: |
| + WebBluetoothServiceImpl( |
| + RenderFrameHost* render_frame_host, |
| + 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.
|
| + ~WebBluetoothServiceImpl() override; |
| + |
| + private: |
| + // WebBluetoothService methods: |
| + void RemoteCharacteristicWriteValue( |
| + const mojo::String& characteristic_instance_id, |
| + mojo::Array<uint8_t> value, |
| + const RemoteCharacteristicWriteValueCallback& callback) override; |
| + |
| + // Callbacks for BluetoothGattCharacteristic::WriteRemoteCharacteristic. |
| + void OnWriteValueSuccess( |
| + const RemoteCharacteristicWriteValueCallback& callback); |
| + void OnWriteValueFailed( |
| + const RemoteCharacteristicWriteValueCallback& callback, |
| + device::BluetoothGattService::GattErrorCode error_code); |
| + |
| + BluetoothDispatcherHost* GetBluetoothDispatcherHost(); |
| + void CrashRenderer(bad_message::BadMessageReason reason); |
| + url::Origin GetOrigin(); |
| + |
| + RenderFrameHost* render_frame_host_; |
| + RenderProcessHost* render_process_host_; |
| + |
| + mojo::Binding<blink::mojom::WebBluetoothService> binding_; |
| + |
| + // |weak_ptr_on_ui_thread_| provides weak pointers, e.g. for callbacks, and |
| + // because it exists and has been bound to the UI thread enforces that all |
| + // copies verify they are also used on the UI thread. |
| + base::WeakPtr<WebBluetoothServiceImpl> weak_ptr_on_ui_thread_; |
| + base::WeakPtrFactory<WebBluetoothServiceImpl> weak_ptr_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WebBluetoothServiceImpl); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_SERVICE_IMPL_H |