| 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/customization_document.h" | 5 #include "chrome/browser/chromeos/customization_document.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 const char kHwidMaskAttr[] = "hwid_mask"; | 40 const char kHwidMaskAttr[] = "hwid_mask"; |
| 41 const char kSetupContentAttr[] = "setup_content"; | 41 const char kSetupContentAttr[] = "setup_content"; |
| 42 const char kHelpPageAttr[] = "help_page"; | 42 const char kHelpPageAttr[] = "help_page"; |
| 43 const char kEulaPageAttr[] = "eula_page"; | 43 const char kEulaPageAttr[] = "eula_page"; |
| 44 const char kAppContentAttr[] = "app_content"; | 44 const char kAppContentAttr[] = "app_content"; |
| 45 const char kInitialStartPageAttr[] = "initial_start_page"; | 45 const char kInitialStartPageAttr[] = "initial_start_page"; |
| 46 const char kSupportPageAttr[] = "support_page"; | 46 const char kSupportPageAttr[] = "support_page"; |
| 47 | 47 |
| 48 const char kAcceptedManifestVersion[] = "1.0"; | 48 const char kAcceptedManifestVersion[] = "1.0"; |
| 49 | 49 |
| 50 const char kHardwareClass[] = "hardware_class"; | |
| 51 | |
| 52 // Path to OEM partner startup customization manifest. | 50 // Path to OEM partner startup customization manifest. |
| 53 const char kStartupCustomizationManifestPath[] = | 51 const char kStartupCustomizationManifestPath[] = |
| 54 "/opt/oem/etc/startup_manifest.json"; | 52 "/opt/oem/etc/startup_manifest.json"; |
| 55 | 53 |
| 56 // URL where to fetch OEM services customization manifest from. | 54 // URL where to fetch OEM services customization manifest from. |
| 57 const char kServicesCustomizationManifestUrl[] = | 55 const char kServicesCustomizationManifestUrl[] = |
| 58 "file:///opt/oem/etc/services_manifest.json"; | 56 "file:///opt/oem/etc/services_manifest.json"; |
| 59 | 57 |
| 60 // Name of local state option that tracks if services customization has been | 58 // Name of local state option that tracks if services customization has been |
| 61 // applied. | 59 // applied. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 166 |
| 169 void StartupCustomizationDocument::Init( | 167 void StartupCustomizationDocument::Init( |
| 170 chromeos::system::StatisticsProvider* statistics_provider) { | 168 chromeos::system::StatisticsProvider* statistics_provider) { |
| 171 if (IsReady()) { | 169 if (IsReady()) { |
| 172 root_->GetString(kInitialLocaleAttr, &initial_locale_); | 170 root_->GetString(kInitialLocaleAttr, &initial_locale_); |
| 173 root_->GetString(kInitialTimezoneAttr, &initial_timezone_); | 171 root_->GetString(kInitialTimezoneAttr, &initial_timezone_); |
| 174 root_->GetString(kKeyboardLayoutAttr, &keyboard_layout_); | 172 root_->GetString(kKeyboardLayoutAttr, &keyboard_layout_); |
| 175 root_->GetString(kRegistrationUrlAttr, ®istration_url_); | 173 root_->GetString(kRegistrationUrlAttr, ®istration_url_); |
| 176 | 174 |
| 177 std::string hwid; | 175 std::string hwid; |
| 178 if (statistics_provider->GetMachineStatistic(kHardwareClass, &hwid)) { | 176 if (statistics_provider->GetMachineStatistic( |
| 177 chromeos::system::kHardwareClass, &hwid)) { |
| 179 ListValue* hwid_list = NULL; | 178 ListValue* hwid_list = NULL; |
| 180 if (root_->GetList(kHwidMapAttr, &hwid_list)) { | 179 if (root_->GetList(kHwidMapAttr, &hwid_list)) { |
| 181 for (size_t i = 0; i < hwid_list->GetSize(); ++i) { | 180 for (size_t i = 0; i < hwid_list->GetSize(); ++i) { |
| 182 DictionaryValue* hwid_dictionary = NULL; | 181 DictionaryValue* hwid_dictionary = NULL; |
| 183 std::string hwid_mask; | 182 std::string hwid_mask; |
| 184 if (hwid_list->GetDictionary(i, &hwid_dictionary) && | 183 if (hwid_list->GetDictionary(i, &hwid_dictionary) && |
| 185 hwid_dictionary->GetString(kHwidMaskAttr, &hwid_mask)) { | 184 hwid_dictionary->GetString(kHwidMaskAttr, &hwid_mask)) { |
| 186 if (MatchPattern(hwid, hwid_mask)) { | 185 if (MatchPattern(hwid, hwid_mask)) { |
| 187 // If HWID for this machine matches some mask, use HWID specific | 186 // If HWID for this machine matches some mask, use HWID specific |
| 188 // settings. | 187 // settings. |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 locale, kAppContentAttr, kInitialStartPageAttr); | 337 locale, kAppContentAttr, kInitialStartPageAttr); |
| 339 } | 338 } |
| 340 | 339 |
| 341 std::string ServicesCustomizationDocument::GetSupportPage( | 340 std::string ServicesCustomizationDocument::GetSupportPage( |
| 342 const std::string& locale) const { | 341 const std::string& locale) const { |
| 343 return GetLocaleSpecificString( | 342 return GetLocaleSpecificString( |
| 344 locale, kAppContentAttr, kSupportPageAttr); | 343 locale, kAppContentAttr, kSupportPageAttr); |
| 345 } | 344 } |
| 346 | 345 |
| 347 } // namespace chromeos | 346 } // namespace chromeos |
| OLD | NEW |