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

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.h

Issue 10899037: Refactoring bluetooth API code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing styles and tess. Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" 14 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h"
14 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h" 15 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h"
15 #include "chrome/browser/ui/webui/options/options_ui.h" 16 #include "chrome/browser/ui/webui/options/options_ui.h"
16 17
17 namespace base { 18 namespace base {
18 class DictionaryValue; 19 class DictionaryValue;
19 } 20 }
20 21
21 namespace chromeos { 22 namespace chromeos {
22 namespace options { 23 namespace options {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // 82 //
82 // This method will be called when the Bluetooth daemon requires that the 83 // This method will be called when the Bluetooth daemon requires that the
83 // user enter the Passkey |passkey| into the device |device| so that it 84 // user enter the Passkey |passkey| into the device |device| so that it
84 // may be authenticated, the UI will display the passkey with accompanying 85 // may be authenticated, the UI will display the passkey with accompanying
85 // instructions. 86 // instructions.
86 // 87 //
87 // This is used for Bluetooth 2.1 and later devices that support input 88 // This is used for Bluetooth 2.1 and later devices that support input
88 // but not display, such as keyboards. The Passkey is a numeric in the 89 // but not display, such as keyboards. The Passkey is a numeric in the
89 // range 0-999999 and should be always presented zero-padded to six 90 // range 0-999999 and should be always presented zero-padded to six
90 // digits. 91 // digits.
91 virtual void DisplayPasskey(BluetoothDevice* device, 92 virtual void DisplayPasskey(BluetoothDevice* device, uint32 passkey) OVERRIDE;
92 uint32 passkey) OVERRIDE;
93 93
94 // BluetoothDevice::PairingDelegate override. 94 // BluetoothDevice::PairingDelegate override.
95 // 95 //
96 // This method will be called when the Bluetooth daemon requires that the 96 // This method will be called when the Bluetooth daemon requires that the
97 // user confirm that the Passkey |passkey| is displayed on the screen 97 // user confirm that the Passkey |passkey| is displayed on the screen
98 // of the device |device| so that it may be authenticated, the UI will 98 // of the device |device| so that it may be authenticated, the UI will
99 // display the passkey with accompanying instructions. 99 // display the passkey with accompanying instructions.
100 // 100 //
101 // This is used for Bluetooth 2.1 and later devices that support display, 101 // This is used for Bluetooth 2.1 and later devices that support display,
102 // such as other computers or phones. The Passkey is a numeric in the 102 // such as other computers or phones. The Passkey is a numeric in the
103 // range 0-999999 and should be always present zero-padded to six 103 // range 0-999999 and should be always present zero-padded to six
104 // digits. 104 // digits.
105 virtual void ConfirmPasskey(BluetoothDevice* device, 105 virtual void ConfirmPasskey(BluetoothDevice* device, uint32 passkey) OVERRIDE;
106 uint32 passkey) OVERRIDE;
107 106
108 // BluetoothDevice::PairingDelegate override. 107 // BluetoothDevice::PairingDelegate override.
109 // 108 //
110 // This method will be called when any previous DisplayPinCode(), 109 // This method will be called when any previous DisplayPinCode(),
111 // DisplayPasskey() or ConfirmPasskey() request should be concluded 110 // DisplayPasskey() or ConfirmPasskey() request should be concluded
112 // and removed from the user. 111 // and removed from the user.
113 virtual void DismissDisplayOrConfirm() OVERRIDE; 112 virtual void DismissDisplayOrConfirm() OVERRIDE;
114 113
115 // Displays a Bluetooth error. 114 // Displays a Bluetooth error.
116 // |error| maps to a localized resource for the error message. 115 // |error| maps to a localized resource for the error message.
117 // |address| is the address of the Bluetooth device. May be an empty 116 // |address| is the address of the Bluetooth device. May be an empty
118 // string if the error is not specific to a single device. 117 // string if the error is not specific to a single device.
119 void ReportError(const std::string& error, const std::string& address); 118 void ReportError(const std::string& error, const std::string& address);
120 119
121 // BluetoothAdapter::Observer implementation. 120 // BluetoothAdapter::Observer implementation.
122 virtual void AdapterPresentChanged(BluetoothAdapter* adapter, 121 virtual void AdapterPresentChanged(BluetoothAdapter* adapter,
123 bool present) OVERRIDE; 122 bool present) OVERRIDE;
124 virtual void AdapterPoweredChanged(BluetoothAdapter* adapter, 123 virtual void AdapterPoweredChanged(BluetoothAdapter* adapter,
125 bool powered) OVERRIDE; 124 bool powered) OVERRIDE;
125 virtual void AdapterDiscoveringChanged(BluetoothAdapter* adapter,
126 bool discovering) OVERRIDE;
keybuk 2012/09/13 23:57:30 Why has this been added?
youngki 2012/09/17 21:53:02 I added it when Observer was pure virtual; now I r
126 virtual void DeviceAdded(BluetoothAdapter* adapter, 127 virtual void DeviceAdded(BluetoothAdapter* adapter,
127 BluetoothDevice* device) OVERRIDE; 128 BluetoothDevice* device) OVERRIDE;
128 virtual void DeviceChanged(BluetoothAdapter* adapter, 129 virtual void DeviceChanged(BluetoothAdapter* adapter,
129 BluetoothDevice* device) OVERRIDE; 130 BluetoothDevice* device) OVERRIDE;
130 virtual void DeviceRemoved(BluetoothAdapter* adapter, 131 virtual void DeviceRemoved(BluetoothAdapter* adapter,
131 BluetoothDevice* device) OVERRIDE; 132 BluetoothDevice* device) OVERRIDE;
132 133
133 private: 134 private:
134 // Called by BluetoothAdapter in response to a failure to change the 135 // Called by BluetoothAdapter in response to a failure to change the power
135 // power status of the adapter. 136 // status of the adapter.
136 void EnableChangeError(); 137 void EnableChangeError();
137 138
138 // Called by BluetoothAdapter in response to a failure to set the adapter 139 // Called by BluetoothAdapter in response to a failure to set the adapter into
139 // into discovery mode. 140 // discovery mode.
140 void FindDevicesError(); 141 void FindDevicesError();
141 142
142 // Called by BluetoothAdapter in response to a failure to remove the adapter 143 // Called by BluetoothAdapter in response to a failure to remove the adapter
143 // from discovery mode. 144 // from discovery mode.
144 void StopDiscoveryError(); 145 void StopDiscoveryError();
145 146
146 // Called by BluetoothDevice in response to a failure to connect to the 147 // Called by BluetoothDevice in response to a failure to connect to the device
147 // device with bluetooth address |address|. 148 // with bluetooth address |address|.
148 void ConnectError(const std::string& address); 149 void ConnectError(const std::string& address);
149 150
150 // Called by BluetoothDevice in response to a failure to disconnect the 151 // Called by BluetoothDevice in response to a failure to disconnect the device
151 // device with bluetooth address |address|. 152 // with bluetooth address |address|.
152 void DisconnectError(const std::string& address); 153 void DisconnectError(const std::string& address);
153 154
154 // Called by BluetoothDevice in response to a failure to disconnect and 155 // Called by BluetoothDevice in response to a failure to disconnect and unpair
155 // unpair the device with bluetooth address |address|. 156 // the device with bluetooth address |address|.
156 void ForgetError(const std::string& address); 157 void ForgetError(const std::string& address);
157 158
158 // Called when the 'Enable bluetooth' checkbox value is changed. 159 // Called when the 'Enable bluetooth' checkbox value is changed.
159 // |args| will contain the checkbox checked state as a string 160 // |args| will contain the checkbox checked state as a string
160 // ("true" or "false"). 161 // ("true" or "false").
161 void EnableChangeCallback(const base::ListValue* args); 162 void EnableChangeCallback(const base::ListValue* args);
162 163
163 // Called when the 'Find Devices' button is pressed from the Bluetooth 164 // Called when the 'Find Devices' button is pressed from the Bluetooth
164 // ssettings. 165 // ssettings.
165 // |args| will be an empty list. 166 // |args| will be an empty list.
(...skipping 23 matching lines...) Expand all
189 // than this object does. 190 // than this object does.
190 base::WeakPtrFactory<BluetoothOptionsHandler> weak_ptr_factory_; 191 base::WeakPtrFactory<BluetoothOptionsHandler> weak_ptr_factory_;
191 192
192 DISALLOW_COPY_AND_ASSIGN(BluetoothOptionsHandler); 193 DISALLOW_COPY_AND_ASSIGN(BluetoothOptionsHandler);
193 }; 194 };
194 195
195 } // namespace options 196 } // namespace options
196 } // namespace chromeos 197 } // namespace chromeos
197 198
198 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_ 199 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698