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