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

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

Issue 2394423002: bluetooth: Rename blink::mojom::WebBluetoothError (Closed)
Patch Set: bluetooth: Rename blink::mojom::WebBluetoothError Created 4 years, 2 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
« no previous file with comments | « no previous file | content/browser/bluetooth/bluetooth_device_chooser_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_ 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_
6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_ 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 17 matching lines...) Expand all
28 class WebBluetoothServiceImpl; 28 class WebBluetoothServiceImpl;
29 29
30 // Class that interacts with a chooser and starts a bluetooth discovery session. 30 // Class that interacts with a chooser and starts a bluetooth discovery session.
31 // This class needs to be re-instantiated for each call to GetDevice(). Calling 31 // This class needs to be re-instantiated for each call to GetDevice(). Calling
32 // GetDevice() twice for the same instance will DCHECK. 32 // GetDevice() twice for the same instance will DCHECK.
33 class CONTENT_EXPORT BluetoothDeviceChooserController final { 33 class CONTENT_EXPORT BluetoothDeviceChooserController final {
34 public: 34 public:
35 typedef base::Callback<void(blink::mojom::WebBluetoothRequestDeviceOptionsPtr, 35 typedef base::Callback<void(blink::mojom::WebBluetoothRequestDeviceOptionsPtr,
36 const std::string& device_address)> 36 const std::string& device_address)>
37 SuccessCallback; 37 SuccessCallback;
38 typedef base::Callback<void(blink::mojom::WebBluetoothError error)> 38 typedef base::Callback<void(blink::mojom::WebBluetoothResult result)>
39 ErrorCallback; 39 ErrorCallback;
40 40
41 // |web_bluetooth_service_| service that owns this class. 41 // |web_bluetooth_service_| service that owns this class.
42 // |render_frame_host| should be the RenderFrameHost that owns the 42 // |render_frame_host| should be the RenderFrameHost that owns the
43 // |web_bluetooth_service_|. 43 // |web_bluetooth_service_|.
44 // |adapter| should be the adapter used to scan for Bluetooth devices. 44 // |adapter| should be the adapter used to scan for Bluetooth devices.
45 BluetoothDeviceChooserController( 45 BluetoothDeviceChooserController(
46 WebBluetoothServiceImpl* web_bluetooth_service_, 46 WebBluetoothServiceImpl* web_bluetooth_service_,
47 RenderFrameHost* render_frame_host, 47 RenderFrameHost* render_frame_host,
48 device::BluetoothAdapter* adapter); 48 device::BluetoothAdapter* adapter);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // BluetoothChooser::EventHandler: 105 // BluetoothChooser::EventHandler:
106 // Runs error_callback_ if the chooser was cancelled or if we weren't able 106 // Runs error_callback_ if the chooser was cancelled or if we weren't able
107 // to show the chooser. Otherwise runs success_callback_ with 107 // to show the chooser. Otherwise runs success_callback_ with
108 // |device_address|. 108 // |device_address|.
109 void OnBluetoothChooserEvent(BluetoothChooser::Event event, 109 void OnBluetoothChooserEvent(BluetoothChooser::Event event,
110 const std::string& device_address); 110 const std::string& device_address);
111 111
112 // Helper function to asynchronously run success_callback_. 112 // Helper function to asynchronously run success_callback_.
113 void PostSuccessCallback(const std::string& device_address); 113 void PostSuccessCallback(const std::string& device_address);
114 // Helper function to asynchronously run error_callback_. 114 // Helper function to asynchronously run error_callback_.
115 void PostErrorCallback(blink::mojom::WebBluetoothError error); 115 void PostErrorCallback(blink::mojom::WebBluetoothResult result);
116 116
117 // If true all new instances of this class will have a scan duration of 0. 117 // If true all new instances of this class will have a scan duration of 0.
118 static bool use_test_scan_duration_; 118 static bool use_test_scan_duration_;
119 119
120 // The adapter used to get existing devices and start a discovery session. 120 // The adapter used to get existing devices and start a discovery session.
121 device::BluetoothAdapter* adapter_; 121 device::BluetoothAdapter* adapter_;
122 // The WebBluetoothServiceImpl that owns this instance. 122 // The WebBluetoothServiceImpl that owns this instance.
123 WebBluetoothServiceImpl* web_bluetooth_service_; 123 WebBluetoothServiceImpl* web_bluetooth_service_;
124 // The RenderFrameHost that owns web_bluetooth_service_. 124 // The RenderFrameHost that owns web_bluetooth_service_.
125 RenderFrameHost* render_frame_host_; 125 RenderFrameHost* render_frame_host_;
(...skipping 23 matching lines...) Expand all
149 // Weak pointer factory for generating 'this' pointers that might live longer 149 // Weak pointer factory for generating 'this' pointers that might live longer
150 // than we do. 150 // than we do.
151 // Note: This should remain the last member so it'll be destroyed and 151 // Note: This should remain the last member so it'll be destroyed and
152 // invalidate its weak pointers before any other members are destroyed. 152 // invalidate its weak pointers before any other members are destroyed.
153 base::WeakPtrFactory<BluetoothDeviceChooserController> weak_ptr_factory_; 153 base::WeakPtrFactory<BluetoothDeviceChooserController> weak_ptr_factory_;
154 }; 154 };
155 155
156 } // namespace content 156 } // namespace content
157 157
158 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_ 158 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/bluetooth/bluetooth_device_chooser_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698