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

Unified Diff: chrome/browser/ui/webui/chromeos/set_time_ui.cc

Issue 2849823003: ChromeOS: implement per-user time zone preferences. (Closed)
Patch Set: Rebased. Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/chromeos/set_time_ui.cc
diff --git a/chrome/browser/ui/webui/chromeos/set_time_ui.cc b/chrome/browser/ui/webui/chromeos/set_time_ui.cc
index 98871678f7e8a217b48ccf01af37e73d426bafec..bc44b7e8b4b6669f19bc9cfe46c0f88025d8cdb8 100644
--- a/chrome/browser/ui/webui/chromeos/set_time_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/set_time_ui.cc
@@ -22,6 +22,7 @@
#include "chromeos/dbus/system_clock_client.h"
#include "chromeos/login/login_state.h"
#include "chromeos/settings/timezone_settings.h"
+#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/browser/web_ui_message_handler.h"
@@ -63,6 +64,10 @@ class SetTimeMessageHandler : public content::WebUIMessageHandler,
web_ui()->CallJavascriptFunctionUnsafe("settime.TimeSetter.updateTime");
}
+ // UI actually shows real device timezone, but only allows changing the user
+ // timezone. If user timezone settings are different from system, this means
+ // that user settings are overriden and must be disabled. (And we will still
+ // show the actual device timezone.)
// system::TimezoneSettings::Observer:
void TimezoneChanged(const icu::TimeZone& timezone) override {
base::Value timezone_id(system::TimezoneSettings::GetTimezoneID(timezone));
@@ -94,7 +99,10 @@ class SetTimeMessageHandler : public content::WebUIMessageHandler,
return;
}
- CrosSettings::Get()->SetString(kSystemTimezone, timezone_id);
+ Profile* profile = Profile::FromBrowserContext(
+ web_ui()->GetWebContents()->GetBrowserContext());
+ DCHECK(profile);
+ system::SetTimezoneFromUI(profile, timezone_id);
}
DISALLOW_COPY_AND_ASSIGN(SetTimeMessageHandler);

Powered by Google App Engine
This is Rietveld 408576698