| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.h
" | 5 #include "chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.h
" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 web_ui()->RegisterMessageCallback("stopBluetoothDeviceDiscovery", | 159 web_ui()->RegisterMessageCallback("stopBluetoothDeviceDiscovery", |
| 160 base::Bind(&BluetoothOptionsHandler::StopDiscoveryCallback, | 160 base::Bind(&BluetoothOptionsHandler::StopDiscoveryCallback, |
| 161 base::Unretained(this))); | 161 base::Unretained(this))); |
| 162 web_ui()->RegisterMessageCallback("getPairedBluetoothDevices", | 162 web_ui()->RegisterMessageCallback("getPairedBluetoothDevices", |
| 163 base::Bind(&BluetoothOptionsHandler::GetPairedDevicesCallback, | 163 base::Bind(&BluetoothOptionsHandler::GetPairedDevicesCallback, |
| 164 base::Unretained(this))); | 164 base::Unretained(this))); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void BluetoothOptionsHandler::InitializeHandler() { | 167 void BluetoothOptionsHandler::InitializeHandler() { |
| 168 adapter_.reset(BluetoothAdapter::CreateDefaultAdapter()); | 168 adapter_.reset(BluetoothAdapter::CreateDefaultAdapter()); |
| 169 adapter_->AddObserver(this); | |
| 170 } | 169 } |
| 171 | 170 |
| 172 void BluetoothOptionsHandler::InitializePage() { | 171 void BluetoothOptionsHandler::InitializePage() { |
| 172 adapter_->AddObserver(this); |
| 173 |
| 173 // Show or hide the bluetooth settings and update the checkbox based | 174 // Show or hide the bluetooth settings and update the checkbox based |
| 174 // on the current present/powered state. | 175 // on the current present/powered state. |
| 175 AdapterPresentChanged(adapter_.get(), adapter_->IsPresent()); | 176 AdapterPresentChanged(adapter_.get(), adapter_->IsPresent()); |
| 176 // Automatically start device discovery if the "Add Bluetooth Device" | 177 // Automatically start device discovery if the "Add Bluetooth Device" |
| 177 // overlay is visible. | 178 // overlay is visible. |
| 178 web_ui()->CallJavascriptFunction( | 179 web_ui()->CallJavascriptFunction( |
| 179 "options.BluetoothOptions.updateDiscovery"); | 180 "options.BluetoothOptions.updateDiscovery"); |
| 180 } | 181 } |
| 181 | 182 |
| 182 void BluetoothOptionsHandler::EnableChangeCallback( | 183 void BluetoothOptionsHandler::EnableChangeCallback( |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 DCHECK(device); | 412 DCHECK(device); |
| 412 | 413 |
| 413 base::StringValue address(device->address()); | 414 base::StringValue address(device->address()); |
| 414 web_ui()->CallJavascriptFunction( | 415 web_ui()->CallJavascriptFunction( |
| 415 "options.BrowserOptions.removeBluetoothDevice", | 416 "options.BrowserOptions.removeBluetoothDevice", |
| 416 address); | 417 address); |
| 417 } | 418 } |
| 418 | 419 |
| 419 } // namespace options2 | 420 } // namespace options2 |
| 420 } // namespace chromeos | 421 } // namespace chromeos |
| OLD | NEW |