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/customization_document.h" | 5 #include "chrome/browser/chromeos/customization/customization_document.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/i18n/rtl.h" |
13 #include "base/json/json_reader.h" | 14 #include "base/json/json_reader.h" |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
16 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
17 #include "base/path_service.h" | 18 #include "base/path_service.h" |
18 #include "base/prefs/pref_registry_simple.h" | 19 #include "base/prefs/pref_registry_simple.h" |
19 #include "base/prefs/pref_service.h" | 20 #include "base/prefs/pref_service.h" |
20 #include "base/strings/string_split.h" | 21 #include "base/strings/string_split.h" |
21 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
22 #include "base/strings/stringprintf.h" | 23 #include "base/strings/stringprintf.h" |
(...skipping 12 matching lines...) Expand all Loading... |
35 #include "chrome/common/chrome_paths.h" | 36 #include "chrome/common/chrome_paths.h" |
36 #include "chrome/common/pref_names.h" | 37 #include "chrome/common/pref_names.h" |
37 #include "chromeos/system/statistics_provider.h" | 38 #include "chromeos/system/statistics_provider.h" |
38 #include "components/pref_registry/pref_registry_syncable.h" | 39 #include "components/pref_registry/pref_registry_syncable.h" |
39 #include "content/public/browser/browser_thread.h" | 40 #include "content/public/browser/browser_thread.h" |
40 #include "extensions/common/extension_urls.h" | 41 #include "extensions/common/extension_urls.h" |
41 #include "net/base/load_flags.h" | 42 #include "net/base/load_flags.h" |
42 #include "net/http/http_response_headers.h" | 43 #include "net/http/http_response_headers.h" |
43 #include "net/http/http_status_code.h" | 44 #include "net/http/http_status_code.h" |
44 #include "net/url_request/url_fetcher.h" | 45 #include "net/url_request/url_fetcher.h" |
45 #include "ui/base/l10n/l10n_util.h" | |
46 | 46 |
47 #if !defined(USE_ATHENA) | 47 #if !defined(USE_ATHENA) |
48 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 48 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
49 #endif | 49 #endif |
50 | 50 |
51 using content::BrowserThread; | 51 using content::BrowserThread; |
52 | 52 |
53 namespace chromeos { | 53 namespace chromeos { |
54 namespace { | 54 namespace { |
55 | 55 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 statistics_provider->GetMachineStatistic(kInitialLocaleAttr, | 327 statistics_provider->GetMachineStatistic(kInitialLocaleAttr, |
328 &initial_locale_); | 328 &initial_locale_); |
329 statistics_provider->GetMachineStatistic(kInitialTimezoneAttr, | 329 statistics_provider->GetMachineStatistic(kInitialTimezoneAttr, |
330 &initial_timezone_); | 330 &initial_timezone_); |
331 statistics_provider->GetMachineStatistic(kKeyboardLayoutAttr, | 331 statistics_provider->GetMachineStatistic(kKeyboardLayoutAttr, |
332 &keyboard_layout_); | 332 &keyboard_layout_); |
333 configured_locales_.resize(0); | 333 configured_locales_.resize(0); |
334 base::SplitString(initial_locale_, ',', &configured_locales_); | 334 base::SplitString(initial_locale_, ',', &configured_locales_); |
335 | 335 |
336 // Convert ICU locale to chrome ("en_US" to "en-US", etc.). | 336 // Convert ICU locale to chrome ("en_US" to "en-US", etc.). |
337 std::for_each(configured_locales_.begin(), | 337 std::for_each(configured_locales_.begin(), configured_locales_.end(), |
338 configured_locales_.end(), | 338 base::i18n::GetCanonicalLocale); |
339 l10n_util::GetCanonicalLocale); | |
340 | 339 |
341 // Let's always have configured_locales_.front() a valid entry. | 340 // Let's always have configured_locales_.front() a valid entry. |
342 if (configured_locales_.size() == 0) | 341 if (configured_locales_.size() == 0) |
343 configured_locales_.push_back(std::string()); | 342 configured_locales_.push_back(std::string()); |
344 } | 343 } |
345 | 344 |
346 const std::vector<std::string>& | 345 const std::vector<std::string>& |
347 StartupCustomizationDocument::configured_locales() const { | 346 StartupCustomizationDocument::configured_locales() const { |
348 return configured_locales_; | 347 return configured_locales_; |
349 } | 348 } |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 apply_tasks_success_ += success; | 962 apply_tasks_success_ += success; |
964 | 963 |
965 if (apply_tasks_started_ != apply_tasks_finished_) | 964 if (apply_tasks_started_ != apply_tasks_finished_) |
966 return; | 965 return; |
967 | 966 |
968 if (apply_tasks_success_ == apply_tasks_finished_) | 967 if (apply_tasks_success_ == apply_tasks_finished_) |
969 SetApplied(true); | 968 SetApplied(true); |
970 } | 969 } |
971 | 970 |
972 } // namespace chromeos | 971 } // namespace chromeos |
OLD | NEW |