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

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

Issue 9814030: get rid of old options pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 8 years, 9 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h"
14 #include "chrome/browser/ui/webui/options/options_ui.h"
15
16 namespace base {
17 class DictionaryValue;
18 }
19
20 namespace chromeos {
21
22 // Handler for Bluetooth options on the system options page.
23 class BluetoothOptionsHandler : public OptionsPageUIHandler,
24 public chromeos::BluetoothAdapter::Observer {
25 public:
26 BluetoothOptionsHandler();
27 virtual ~BluetoothOptionsHandler();
28
29 // Potential errors during the process of pairing or connecting to a
30 // Bluetooth device. Each enumerated value is associated with an i18n
31 // label for display in the Bluetooth UI.
32 enum ConnectionError {
33 DEVICE_NOT_FOUND,
34 INCORRECT_PIN,
35 CONNECTION_TIMEOUT,
36 CONNECTION_REJECTED
37 };
38
39 // OptionsPageUIHandler implementation.
40 virtual void GetLocalizedValues(
41 base::DictionaryValue* localized_strings) OVERRIDE;
42 virtual void InitializeHandler() OVERRIDE;
43 virtual void RegisterMessages() OVERRIDE;
44
45 // Called when the 'Enable bluetooth' checkbox value is changed.
46 // |args| will contain the checkbox checked state as a string
47 // ("true" or "false").
48 void EnableChangeCallback(const base::ListValue* args);
49
50 // Called when the 'Find Devices' button is pressed from the Bluetooth
51 // ssettings.
52 // |args| will be an empty list.
53 void FindDevicesCallback(const base::ListValue* args);
54
55 // Called when the user requests to connect to or disconnect from a Bluetooth
56 // device.
57 // |args| will be a list containing two or three arguments, the first argument
58 // is the device ID and the second is the requested action. If a third
59 // argument is present, it is the passkey for pairing confirmation.
60 void UpdateDeviceCallback(const base::ListValue* args);
61
62 // Sends a notification to the Web UI of the status of a Bluetooth device.
63 // |device| is the Bluetooth device.
64 // |params| is an optional set of parameters.
65 void SendDeviceNotification(const BluetoothDevice* device,
66 base::DictionaryValue* params);
67
68 // Displays a passkey for a device, requesting user confirmation that the
69 // key matches an expected value (value displayed on a smartphone for
70 // example).
71 // |device| is the Bluetooth device being paired.
72 // |passkey| is the passkey to display for confirmation.
73 void RequestConfirmation(const BluetoothDevice* device,
74 int passkey);
75
76 // Displays a passkey for a device, which is being typed remotely. During
77 // the pairing process, this method may be called repeatedly to track the
78 // number of characters entered. This method is commonly used for pairing
79 // keyboards.
80 // |device| is the Bluetooth device being paired.
81 // |passkey| is the required passkey.
82 // |entered| is the number of characters that have already been entered on
83 // the remote device.
84 void DisplayPasskey(const BluetoothDevice* device,
85 int passkey,
86 int entered);
87
88 // Displays a blank field for entering a passkey. The passkey may be
89 // a set value specified by the manufacturer of the Bluetooth device, or
90 // on a remote display. The validation is asychronous, and a call is made
91 // to |ValidatePasskeyCallback| when the passkey entry is complete.
92 // |device| is the Bluetooth device being paired.
93 void RequestPasskey(const BluetoothDevice* device);
94
95 // Displays an error that occurred during the pairing or connection process.
96 // |device| is the Bluetooth device being paired or connected.
97 // |error| is the type of error that occurred.
98 void ReportError(const BluetoothDevice* device, ConnectionError error);
99
100 // BluetoothAdapter::Observer implementation.
101 virtual void AdapterPresentChanged(BluetoothAdapter* adapter,
102 bool present) OVERRIDE;
103 virtual void AdapterPoweredChanged(BluetoothAdapter* adapter,
104 bool powered) OVERRIDE;
105 virtual void AdapterDiscoveringChanged(BluetoothAdapter* adapter,
106 bool discovering) OVERRIDE;
107 virtual void DeviceAdded(BluetoothAdapter* adapter,
108 BluetoothDevice* device) OVERRIDE;
109 virtual void DeviceChanged(BluetoothAdapter* adapter,
110 BluetoothDevice* device) OVERRIDE;
111
112 private:
113 // Called by BluetoothAdapter in response to our method calls in case of
114 // error.
115 void ErrorCallback();
116
117 // Default bluetooth adapter, used for all operations. Owned by this object.
118 scoped_ptr<BluetoothAdapter> adapter_;
119
120 DISALLOW_COPY_AND_ASSIGN(BluetoothOptionsHandler);
121 };
122
123 } // namespace chromeos
124
125 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698