| OLD | NEW |
| 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_SYSTEM_OPTIONS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_SYSTEM_OPTIONS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_SYSTEM_OPTIONS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_SYSTEM_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 // ChromeOS system options page UI handler. | 19 // ChromeOS system options page UI handler. |
| 16 class SystemOptionsHandler : public chromeos::CrosOptionsPageUIHandler { | 20 class SystemOptionsHandler : public chromeos::CrosOptionsPageUIHandler, |
| 21 public chromeos::BluetoothManager::Observer, |
| 22 public chromeos::BluetoothAdapter::Observer { |
| 17 public: | 23 public: |
| 18 SystemOptionsHandler(); | 24 SystemOptionsHandler(); |
| 19 virtual ~SystemOptionsHandler(); | 25 virtual ~SystemOptionsHandler(); |
| 20 | 26 |
| 21 // OptionsPageUIHandler implementation. | 27 // OptionsPageUIHandler implementation. |
| 22 virtual void GetLocalizedValues(base::DictionaryValue* localized_strings); | 28 virtual void GetLocalizedValues(base::DictionaryValue* localized_strings); |
| 23 virtual void Initialize(); | 29 virtual void Initialize(); |
| 24 | 30 |
| 25 virtual void RegisterMessages(); | 31 virtual void RegisterMessages(); |
| 26 | 32 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 44 // Bluetooth settings. | 50 // Bluetooth settings. |
| 45 // |args| will contain the list of devices currently connected | 51 // |args| will contain the list of devices currently connected |
| 46 // devices according to the System options page. | 52 // devices according to the System options page. |
| 47 void FindBluetoothDevicesCallback(const base::ListValue* args); | 53 void FindBluetoothDevicesCallback(const base::ListValue* args); |
| 48 | 54 |
| 49 // Sends a notification to the Web UI of the status of a bluetooth device. | 55 // Sends a notification to the Web UI of the status of a bluetooth device. |
| 50 // |device| is the decription of the device. The supported dictionary keys | 56 // |device| is the decription of the device. The supported dictionary keys |
| 51 // for device are "deviceName", "deviceId", "deviceType" and "deviceStatus". | 57 // for device are "deviceName", "deviceId", "deviceType" and "deviceStatus". |
| 52 void BluetoothDeviceNotification(const base::DictionaryValue& device); | 58 void BluetoothDeviceNotification(const base::DictionaryValue& device); |
| 53 | 59 |
| 60 // chromeos::BluetoothManager::Observer override. |
| 61 virtual void DefaultAdapterChanged(chromeos::BluetoothAdapter* adapter); |
| 62 |
| 63 // chromeos::BluetoothAdapter::Observer override. |
| 64 virtual void DiscoveryStarted(const std::string& adapter_id); |
| 65 |
| 66 // chromeos::BluetoothAdapter::Observer override. |
| 67 virtual void DiscoveryEnded(const std::string& adapter_id); |
| 68 |
| 69 // chromeos::BluetoothAdapter::Observer override. |
| 70 virtual void DeviceFound(const std::string& adapter_id, |
| 71 chromeos::BluetoothDevice* device); |
| 72 |
| 54 private: | 73 private: |
| 74 // Initializes the bluetooth settings UI. |
| 75 void InitializeBluetooth(); |
| 76 |
| 77 // Shuts down the bluetooth settings UI. |
| 78 void ShutdownBluetooth(); |
| 79 |
| 55 // Simulates extracting a list of available bluetooth devices. | 80 // Simulates extracting a list of available bluetooth devices. |
| 56 // Called when emulating ChromeOS from a desktop environment. | 81 // Called when emulating ChromeOS from a desktop environment. |
| 57 void GenerateFakeDeviceList(); | 82 void GenerateFakeDeviceList(); |
| 58 | 83 |
| 84 // The id of the current default bluetooth adapter. |
| 85 // The empty string represents "none". |
| 86 std::string default_adapter_id_; |
| 87 |
| 59 DISALLOW_COPY_AND_ASSIGN(SystemOptionsHandler); | 88 DISALLOW_COPY_AND_ASSIGN(SystemOptionsHandler); |
| 60 }; | 89 }; |
| 61 | 90 |
| 62 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_SYSTEM_OPTIONS_HANDLER_H_ | 91 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_SYSTEM_OPTIONS_HANDLER_H_ |
| OLD | NEW |