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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 l10n_util::GetStringUTF16( | 116 l10n_util::GetStringUTF16( |
117 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECTION_FAILED_INCORRECT_PIN)); | 117 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECTION_FAILED_INCORRECT_PIN)); |
118 localized_strings->SetString("bluetoothErrorTimeout", | 118 localized_strings->SetString("bluetoothErrorTimeout", |
119 l10n_util::GetStringUTF16( | 119 l10n_util::GetStringUTF16( |
120 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECTION_FAILED_TIMEOUT)); | 120 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECTION_FAILED_TIMEOUT)); |
121 localized_strings->SetString("bluetoothErrorConnectionFailed", | 121 localized_strings->SetString("bluetoothErrorConnectionFailed", |
122 l10n_util::GetStringUTF16( | 122 l10n_util::GetStringUTF16( |
123 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECTION_FAILED)); | 123 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECTION_FAILED)); |
124 } | 124 } |
125 | 125 |
126 void BluetoothOptionsHandler::Initialize() { | 126 void BluetoothOptionsHandler::InitializeHandler() { |
127 // Bluetooth support is a work in progress. Supress the feature unless | 127 // Bluetooth support is a work in progress. Supress the feature unless |
128 // explicitly enabled via a command line flag. | 128 // explicitly enabled via a command line flag. |
129 if (!CommandLine::ForCurrentProcess() | 129 if (!CommandLine::ForCurrentProcess() |
130 ->HasSwitch(switches::kEnableBluetooth)) { | 130 ->HasSwitch(switches::kEnableBluetooth)) { |
131 return; | 131 return; |
132 } | 132 } |
133 | 133 |
134 adapter_.reset(BluetoothAdapter::CreateDefaultAdapter()); | 134 adapter_.reset(BluetoothAdapter::CreateDefaultAdapter()); |
135 adapter_->AddObserver(this); | 135 adapter_->AddObserver(this); |
136 | 136 |
137 // Show or hide the bluetooth settings and update the checkbox based | 137 // Show or hide the bluetooth settings and update the checkbox based |
138 // on the current present/powered state. | 138 // on the current present/powered state. |
139 AdapterPresentChanged(adapter_.get(), adapter_->IsPresent()); | 139 AdapterPresentChanged(adapter_.get(), adapter_->IsPresent()); |
csilv
2012/03/14 00:09:11
seems like this should be moved to InitializePage(
Dan Beam
2012/03/14 01:13:14
Done.
| |
140 } | 140 } |
141 | 141 |
142 void BluetoothOptionsHandler::AdapterPresentChanged(BluetoothAdapter* adapter, | 142 void BluetoothOptionsHandler::AdapterPresentChanged(BluetoothAdapter* adapter, |
143 bool present) { | 143 bool present) { |
144 DCHECK(adapter == adapter_.get()); | 144 DCHECK(adapter == adapter_.get()); |
145 if (present) { | 145 if (present) { |
146 web_ui()->CallJavascriptFunction( | 146 web_ui()->CallJavascriptFunction( |
147 "options.BrowserOptions.showBluetoothSettings"); | 147 "options.BrowserOptions.showBluetoothSettings"); |
148 | 148 |
149 // Update the checkbox and visibility based on the powered state of the | 149 // Update the checkbox and visibility based on the powered state of the |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
346 void BluetoothOptionsHandler::ErrorCallback() { | 346 void BluetoothOptionsHandler::ErrorCallback() { |
347 // TODO(keybuk): we don't get any form of error response from dbus:: | 347 // TODO(keybuk): we don't get any form of error response from dbus:: |
348 // yet, other than an error occurred. I'm going to fix that, then this | 348 // yet, other than an error occurred. I'm going to fix that, then this |
349 // gets replaced by genuine error information from the method which we | 349 // gets replaced by genuine error information from the method which we |
350 // can act on, rather than a debug log statement. | 350 // can act on, rather than a debug log statement. |
351 DVLOG(1) << "Failed."; | 351 DVLOG(1) << "Failed."; |
352 } | 352 } |
353 | 353 |
354 } // namespace options2 | 354 } // namespace options2 |
355 } // namespace chromeos | 355 } // namespace chromeos |
OLD | NEW |