| 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/extensions/info_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/info_private_api.h" |
| 6 | 6 |
| 7 #include "base/sys_info.h" | 7 #include "base/sys_info.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/chromeos/login/startup_utils.h" | 9 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 10 #include "chrome/browser/chromeos/login/user_manager.h" | 10 #include "chrome/browser/chromeos/login/user_manager.h" |
| 11 #include "chrome/browser/chromeos/system/statistics_provider.h" | |
| 12 #include "chromeos/network/device_state.h" | 11 #include "chromeos/network/device_state.h" |
| 13 #include "chromeos/network/network_handler.h" | 12 #include "chromeos/network/network_handler.h" |
| 14 #include "chromeos/network/network_state_handler.h" | 13 #include "chromeos/network/network_state_handler.h" |
| 15 #include "chromeos/network/shill_property_util.h" | 14 #include "chromeos/network/shill_property_util.h" |
| 15 #include "chromeos/system/statistics_provider.h" |
| 16 #include "third_party/cros_system_api/dbus/service_constants.h" | 16 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 17 | 17 |
| 18 using chromeos::NetworkHandler; | 18 using chromeos::NetworkHandler; |
| 19 | 19 |
| 20 namespace extensions { | 20 namespace extensions { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 // Key which corresponds to the HWID setting. | 24 // Key which corresponds to the HWID setting. |
| 25 const char kPropertyHWID[] = "hwid"; | 25 const char kPropertyHWID[] = "hwid"; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 SendResponse(true); | 59 SendResponse(true); |
| 60 return true; | 60 return true; |
| 61 } | 61 } |
| 62 | 62 |
| 63 base::Value* ChromeosInfoPrivateGetFunction::GetValue( | 63 base::Value* ChromeosInfoPrivateGetFunction::GetValue( |
| 64 const std::string& property_name) { | 64 const std::string& property_name) { |
| 65 if (property_name == kPropertyHWID) { | 65 if (property_name == kPropertyHWID) { |
| 66 std::string hwid; | 66 std::string hwid; |
| 67 chromeos::system::StatisticsProvider* provider = | 67 chromeos::system::StatisticsProvider* provider = |
| 68 chromeos::system::StatisticsProvider::GetInstance(); | 68 chromeos::system::StatisticsProvider::GetInstance(); |
| 69 provider->GetMachineStatistic(chromeos::system::kHardwareClass, &hwid); | 69 provider->GetMachineStatistic(chromeos::system::kHardwareClassKey, &hwid); |
| 70 return new base::StringValue(hwid); | 70 return new base::StringValue(hwid); |
| 71 } else if (property_name == kPropertyHomeProvider) { | 71 } else if (property_name == kPropertyHomeProvider) { |
| 72 const chromeos::DeviceState* cellular_device = | 72 const chromeos::DeviceState* cellular_device = |
| 73 NetworkHandler::Get()->network_state_handler()->GetDeviceStateByType( | 73 NetworkHandler::Get()->network_state_handler()->GetDeviceStateByType( |
| 74 chromeos::NetworkTypePattern::Cellular()); | 74 chromeos::NetworkTypePattern::Cellular()); |
| 75 std::string home_provider_id; | 75 std::string home_provider_id; |
| 76 if (cellular_device) | 76 if (cellular_device) |
| 77 home_provider_id = cellular_device->home_provider_id(); | 77 home_provider_id = cellular_device->home_provider_id(); |
| 78 return new base::StringValue(home_provider_id); | 78 return new base::StringValue(home_provider_id); |
| 79 } else if (property_name == kPropertyInitialLocale) { | 79 } else if (property_name == kPropertyInitialLocale) { |
| 80 return new base::StringValue( | 80 return new base::StringValue( |
| 81 chromeos::StartupUtils::GetInitialLocale()); | 81 chromeos::StartupUtils::GetInitialLocale()); |
| 82 } else if (property_name == kPropertyBoard) { | 82 } else if (property_name == kPropertyBoard) { |
| 83 return new base::StringValue(base::SysInfo::GetLsbReleaseBoard()); | 83 return new base::StringValue(base::SysInfo::GetLsbReleaseBoard()); |
| 84 } else if (property_name == kPropertyOwner) { | 84 } else if (property_name == kPropertyOwner) { |
| 85 return Value::CreateBooleanValue( | 85 return Value::CreateBooleanValue( |
| 86 chromeos::UserManager::Get()->IsCurrentUserOwner()); | 86 chromeos::UserManager::Get()->IsCurrentUserOwner()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 DLOG(ERROR) << "Unknown property request: " << property_name; | 89 DLOG(ERROR) << "Unknown property request: " << property_name; |
| 90 return NULL; | 90 return NULL; |
| 91 } | 91 } |
| 92 | 92 |
| 93 } // namespace extensions | 93 } // namespace extensions |
| OLD | NEW |