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/chromeos/policy/device_status_collector.h" | 5 #include "chrome/browser/chromeos/policy/device_status_collector.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 }; | 396 }; |
397 | 397 |
398 chromeos::NetworkStateHandler::DeviceStateList device_list; | 398 chromeos::NetworkStateHandler::DeviceStateList device_list; |
399 chromeos::NetworkHandler::Get()->network_state_handler()->GetDeviceList( | 399 chromeos::NetworkHandler::Get()->network_state_handler()->GetDeviceList( |
400 &device_list); | 400 &device_list); |
401 | 401 |
402 chromeos::NetworkStateHandler::DeviceStateList::const_iterator device; | 402 chromeos::NetworkStateHandler::DeviceStateList::const_iterator device; |
403 for (device = device_list.begin(); device != device_list.end(); ++device) { | 403 for (device = device_list.begin(); device != device_list.end(); ++device) { |
404 // Determine the type enum constant for |device|. | 404 // Determine the type enum constant for |device|. |
405 size_t type_idx = 0; | 405 size_t type_idx = 0; |
406 for (; type_idx < ARRAYSIZE_UNSAFE(kDeviceTypeMap); ++type_idx) { | 406 for (; type_idx < arraysize(kDeviceTypeMap); ++type_idx) { |
407 if ((*device)->type() == kDeviceTypeMap[type_idx].type_string) | 407 if ((*device)->type() == kDeviceTypeMap[type_idx].type_string) |
408 break; | 408 break; |
409 } | 409 } |
410 | 410 |
411 // If the type isn't in |kDeviceTypeMap|, the interface is not relevant for | 411 // If the type isn't in |kDeviceTypeMap|, the interface is not relevant for |
412 // reporting. This filters out VPN devices. | 412 // reporting. This filters out VPN devices. |
413 if (type_idx >= ARRAYSIZE_UNSAFE(kDeviceTypeMap)) | 413 if (type_idx >= arraysize(kDeviceTypeMap)) |
414 continue; | 414 continue; |
415 | 415 |
416 em::NetworkInterface* interface = request->add_network_interface(); | 416 em::NetworkInterface* interface = request->add_network_interface(); |
417 interface->set_type(kDeviceTypeMap[type_idx].type_constant); | 417 interface->set_type(kDeviceTypeMap[type_idx].type_constant); |
418 if (!(*device)->mac_address().empty()) | 418 if (!(*device)->mac_address().empty()) |
419 interface->set_mac_address((*device)->mac_address()); | 419 interface->set_mac_address((*device)->mac_address()); |
420 if (!(*device)->meid().empty()) | 420 if (!(*device)->meid().empty()) |
421 interface->set_meid((*device)->meid()); | 421 interface->set_meid((*device)->meid()); |
422 if (!(*device)->imei().empty()) | 422 if (!(*device)->imei().empty()) |
423 interface->set_imei((*device)->imei()); | 423 interface->set_imei((*device)->imei()); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 location.SetDouble(kSpeed, position.speed); | 549 location.SetDouble(kSpeed, position.speed); |
550 location.SetString(kTimestamp, | 550 location.SetString(kTimestamp, |
551 base::Int64ToString(position.timestamp.ToInternalValue())); | 551 base::Int64ToString(position.timestamp.ToInternalValue())); |
552 local_state_->Set(prefs::kDeviceLocation, location); | 552 local_state_->Set(prefs::kDeviceLocation, location); |
553 } | 553 } |
554 | 554 |
555 ScheduleGeolocationUpdateRequest(); | 555 ScheduleGeolocationUpdateRequest(); |
556 } | 556 } |
557 | 557 |
558 } // namespace policy | 558 } // namespace policy |
OLD | NEW |