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

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

Issue 12310048: Bluetooth: Add a "connectable" property to the BluetoothDevice. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 10 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 unified diff | Download patch
OLDNEW
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/options/chromeos/bluetooth_options_handler.h" 5 #include "chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 { "bluetoothConnectAuthFailed", 129 { "bluetoothConnectAuthFailed",
130 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECT_AUTH_FAILED }, 130 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECT_AUTH_FAILED },
131 { "bluetoothConnectAuthCanceled", 131 { "bluetoothConnectAuthCanceled",
132 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECT_AUTH_CANCELED }, 132 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECT_AUTH_CANCELED },
133 { "bluetoothConnectAuthRejected", 133 { "bluetoothConnectAuthRejected",
134 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECT_AUTH_REJECTED }, 134 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECT_AUTH_REJECTED },
135 { "bluetoothConnectAuthTimeout", 135 { "bluetoothConnectAuthTimeout",
136 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECT_AUTH_TIMEOUT }, 136 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECT_AUTH_TIMEOUT },
137 { "bluetoothConnectUnsupportedDevice", 137 { "bluetoothConnectUnsupportedDevice",
138 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECT_UNSUPPORTED_DEVICE }, 138 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECT_UNSUPPORTED_DEVICE },
139 { "bluetoothConnectSdpFailed",
140 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECT_SDP_FAILED },
139 { "bluetoothDisconnectFailed", 141 { "bluetoothDisconnectFailed",
140 IDS_OPTIONS_SETTINGS_BLUETOOTH_DISCONNECT_FAILED }, 142 IDS_OPTIONS_SETTINGS_BLUETOOTH_DISCONNECT_FAILED },
141 { "bluetoothForgetFailed", 143 { "bluetoothForgetFailed",
142 IDS_OPTIONS_SETTINGS_BLUETOOTH_FORGET_FAILED }}; 144 IDS_OPTIONS_SETTINGS_BLUETOOTH_FORGET_FAILED }};
143 145
144 RegisterStrings(localized_strings, resources, arraysize(resources)); 146 RegisterStrings(localized_strings, resources, arraysize(resources));
145 } 147 }
146 148
147 // TODO(kevers): Reorder methods to match ordering in the header file. 149 // TODO(kevers): Reorder methods to match ordering in the header file.
148 150
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 break; 355 break;
354 case device::BluetoothDevice::ERROR_AUTH_REJECTED: 356 case device::BluetoothDevice::ERROR_AUTH_REJECTED:
355 error_name = "bluetoothConnectAuthRejected"; 357 error_name = "bluetoothConnectAuthRejected";
356 break; 358 break;
357 case device::BluetoothDevice::ERROR_AUTH_TIMEOUT: 359 case device::BluetoothDevice::ERROR_AUTH_TIMEOUT:
358 error_name = "bluetoothConnectAuthTimeout"; 360 error_name = "bluetoothConnectAuthTimeout";
359 break; 361 break;
360 case device::BluetoothDevice::ERROR_UNSUPPORTED_DEVICE: 362 case device::BluetoothDevice::ERROR_UNSUPPORTED_DEVICE:
361 error_name = "bluetoothConnectUnsupportedDevice"; 363 error_name = "bluetoothConnectUnsupportedDevice";
362 break; 364 break;
365 case device::BluetoothDevice::ERROR_SDP_FAILED:
366 error_name = "bluetoothConnectSdpFailed";
Dan Beam 2013/02/21 22:42:40 what does SDP mean?
deymo 2013/02/22 23:09:09 SDP = Service Discovery Protocol BTW, I'll remove
367 break;
363 } 368 }
364 // Report an error only if there's an error to report. 369 // Report an error only if there's an error to report.
365 if (error_name) 370 if (error_name)
366 ReportError(error_name, address); 371 ReportError(error_name, address);
367 } 372 }
368 373
369 void BluetoothOptionsHandler::DisconnectError(const std::string& address) { 374 void BluetoothOptionsHandler::DisconnectError(const std::string& address) {
370 DVLOG(1) << "Failed to disconnect from device: " << address; 375 DVLOG(1) << "Failed to disconnect from device: " << address;
371 ReportError("bluetoothDisconnectFailed", address); 376 ReportError("bluetoothDisconnectFailed", address);
372 } 377 }
(...skipping 30 matching lines...) Expand all
403 408
404 void BluetoothOptionsHandler::SendDeviceNotification( 409 void BluetoothOptionsHandler::SendDeviceNotification(
405 const device::BluetoothDevice* device, 410 const device::BluetoothDevice* device,
406 base::DictionaryValue* params) { 411 base::DictionaryValue* params) {
407 base::DictionaryValue js_properties; 412 base::DictionaryValue js_properties;
408 js_properties.SetString("name", device->GetName()); 413 js_properties.SetString("name", device->GetName());
409 js_properties.SetString("address", device->address()); 414 js_properties.SetString("address", device->address());
410 js_properties.SetBoolean("paired", device->IsPaired()); 415 js_properties.SetBoolean("paired", device->IsPaired());
411 js_properties.SetBoolean("bonded", device->IsBonded()); 416 js_properties.SetBoolean("bonded", device->IsBonded());
412 js_properties.SetBoolean("connected", device->IsConnected()); 417 js_properties.SetBoolean("connected", device->IsConnected());
418 js_properties.SetBoolean("connectable", device->IsConnectable());
Dan Beam 2013/02/21 22:42:40 also, I have no idea what "connectable" means.
deymo 2013/02/22 23:09:09 I chose the term "Connectable" from the "HIDNormal
413 if (params) 419 if (params)
414 js_properties.MergeDictionary(params); 420 js_properties.MergeDictionary(params);
415 web_ui()->CallJavascriptFunction( 421 web_ui()->CallJavascriptFunction(
416 "options.BrowserOptions.addBluetoothDevice", 422 "options.BrowserOptions.addBluetoothDevice",
417 js_properties); 423 js_properties);
418 } 424 }
419 425
420 void BluetoothOptionsHandler::RequestPinCode(device::BluetoothDevice* device) { 426 void BluetoothOptionsHandler::RequestPinCode(device::BluetoothDevice* device) {
421 DictionaryValue params; 427 DictionaryValue params;
422 params.SetString("pairing", kEnterPinCode); 428 params.SetString("pairing", kEnterPinCode);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 void BluetoothOptionsHandler::DeviceConnecting( 503 void BluetoothOptionsHandler::DeviceConnecting(
498 device::BluetoothDevice* device) { 504 device::BluetoothDevice* device) {
499 DCHECK(device); 505 DCHECK(device);
500 DictionaryValue params; 506 DictionaryValue params;
501 params.SetString("pairing", kStartConnecting); 507 params.SetString("pairing", kStartConnecting);
502 SendDeviceNotification(device, &params); 508 SendDeviceNotification(device, &params);
503 } 509 }
504 510
505 } // namespace options 511 } // namespace options
506 } // namespace chromeos 512 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698