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

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

Issue 8930012: Revert 114236 - Options2: Pull the trigger. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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) 2011 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_OPTIONS2_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/compiler_specific.h"
12 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h"
13 #include "chrome/browser/chromeos/bluetooth/bluetooth_manager.h"
14 #include "chrome/browser/ui/webui/options2/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 OptionsPage2UIHandler,
24 public chromeos::BluetoothManager::Observer,
25 public chromeos::BluetoothAdapter::Observer {
26 public:
27 BluetoothOptionsHandler();
28 virtual ~BluetoothOptionsHandler();
29
30 // OptionsPage2UIHandler implementation.
31 virtual void GetLocalizedValues(
32 base::DictionaryValue* localized_strings) OVERRIDE;
33 virtual void Initialize() OVERRIDE;
34 virtual void RegisterMessages() OVERRIDE;
35
36 // Called when the 'Enable bluetooth' checkbox value is changed.
37 // |args| will contain the checkbox checked state as a string
38 // ("true" or "false").
39 void EnableChangeCallback(const base::ListValue* args);
40
41 // Called when the 'Find Devices' button is pressed from the Bluetooth
42 // ssettings.
43 // |args| will be an empty list.
44 void FindDevicesCallback(const base::ListValue* args);
45
46 // Called when the user requests to connect to or disconnect from a Bluetooth
47 // device.
48 // |args| will be a list containing two or three arguments, the first argument
49 // is the device ID and the second is the requested action. If a third
50 // argument is present, it is the passkey for pairing confirmation.
51 void UpdateDeviceCallback(const base::ListValue* args);
52
53 // Sends a notification to the Web UI of the status of a Bluetooth device.
54 // |device| is the Bluetooth device.
55 // |params| is an optional set of parameters.
56 void SendDeviceNotification(chromeos::BluetoothDevice* device,
57 base::DictionaryValue* params);
58
59 // Displays a passkey for a device, requesting user confirmation that the
60 // key matches an expected value (value displayed on a smartphone for
61 // example).
62 // |device| is the Bluetooth device being paired.
63 // |passkey| is the passkey to display for confirmation.
64 void RequestConfirmation(chromeos::BluetoothDevice* device,
65 int passkey);
66
67 // Displays a passkey for a device, which is being typed remotely. During
68 // the pairing process, this method may be called repeatedly to track the
69 // number of characters entered. This method is commonly used for pairing
70 // keyboards.
71 // |device| is the Bluetooth device being paired.
72 // |passkey| is the required passkey.
73 // |entered| is the number of characters that have already been entered on
74 // the remote device.
75 void DisplayPasskey(chromeos::BluetoothDevice* device,
76 int passkey,
77 int entered);
78
79 // Displays a blank field for entering a passkey. The passkey may be
80 // a set value specified by the manufacturer of the Bluetooth device, or
81 // on a remote display. The validation is asychronous, and a call is made
82 // to |ValidatePasskeyCallback| when the passkey entry is complete.
83 // |device| is the Bluetooth device being paired.
84 void RequestPasskey(chromeos::BluetoothDevice* device);
85
86 // Callback to validate a user entered passkey.
87 // |args| is a list containing the device address and entered passkey.
88 void ValidatePasskeyCallback(const base::ListValue* args);
89
90 // chromeos::BluetoothManager::Observer override.
91 virtual void DefaultAdapterChanged(
92 chromeos::BluetoothAdapter* adapter) OVERRIDE;
93
94 // chromeos::BluetoothAdapter::Observer override.
95 virtual void DiscoveryStarted(const std::string& adapter_id) OVERRIDE;
96
97 // chromeos::BluetoothAdapter::Observer override.
98 virtual void DiscoveryEnded(const std::string& adapter_id) OVERRIDE;
99
100 // chromeos::BluetoothAdapter::Observer override.
101 virtual void DeviceFound(const std::string& adapter_id,
102 chromeos::BluetoothDevice* device) OVERRIDE;
103
104 private:
105 // Compares |adapter| with our cached default adapter ID and calls
106 // DefaultAdapterChanged if there has been an unexpected change.
107 void ValidateDefaultAdapter(chromeos::BluetoothAdapter* adapter);
108
109 // Simulates extracting a list of available bluetooth devices.
110 // Called when emulating ChromeOS from a desktop environment.
111 void GenerateFakeDeviceList();
112
113 // Simulates the discovery or pairing of a Bluetooth device. Used when
114 // emulating ChromeOS from a desktop environment.
115 // |name| is the display name for the device.
116 // |address| is the unique Mac address of the device.
117 // |icon| is the base name of the icon to use for the device and corresponds
118 // to the general device category (e.g. mouse or keyboard).
119 // |paired| indicates if the device is paired.
120 // |connected| indicates if the device is connected.
121 // |pairing| indicates the type of pairing operation.
122 void GenerateFakeDevice(const std::string& name,
123 const std::string& address,
124 const std::string& icon,
125 bool paired,
126 bool connected,
127 const std::string& pairing);
128
129 // The id of the current default bluetooth adapter.
130 // The empty string represents "none".
131 std::string default_adapter_id_;
132
133 DISALLOW_COPY_AND_ASSIGN(BluetoothOptionsHandler);
134 };
135
136 } // namespace chromeos
137
138 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698