| 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 <algorithm> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 9 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 11 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
| 12 #include "base/logging.h" | 14 #include "base/logging.h" |
| 13 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 14 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 15 #include "base/prefs/pref_registry_simple.h" | 17 #include "base/prefs/pref_registry_simple.h" |
| 16 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 30 #include "chrome/common/extensions/extension_constants.h" | 32 #include "chrome/common/extensions/extension_constants.h" |
| 31 #include "chromeos/network/network_state.h" | 33 #include "chromeos/network/network_state.h" |
| 32 #include "chromeos/network/network_state_handler.h" | 34 #include "chromeos/network/network_state_handler.h" |
| 33 #include "chromeos/system/statistics_provider.h" | 35 #include "chromeos/system/statistics_provider.h" |
| 34 #include "components/user_prefs/pref_registry_syncable.h" | 36 #include "components/user_prefs/pref_registry_syncable.h" |
| 35 #include "content/public/browser/browser_thread.h" | 37 #include "content/public/browser/browser_thread.h" |
| 36 #include "net/base/load_flags.h" | 38 #include "net/base/load_flags.h" |
| 37 #include "net/http/http_response_headers.h" | 39 #include "net/http/http_response_headers.h" |
| 38 #include "net/http/http_status_code.h" | 40 #include "net/http/http_status_code.h" |
| 39 #include "net/url_request/url_fetcher.h" | 41 #include "net/url_request/url_fetcher.h" |
| 42 #include "ui/base/l10n/l10n_util.h" |
| 40 | 43 |
| 41 using content::BrowserThread; | 44 using content::BrowserThread; |
| 42 | 45 |
| 43 namespace chromeos { | 46 namespace chromeos { |
| 44 namespace { | 47 namespace { |
| 45 | 48 |
| 46 // Manifest attributes names. | 49 // Manifest attributes names. |
| 47 const char kVersionAttr[] = "version"; | 50 const char kVersionAttr[] = "version"; |
| 48 const char kDefaultAttr[] = "default"; | 51 const char kDefaultAttr[] = "default"; |
| 49 const char kInitialLocaleAttr[] = "initial_locale"; | 52 const char kInitialLocaleAttr[] = "initial_locale"; |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 300 |
| 298 // If manifest doesn't exist still apply values from VPD. | 301 // If manifest doesn't exist still apply values from VPD. |
| 299 statistics_provider->GetMachineStatistic(kInitialLocaleAttr, | 302 statistics_provider->GetMachineStatistic(kInitialLocaleAttr, |
| 300 &initial_locale_); | 303 &initial_locale_); |
| 301 statistics_provider->GetMachineStatistic(kInitialTimezoneAttr, | 304 statistics_provider->GetMachineStatistic(kInitialTimezoneAttr, |
| 302 &initial_timezone_); | 305 &initial_timezone_); |
| 303 statistics_provider->GetMachineStatistic(kKeyboardLayoutAttr, | 306 statistics_provider->GetMachineStatistic(kKeyboardLayoutAttr, |
| 304 &keyboard_layout_); | 307 &keyboard_layout_); |
| 305 configured_locales_.resize(0); | 308 configured_locales_.resize(0); |
| 306 base::SplitString(initial_locale_, ',', &configured_locales_); | 309 base::SplitString(initial_locale_, ',', &configured_locales_); |
| 310 |
| 311 std::for_each(configured_locales_.begin(), |
| 312 configured_locales_.end(), |
| 313 l10n_util::GetCanonicalLocale); |
| 314 |
| 307 // Let's always have configured_locales_.front() a valid entry. | 315 // Let's always have configured_locales_.front() a valid entry. |
| 308 if (configured_locales_.size() == 0) | 316 if (configured_locales_.size() == 0) |
| 309 configured_locales_.push_back(std::string()); | 317 configured_locales_.push_back(std::string()); |
| 310 } | 318 } |
| 311 | 319 |
| 312 const std::vector<std::string>& | 320 const std::vector<std::string>& |
| 313 StartupCustomizationDocument::configured_locales() const { | 321 StartupCustomizationDocument::configured_locales() const { |
| 314 return configured_locales_; | 322 return configured_locales_; |
| 315 } | 323 } |
| 316 | 324 |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 g_test_services_customization_document->network_delay_ = base::TimeDelta(); | 665 g_test_services_customization_document->network_delay_ = base::TimeDelta(); |
| 658 } | 666 } |
| 659 | 667 |
| 660 // static | 668 // static |
| 661 void ServicesCustomizationDocument::ShutdownForTesting() { | 669 void ServicesCustomizationDocument::ShutdownForTesting() { |
| 662 delete g_test_services_customization_document; | 670 delete g_test_services_customization_document; |
| 663 g_test_services_customization_document = NULL; | 671 g_test_services_customization_document = NULL; |
| 664 } | 672 } |
| 665 | 673 |
| 666 } // namespace chromeos | 674 } // namespace chromeos |
| OLD | NEW |