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

Unified 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, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.h
diff --git a/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.h b/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.h
index 2119dc9cd5abf5d01458be57f227cbb34d01ed33..ee354d017dcc6ffd0fed92e85a827d195659e974 100644
--- a/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.h
+++ b/chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.h
@@ -6,6 +6,10 @@
#define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_
#pragma once
+#include <string>
+
+#include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h"
+#include "chrome/browser/chromeos/bluetooth/bluetooth_manager.h"
#include "chrome/browser/ui/webui/options/chromeos/cros_options_page_ui_handler.h"
namespace base {
@@ -15,7 +19,9 @@ class DictionaryValue;
namespace chromeos {
// Handler for Bluetooth options on the system options page.
-class BluetoothOptionsHandler : public chromeos::CrosOptionsPageUIHandler {
+class BluetoothOptionsHandler : public chromeos::CrosOptionsPageUIHandler,
+ public chromeos::BluetoothManager::Observer,
+ public chromeos::BluetoothAdapter::Observer {
public:
BluetoothOptionsHandler();
virtual ~BluetoothOptionsHandler();
@@ -46,14 +52,35 @@ class BluetoothOptionsHandler : public chromeos::CrosOptionsPageUIHandler {
// for device are "deviceName", "deviceId", "deviceType" and "deviceStatus".
void DeviceNotification(const base::DictionaryValue& device);
+ // chromeos::BluetoothManager::Observer override.
+ virtual void DefaultAdapterChanged(chromeos::BluetoothAdapter* adapter);
+
+ // chromeos::BluetoothAdapter::Observer override.
+ virtual void DiscoveryStarted(const std::string& adapter_id);
+
+ // chromeos::BluetoothAdapter::Observer override.
+ virtual void DiscoveryEnded(const std::string& adapter_id);
+
+ // chromeos::BluetoothAdapter::Observer override.
+ virtual void DeviceFound(const std::string& adapter_id,
+ chromeos::BluetoothDevice* device);
+
private:
+ // Compares |adapter| with our cached default adapter ID and calls
+ // DefaultAdapterChanged if there has been an unexpected change.
+ void ValidateDefaultAdapter(chromeos::BluetoothAdapter* adapter);
+
// Simulates extracting a list of available bluetooth devices.
// Called when emulating ChromeOS from a desktop environment.
void GenerateFakeDeviceList();
+ // The id of the current default bluetooth adapter.
+ // The empty string represents "none".
+ std::string default_adapter_id_;
+
DISALLOW_COPY_AND_ASSIGN(BluetoothOptionsHandler);
};
-}
+} // namespace chromeos
#endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698