Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_CHILD_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ | 5 #ifndef CONTENT_CHILD_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ |
| 6 #define CONTENT_CHILD_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ | 6 #define CONTENT_CHILD_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | |
| 9 | |
| 8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/ref_counted.h" | |
| 9 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 10 #include "third_party/WebKit/public/platform/WebBluetooth.h" | 13 #include "third_party/WebKit/public/platform/WebBluetooth.h" |
| 11 #include "third_party/WebKit/public/platform/WebBluetoothError.h" | |
| 12 | 14 |
| 13 namespace content { | 15 namespace content { |
| 14 | 16 |
| 15 // Mock implementation of blink::WebBluetooth until a more complete | 17 class BluetoothDispatcher; |
| 16 // implementation is built out. | 18 class ThreadSafeSender; |
| 19 | |
| 20 // Implementation of blink::WebBluetooth. Passes calls through to the thread | |
| 21 // specific BluetoothDispatcher. | |
| 17 class CONTENT_EXPORT WebBluetoothImpl | 22 class CONTENT_EXPORT WebBluetoothImpl |
| 18 : NON_EXPORTED_BASE(public blink::WebBluetooth) { | 23 : NON_EXPORTED_BASE(public blink::WebBluetooth) { |
| 19 public: | 24 public: |
| 20 WebBluetoothImpl(); | 25 explicit WebBluetoothImpl(ThreadSafeSender* thread_safe_sender); |
| 26 ~WebBluetoothImpl(); | |
| 21 | 27 |
| 22 // WebBluetooth interface: | 28 // blink::WebBluetooth interface: |
| 23 void requestDevice(blink::WebBluetoothRequestDeviceCallbacks*) override; | 29 // TODO: Remove void version after crrev.com/715613005 lands. |
|
nasko
2014/11/25 23:27:01
nit: TODO(username):
scheib
2014/11/26 00:46:34
Done.
| |
| 30 void requestDevice( | |
| 31 blink::WebCallbacks<void, blink::WebBluetoothError>* callbacks) override; | |
| 32 void requestDevice( | |
| 33 blink::WebCallbacks<blink::WebBluetoothDevice, blink::WebBluetoothError>* | |
| 34 callbacks) override; | |
| 24 | 35 |
| 25 // Testing interface: | 36 // Testing interface: |
| 26 void SetBluetoothMockDataSetForTesting(const std::string& name); | 37 void SetBluetoothMockDataSetForTesting(const std::string& name); |
| 27 | 38 |
| 28 private: | 39 private: |
| 29 enum class MockData { NOT_MOCKING, REJECT, RESOLVE }; | 40 BluetoothDispatcher* GetDispatcher(); |
| 30 MockData m_bluetoothMockDataSet; | 41 |
| 31 blink::WebBluetoothError::ErrorType m_bluetoothRequestDeviceRejectType; | 42 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(WebBluetoothImpl); | |
| 32 }; | 45 }; |
| 33 | 46 |
| 34 } // namespace content | 47 } // namespace content |
| 35 | 48 |
| 36 #endif // CONTENT_CHILD_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ | 49 #endif // CONTENT_CHILD_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ |
| OLD | NEW |