| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/chromeos/emulator/device_emulator_message_hand
ler.h" | 5 #include "chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_hand
ler.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 std::string selected_id = props.external_power_source_id(); | 419 std::string selected_id = props.external_power_source_id(); |
| 420 | 420 |
| 421 props.clear_available_external_power_source(); | 421 props.clear_available_external_power_source(); |
| 422 props.set_external_power_source_id(""); | 422 props.set_external_power_source_id(""); |
| 423 | 423 |
| 424 // Try to find the previously selected source in the list. | 424 // Try to find the previously selected source in the list. |
| 425 const power_manager::PowerSupplyProperties_PowerSource* selected_source = | 425 const power_manager::PowerSupplyProperties_PowerSource* selected_source = |
| 426 nullptr; | 426 nullptr; |
| 427 for (const auto& val : *sources) { | 427 for (const auto& val : *sources) { |
| 428 const base::DictionaryValue* dict; | 428 const base::DictionaryValue* dict; |
| 429 CHECK(val->GetAsDictionary(&dict)); | 429 CHECK(val.GetAsDictionary(&dict)); |
| 430 power_manager::PowerSupplyProperties_PowerSource* source = | 430 power_manager::PowerSupplyProperties_PowerSource* source = |
| 431 props.add_available_external_power_source(); | 431 props.add_available_external_power_source(); |
| 432 std::string id; | 432 std::string id; |
| 433 CHECK(dict->GetString("id", &id)); | 433 CHECK(dict->GetString("id", &id)); |
| 434 source->set_id(id); | 434 source->set_id(id); |
| 435 std::string device_type; | 435 std::string device_type; |
| 436 CHECK(dict->GetString("type", &device_type)); | 436 CHECK(dict->GetString("type", &device_type)); |
| 437 bool dual_role = device_type == "DualRoleUSB"; | 437 bool dual_role = device_type == "DualRoleUSB"; |
| 438 source->set_active_by_default(!dual_role); | 438 source->set_active_by_default(!dual_role); |
| 439 if (dual_role) | 439 if (dual_role) |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 } | 633 } |
| 634 | 634 |
| 635 void DeviceEmulatorMessageHandler::MouseExists(bool exists) { | 635 void DeviceEmulatorMessageHandler::MouseExists(bool exists) { |
| 636 if (!IsJavascriptAllowed()) | 636 if (!IsJavascriptAllowed()) |
| 637 return; | 637 return; |
| 638 web_ui()->CallJavascriptFunctionUnsafe(kMouseExistsCallback, | 638 web_ui()->CallJavascriptFunctionUnsafe(kMouseExistsCallback, |
| 639 base::Value(exists)); | 639 base::Value(exists)); |
| 640 } | 640 } |
| 641 | 641 |
| 642 } // namespace chromeos | 642 } // namespace chromeos |
| OLD | NEW |