OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/login/screens/controller_pairing_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/controller_pairing_screen.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/chromeos/login/wizard_controller.h" | 10 #include "chrome/browser/chromeos/login/wizard_controller.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 if (!ExpectStageIs(ControllerPairingController::STAGE_DEVICES_DISCOVERY)) | 146 if (!ExpectStageIs(ControllerPairingController::STAGE_DEVICES_DISCOVERY)) |
147 return; | 147 return; |
148 ControllerPairingController::DeviceIdList devices = | 148 ControllerPairingController::DeviceIdList devices = |
149 shark_controller_->GetDiscoveredDevices(); | 149 shark_controller_->GetDiscoveredDevices(); |
150 std::sort(devices.begin(), devices.end()); | 150 std::sort(devices.begin(), devices.end()); |
151 context_.SetStringList(kContextKeyDevices, devices); | 151 context_.SetStringList(kContextKeyDevices, devices); |
152 context_.SetString( | 152 context_.SetString( |
153 kContextKeyPage, | 153 kContextKeyPage, |
154 devices.empty() ? kPageDevicesDiscovery : kPageDeviceSelect); | 154 devices.empty() ? kPageDevicesDiscovery : kPageDeviceSelect); |
155 std::string selected_device = context_.GetString(kContextKeySelectedDevice); | 155 std::string selected_device = context_.GetString(kContextKeySelectedDevice); |
156 if (!ContainsValue(devices, selected_device)) | 156 if (!base::ContainsValue(devices, selected_device)) |
157 selected_device.clear(); | 157 selected_device.clear(); |
158 if (devices.empty()) { | 158 if (devices.empty()) { |
159 device_preselected_ = false; | 159 device_preselected_ = false; |
160 } else if (!device_preselected_) { | 160 } else if (!device_preselected_) { |
161 selected_device = devices.front(); | 161 selected_device = devices.front(); |
162 device_preselected_ = true; | 162 device_preselected_ = true; |
163 } | 163 } |
164 context_.SetString(kContextKeySelectedDevice, selected_device); | 164 context_.SetString(kContextKeySelectedDevice, selected_device); |
165 context_.SetBoolean(kContextKeyControlsDisabled, selected_device.empty()); | 165 context_.SetBoolean(kContextKeyControlsDisabled, selected_device.empty()); |
166 CommitContextChanges(); | 166 CommitContextChanges(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 ++key) { | 215 ++key) { |
216 if (*key == kContextKeySelectedDevice) { | 216 if (*key == kContextKeySelectedDevice) { |
217 context_.SetBoolean(kContextKeyControlsDisabled, | 217 context_.SetBoolean(kContextKeyControlsDisabled, |
218 context_.GetString(*key).empty()); | 218 context_.GetString(*key).empty()); |
219 CommitContextChanges(); | 219 CommitContextChanges(); |
220 } | 220 } |
221 } | 221 } |
222 } | 222 } |
223 | 223 |
224 } // namespace chromeos | 224 } // namespace chromeos |
OLD | NEW |