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

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

Issue 8233042: Chrome OS: Attach bluetooth UI to device discovery API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address kevers@ code review comments Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 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 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 #pragma once 7 #pragma once
8 8
9 #include <string>
10
11 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h"
12 #include "chrome/browser/chromeos/bluetooth/bluetooth_manager.h"
9 #include "chrome/browser/ui/webui/options/chromeos/cros_options_page_ui_handler. h" 13 #include "chrome/browser/ui/webui/options/chromeos/cros_options_page_ui_handler. h"
10 14
11 namespace base { 15 namespace base {
12 class DictionaryValue; 16 class DictionaryValue;
13 } 17 }
14 18
15 namespace chromeos { 19 namespace chromeos {
16 20
17 // Handler for Bluetooth options on the system options page. 21 // Handler for Bluetooth options on the system options page.
18 class BluetoothOptionsHandler : public chromeos::CrosOptionsPageUIHandler { 22 class BluetoothOptionsHandler : public chromeos::CrosOptionsPageUIHandler,
23 public chromeos::BluetoothManager::Observer,
24 public chromeos::BluetoothAdapter::Observer {
19 public: 25 public:
20 BluetoothOptionsHandler(); 26 BluetoothOptionsHandler();
21 virtual ~BluetoothOptionsHandler(); 27 virtual ~BluetoothOptionsHandler();
22 28
23 // OptionsPageUIHandler implementation. 29 // OptionsPageUIHandler implementation.
24 virtual void GetLocalizedValues(base::DictionaryValue* localized_strings); 30 virtual void GetLocalizedValues(base::DictionaryValue* localized_strings);
25 virtual void Initialize(); 31 virtual void Initialize();
26 virtual void RegisterMessages(); 32 virtual void RegisterMessages();
27 33
28 // Called when the 'Enable bluetooth' checkbox value is changed. 34 // Called when the 'Enable bluetooth' checkbox value is changed.
(...skipping 10 matching lines...) Expand all
39 // device. 45 // device.
40 // |args| will be a list containing two arguments, the first argument is the 46 // |args| will be a list containing two arguments, the first argument is the
41 // device ID and the second is the requested action. 47 // device ID and the second is the requested action.
42 void UpdateDeviceCallback(const base::ListValue* args); 48 void UpdateDeviceCallback(const base::ListValue* args);
43 49
44 // Sends a notification to the Web UI of the status of a bluetooth device. 50 // Sends a notification to the Web UI of the status of a bluetooth device.
45 // |device| is the decription of the device. The supported dictionary keys 51 // |device| is the decription of the device. The supported dictionary keys
46 // for device are "deviceName", "deviceId", "deviceType" and "deviceStatus". 52 // for device are "deviceName", "deviceId", "deviceType" and "deviceStatus".
47 void DeviceNotification(const base::DictionaryValue& device); 53 void DeviceNotification(const base::DictionaryValue& device);
48 54
55 // chromeos::BluetoothManager::Observer override.
56 virtual void DefaultAdapterChanged(chromeos::BluetoothAdapter* adapter);
57
58 // chromeos::BluetoothAdapter::Observer override.
59 virtual void DiscoveryStarted(const std::string& adapter_id);
60
61 // chromeos::BluetoothAdapter::Observer override.
62 virtual void DiscoveryEnded(const std::string& adapter_id);
63
64 // chromeos::BluetoothAdapter::Observer override.
65 virtual void DeviceFound(const std::string& adapter_id,
66 chromeos::BluetoothDevice* device);
67
49 private: 68 private:
69 // Compares |adapter| with our cached default adapter ID and calls
70 // DefaultAdapterChanged if there has been an unexpected change.
71 void ValidateDefaultAdapter(chromeos::BluetoothAdapter* adapter);
72
50 // Simulates extracting a list of available bluetooth devices. 73 // Simulates extracting a list of available bluetooth devices.
51 // Called when emulating ChromeOS from a desktop environment. 74 // Called when emulating ChromeOS from a desktop environment.
52 void GenerateFakeDeviceList(); 75 void GenerateFakeDeviceList();
53 76
77 // The id of the current default bluetooth adapter.
78 // The empty string represents "none".
79 std::string default_adapter_id_;
80
54 DISALLOW_COPY_AND_ASSIGN(BluetoothOptionsHandler); 81 DISALLOW_COPY_AND_ASSIGN(BluetoothOptionsHandler);
55 }; 82 };
56 83
57 } 84 } // namespace chromeos
58 85
59 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_ 86 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698