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

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

Issue 9700069: bluetooth: remove switch from options handler too (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oops, forgot second git add Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 16 matching lines...) Expand all
27 const int kUpdateDevicePasskeyIndex = 2; 27 const int kUpdateDevicePasskeyIndex = 2;
28 28
29 } // namespace 29 } // namespace
30 30
31 namespace chromeos { 31 namespace chromeos {
32 32
33 BluetoothOptionsHandler::BluetoothOptionsHandler() { 33 BluetoothOptionsHandler::BluetoothOptionsHandler() {
34 } 34 }
35 35
36 BluetoothOptionsHandler::~BluetoothOptionsHandler() { 36 BluetoothOptionsHandler::~BluetoothOptionsHandler() {
37 adapter_->RemoveObserver(this); 37 if (adapter_.get())
38 adapter_->RemoveObserver(this);
38 } 39 }
39 40
40 void BluetoothOptionsHandler::GetLocalizedValues( 41 void BluetoothOptionsHandler::GetLocalizedValues(
41 DictionaryValue* localized_strings) { 42 DictionaryValue* localized_strings) {
42 DCHECK(localized_strings); 43 DCHECK(localized_strings);
43 44
44 localized_strings->SetString("bluetooth", 45 localized_strings->SetString("bluetooth",
45 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_SECTION_TITLE_BLUETOOTH)); 46 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_SECTION_TITLE_BLUETOOTH));
46 localized_strings->SetString("disableBluetooth", 47 localized_strings->SetString("disableBluetooth",
47 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_BLUETOOTH_DISABLE)); 48 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_BLUETOOTH_DISABLE));
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECTION_FAILED_INCORRECT_PIN)); 106 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECTION_FAILED_INCORRECT_PIN));
106 localized_strings->SetString("bluetoothErrorTimeout", 107 localized_strings->SetString("bluetoothErrorTimeout",
107 l10n_util::GetStringUTF16( 108 l10n_util::GetStringUTF16(
108 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECTION_FAILED_TIMEOUT)); 109 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECTION_FAILED_TIMEOUT));
109 localized_strings->SetString("bluetoothErrorConnectionFailed", 110 localized_strings->SetString("bluetoothErrorConnectionFailed",
110 l10n_util::GetStringUTF16( 111 l10n_util::GetStringUTF16(
111 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECTION_FAILED)); 112 IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECTION_FAILED));
112 } 113 }
113 114
114 void BluetoothOptionsHandler::InitializeHandler() { 115 void BluetoothOptionsHandler::InitializeHandler() {
115 // Bluetooth support is a work in progress. Supress the feature unless
116 // explicitly enabled via a command line flag.
117 if (!CommandLine::ForCurrentProcess()
118 ->HasSwitch(switches::kEnableBluetooth)) {
119 return;
120 }
121
122 adapter_.reset(BluetoothAdapter::CreateDefaultAdapter()); 116 adapter_.reset(BluetoothAdapter::CreateDefaultAdapter());
123 adapter_->AddObserver(this); 117 adapter_->AddObserver(this);
124 118
125 // Show or hide the bluetooth settings and update the checkbox based 119 // Show or hide the bluetooth settings and update the checkbox based
126 // on the current present/powered state. 120 // on the current present/powered state.
127 AdapterPresentChanged(adapter_.get(), adapter_->IsPresent()); 121 AdapterPresentChanged(adapter_.get(), adapter_->IsPresent());
128 } 122 }
129 123
130 void BluetoothOptionsHandler::AdapterPresentChanged(BluetoothAdapter* adapter, 124 void BluetoothOptionsHandler::AdapterPresentChanged(BluetoothAdapter* adapter,
131 bool present) { 125 bool present) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 292
299 void BluetoothOptionsHandler::ErrorCallback() { 293 void BluetoothOptionsHandler::ErrorCallback() {
300 // TODO(keybuk): we don't get any form of error response from dbus:: 294 // TODO(keybuk): we don't get any form of error response from dbus::
301 // yet, other than an error occurred. I'm going to fix that, then this 295 // yet, other than an error occurred. I'm going to fix that, then this
302 // gets replaced by genuine error information from the method which we 296 // gets replaced by genuine error information from the method which we
303 // can act on, rather than a debug log statement. 297 // can act on, rather than a debug log statement.
304 DVLOG(1) << "Failed."; 298 DVLOG(1) << "Failed.";
305 } 299 }
306 300
307 } // namespace chromeos 301 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698