Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: chrome/browser/chromeos/customization_document.cc

Issue 224093013: Allow country-specific languages in UI list at OOBE. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Support en-AU locale. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 // Convert ICU locale to chrome ("en_US" to "en-US", etc.).
312 std::for_each(configured_locales_.begin(),
313 configured_locales_.end(),
314 l10n_util::GetCanonicalLocale);
315
307 // Let's always have configured_locales_.front() a valid entry. 316 // Let's always have configured_locales_.front() a valid entry.
308 if (configured_locales_.size() == 0) 317 if (configured_locales_.size() == 0)
309 configured_locales_.push_back(std::string()); 318 configured_locales_.push_back(std::string());
310 } 319 }
311 320
312 const std::vector<std::string>& 321 const std::vector<std::string>&
313 StartupCustomizationDocument::configured_locales() const { 322 StartupCustomizationDocument::configured_locales() const {
314 return configured_locales_; 323 return configured_locales_;
315 } 324 }
316 325
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 g_test_services_customization_document->network_delay_ = base::TimeDelta(); 666 g_test_services_customization_document->network_delay_ = base::TimeDelta();
658 } 667 }
659 668
660 // static 669 // static
661 void ServicesCustomizationDocument::ShutdownForTesting() { 670 void ServicesCustomizationDocument::ShutdownForTesting() {
662 delete g_test_services_customization_document; 671 delete g_test_services_customization_document;
663 g_test_services_customization_document = NULL; 672 g_test_services_customization_document = NULL;
664 } 673 }
665 674
666 } // namespace chromeos 675 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698