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_split.h" | |
15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
17 #include "base/time/time.h" | 18 #include "base/time/time.h" |
18 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
19 #include "chrome/browser/chromeos/login/wizard_controller.h" | 20 #include "chrome/browser/chromeos/login/wizard_controller.h" |
20 #include "chromeos/network/network_state.h" | 21 #include "chromeos/network/network_state.h" |
21 #include "chromeos/network/network_state_handler.h" | 22 #include "chromeos/network/network_state_handler.h" |
22 #include "chromeos/system/statistics_provider.h" | 23 #include "chromeos/system/statistics_provider.h" |
23 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
24 #include "net/url_request/url_fetcher.h" | 25 #include "net/url_request/url_fetcher.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 } | 206 } |
206 } | 207 } |
207 | 208 |
208 // If manifest doesn't exist still apply values from VPD. | 209 // If manifest doesn't exist still apply values from VPD. |
209 statistics_provider->GetMachineStatistic(kInitialLocaleAttr, | 210 statistics_provider->GetMachineStatistic(kInitialLocaleAttr, |
210 &initial_locale_); | 211 &initial_locale_); |
211 statistics_provider->GetMachineStatistic(kInitialTimezoneAttr, | 212 statistics_provider->GetMachineStatistic(kInitialTimezoneAttr, |
212 &initial_timezone_); | 213 &initial_timezone_); |
213 statistics_provider->GetMachineStatistic(kKeyboardLayoutAttr, | 214 statistics_provider->GetMachineStatistic(kKeyboardLayoutAttr, |
214 &keyboard_layout_); | 215 &keyboard_layout_); |
216 configured_locales_.resize(0); | |
217 base::SplitString(initial_locale_, ',', &configured_locales_); | |
218 // Let's always have configured_locales_.front() a valid entry. | |
219 if (configured_locales_.size() == 0) | |
220 configured_locales_.push_back(std::string()); | |
Nikita (slow)
2014/01/30 13:23:28
I think this breaks assumptions.
If initial_locale
Alexander Alekseev
2014/01/31 12:46:54
In offline discussion we've decided to leave this
| |
221 } | |
222 | |
223 const std::vector<std::string>& | |
224 StartupCustomizationDocument::configured_locales() const { | |
225 return configured_locales_; | |
226 } | |
227 | |
228 const std::string& StartupCustomizationDocument::initial_locale_default() | |
229 const { | |
230 DCHECK(configured_locales_.size() > 0); | |
231 return configured_locales_.front(); | |
215 } | 232 } |
216 | 233 |
217 std::string StartupCustomizationDocument::GetHelpPage( | 234 std::string StartupCustomizationDocument::GetHelpPage( |
218 const std::string& locale) const { | 235 const std::string& locale) const { |
219 return GetLocaleSpecificString(locale, kSetupContentAttr, kHelpPageAttr); | 236 return GetLocaleSpecificString(locale, kSetupContentAttr, kHelpPageAttr); |
220 } | 237 } |
221 | 238 |
222 std::string StartupCustomizationDocument::GetEULAPage( | 239 std::string StartupCustomizationDocument::GetEULAPage( |
223 const std::string& locale) const { | 240 const std::string& locale) const { |
224 return GetLocaleSpecificString(locale, kSetupContentAttr, kEulaPageAttr); | 241 return GetLocaleSpecificString(locale, kSetupContentAttr, kEulaPageAttr); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 locale, kAppContentAttr, kInitialStartPageAttr); | 352 locale, kAppContentAttr, kInitialStartPageAttr); |
336 } | 353 } |
337 | 354 |
338 std::string ServicesCustomizationDocument::GetSupportPage( | 355 std::string ServicesCustomizationDocument::GetSupportPage( |
339 const std::string& locale) const { | 356 const std::string& locale) const { |
340 return GetLocaleSpecificString( | 357 return GetLocaleSpecificString( |
341 locale, kAppContentAttr, kSupportPageAttr); | 358 locale, kAppContentAttr, kSupportPageAttr); |
342 } | 359 } |
343 | 360 |
344 } // namespace chromeos | 361 } // namespace chromeos |
OLD | NEW |