summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/customization_document.cc4
-rw-r--r--chrome/browser/chromeos/customization_document.h4
-rw-r--r--chrome/browser/chromeos/customization_document_unittest.cc2
-rw-r--r--chrome/browser/chromeos/login/wizard_controller.cc32
-rw-r--r--chrome/browser/chromeos/testdata/startup_manifest.json3
5 files changed, 36 insertions, 9 deletions
diff --git a/chrome/browser/chromeos/customization_document.cc b/chrome/browser/chromeos/customization_document.cc
index e0f5f32..19410ec 100644
--- a/chrome/browser/chromeos/customization_document.cc
+++ b/chrome/browser/chromeos/customization_document.cc
@@ -20,6 +20,7 @@ namespace {
const wchar_t kVersionAttr[] = L"version";
const wchar_t kProductSkuAttr[] = L"product_sku";
const wchar_t kInitialLocaleAttr[] = L"initial_locale";
+const wchar_t kInitialTimezoneAttr[] = L"initial_timezone";
const wchar_t kBackgroundColorAttr[] = L"background_color";
const wchar_t kRegistrationUrlAttr[] = L"registration_url";
const wchar_t kSetupContentAttr[] = L"setup_content";
@@ -85,6 +86,9 @@ bool StartupCustomizationDocument::ParseFromJsonValue(
initial_locale_.clear();
root->GetString(kInitialLocaleAttr, &initial_locale_);
+ initial_timezone_.clear();
+ root->GetString(kInitialTimezoneAttr, &initial_timezone_);
+
std::string background_color_string;
root->GetString(kBackgroundColorAttr, &background_color_string);
if (!background_color_string.empty()) {
diff --git a/chrome/browser/chromeos/customization_document.h b/chrome/browser/chromeos/customization_document.h
index a46d847..169adb9 100644
--- a/chrome/browser/chromeos/customization_document.h
+++ b/chrome/browser/chromeos/customization_document.h
@@ -64,6 +64,7 @@ class StartupCustomizationDocument : public CustomizationDocument {
const std::string& product_sku() const { return product_sku_; }
const std::string& initial_locale() const { return initial_locale_; }
+ const std::string& initial_timezone() const { return initial_timezone_; }
SkColor background_color() const { return background_color_; }
const std::string& registration_url() const { return registration_url_; }
@@ -78,6 +79,9 @@ class StartupCustomizationDocument : public CustomizationDocument {
// Initial locale for the OOBE wizard.
std::string initial_locale_;
+ // Initial timezone for clock setting.
+ std::string initial_timezone_;
+
// OOBE wizard and login screen background color.
SkColor background_color_;
diff --git a/chrome/browser/chromeos/customization_document_unittest.cc b/chrome/browser/chromeos/customization_document_unittest.cc
index 620c16a..41c2cee 100644
--- a/chrome/browser/chromeos/customization_document_unittest.cc
+++ b/chrome/browser/chromeos/customization_document_unittest.cc
@@ -13,6 +13,7 @@ const char kGoodStartupManifest[] =
" \"version\": \"1.0\","
" \"product_sku\" : \"SKU\","
" \"initial_locale\" : \"en_US\","
+ " \"initial_timezone\" : \"US/Pacific\","
" \"background_color\" : \"#880088\","
" \"registration_url\" : \"http://www.google.com\","
" \"setup_content\" : ["
@@ -99,6 +100,7 @@ TEST_F(StartupCustomizationDocumentTest, LoadGoodManifestFromString) {
EXPECT_EQ(customization_.version(), "1.0");
EXPECT_EQ(customization_.product_sku(), "SKU");
EXPECT_EQ(customization_.initial_locale(), "en_US");
+ EXPECT_EQ(customization_.initial_timezone(), "US/Pacific");
EXPECT_EQ(customization_.background_color(),
SkColorSetRGB(0x88, 0x00, 0x88));
EXPECT_EQ(customization_.registration_url(), "http://www.google.com");
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
index 07bfbd8..8e87f5c 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -29,15 +29,18 @@
#include "chrome/browser/chromeos/login/user_image_screen.h"
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/wm_ipc.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
+#include "chrome/common/pref_names.h"
#include "third_party/cros/chromeos_wm_ipc_enums.h"
#include "views/accelerator.h"
#include "views/painter.h"
#include "views/screen.h"
#include "views/view.h"
#include "views/widget/widget_gtk.h"
+#include "unicode/timezone.h"
namespace {
@@ -238,14 +241,6 @@ void WizardController::Init(const std::string& first_screen_name,
is_out_of_box_ = true;
}
- // Switch to initial locale if specified by customization.
- if (customization_ != NULL) {
- const std::string locale = customization_->initial_locale();
- if (!locale.empty()) {
- chromeos::LanguageSwitchMenu::SwitchLanguage(locale);
- }
- }
-
ShowFirstScreen(first_screen_name);
// This keeps the window from flashing at startup.
@@ -580,6 +575,27 @@ void ShowLoginWizard(const std::string& first_screen_name,
DCHECK(manifest_loaded) << manifest_path.value();
}
+ // Do UX customizations if needed.
+ if (customization != NULL) {
+ // Switch to initial locale if specified by customization.
+ const std::string locale = customization->initial_locale();
+ if (!locale.empty()) {
+ chromeos::LanguageSwitchMenu::SwitchLanguage(locale);
+ }
+
+ // Set initial timezone if specified by customization.
+ const std::string timezone_name = customization->initial_timezone();
+ if (!timezone_name.empty()) {
+ icu::TimeZone* timezone = icu::TimeZone::createTimeZone(
+ icu::UnicodeString::fromUTF8(timezone_name));
+ icu::TimeZone::adoptDefault(timezone);
+ // Save timezone to default profile preferences.
+ PrefService* prefs = ProfileManager::GetDefaultProfile()->GetPrefs();
+ prefs->SetString(prefs::kTimeZone, UTF8ToWide(timezone_name));
+ prefs->SavePersistentPrefs();
+ }
+ }
+
// Create and show the wizard.
WizardController* controller = new WizardController();
controller->SetCustomization(customization.release());
diff --git a/chrome/browser/chromeos/testdata/startup_manifest.json b/chrome/browser/chromeos/testdata/startup_manifest.json
index ba2d2a5d..25521a2 100644
--- a/chrome/browser/chromeos/testdata/startup_manifest.json
+++ b/chrome/browser/chromeos/testdata/startup_manifest.json
@@ -4,7 +4,8 @@
"product_sku" : "SKU",
// Optional.
- "initial_locale" : "it",
+ "initial_locale" : "ru",
+ "initial_timezone" : "Asia/Tokyo",
"background_color" : "#880088",
"registration_url" : "http://www.google.com",
"setup_content" : [