| 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" |
| 11 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/prefs/pref_registry_simple.h" | 13 #include "base/prefs/pref_registry_simple.h" |
| 14 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/chromeos/login/wizard_controller.h" | 19 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 20 #include "chrome/browser/chromeos/system/statistics_provider.h" | |
| 21 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
| 22 #include "chromeos/network/network_state.h" | 21 #include "chromeos/network/network_state.h" |
| 23 #include "chromeos/network/network_state_handler.h" | 22 #include "chromeos/network/network_state_handler.h" |
| 23 #include "chromeos/system/statistics_provider.h" |
| 24 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 25 #include "net/url_request/url_fetcher.h" | 25 #include "net/url_request/url_fetcher.h" |
| 26 | 26 |
| 27 using content::BrowserThread; | 27 using content::BrowserThread; |
| 28 | 28 |
| 29 // Manifest attributes names. | 29 // Manifest attributes names. |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 const char kVersionAttr[] = "version"; | 33 const char kVersionAttr[] = "version"; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 void StartupCustomizationDocument::Init( | 167 void StartupCustomizationDocument::Init( |
| 168 chromeos::system::StatisticsProvider* statistics_provider) { | 168 chromeos::system::StatisticsProvider* statistics_provider) { |
| 169 if (IsReady()) { | 169 if (IsReady()) { |
| 170 root_->GetString(kInitialLocaleAttr, &initial_locale_); | 170 root_->GetString(kInitialLocaleAttr, &initial_locale_); |
| 171 root_->GetString(kInitialTimezoneAttr, &initial_timezone_); | 171 root_->GetString(kInitialTimezoneAttr, &initial_timezone_); |
| 172 root_->GetString(kKeyboardLayoutAttr, &keyboard_layout_); | 172 root_->GetString(kKeyboardLayoutAttr, &keyboard_layout_); |
| 173 root_->GetString(kRegistrationUrlAttr, ®istration_url_); | 173 root_->GetString(kRegistrationUrlAttr, ®istration_url_); |
| 174 | 174 |
| 175 std::string hwid; | 175 std::string hwid; |
| 176 if (statistics_provider->GetMachineStatistic( | 176 if (statistics_provider->GetMachineStatistic( |
| 177 chromeos::system::kHardwareClass, &hwid)) { | 177 chromeos::system::kHardwareClassKey, &hwid)) { |
| 178 ListValue* hwid_list = NULL; | 178 ListValue* hwid_list = NULL; |
| 179 if (root_->GetList(kHwidMapAttr, &hwid_list)) { | 179 if (root_->GetList(kHwidMapAttr, &hwid_list)) { |
| 180 for (size_t i = 0; i < hwid_list->GetSize(); ++i) { | 180 for (size_t i = 0; i < hwid_list->GetSize(); ++i) { |
| 181 DictionaryValue* hwid_dictionary = NULL; | 181 DictionaryValue* hwid_dictionary = NULL; |
| 182 std::string hwid_mask; | 182 std::string hwid_mask; |
| 183 if (hwid_list->GetDictionary(i, &hwid_dictionary) && | 183 if (hwid_list->GetDictionary(i, &hwid_dictionary) && |
| 184 hwid_dictionary->GetString(kHwidMaskAttr, &hwid_mask)) { | 184 hwid_dictionary->GetString(kHwidMaskAttr, &hwid_mask)) { |
| 185 if (MatchPattern(hwid, hwid_mask)) { | 185 if (MatchPattern(hwid, hwid_mask)) { |
| 186 // If HWID for this machine matches some mask, use HWID specific | 186 // If HWID for this machine matches some mask, use HWID specific |
| 187 // settings. | 187 // settings. |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 locale, kAppContentAttr, kInitialStartPageAttr); | 337 locale, kAppContentAttr, kInitialStartPageAttr); |
| 338 } | 338 } |
| 339 | 339 |
| 340 std::string ServicesCustomizationDocument::GetSupportPage( | 340 std::string ServicesCustomizationDocument::GetSupportPage( |
| 341 const std::string& locale) const { | 341 const std::string& locale) const { |
| 342 return GetLocaleSpecificString( | 342 return GetLocaleSpecificString( |
| 343 locale, kAppContentAttr, kSupportPageAttr); | 343 locale, kAppContentAttr, kSupportPageAttr); |
| 344 } | 344 } |
| 345 | 345 |
| 346 } // namespace chromeos | 346 } // namespace chromeos |
| OLD | NEW |