Commit 787f3433 authored by alemate's avatar alemate Committed by Commit bot

ChromeOS: Update browser option UI for automatic timezone detection.

Update chrome://settings for "automatic timezone detection" option after UI
review.

BUG=461953
TEST=manual

Review URL: https://codereview.chromium.org/944593002

Cr-Commit-Position: refs/heads/master@{#318753}
parent 0ca7a117
......@@ -1985,9 +1985,6 @@ Press any key to continue exploring.
<message name="IDS_OPTIONS_SETTINGS_STORAGE_DESCRIPTION" desc="The 'Storage' button on the chrome://settings page.">
Stored data...
</message>
<message name="IDS_OPTIONS_SETTINGS_TIME_SYNCED_EXPLANATION" desc="In the settings tab, the text indicating that the date and time are set automatically.">
Date and time are set automatically.
</message>
<message name="IDS_OPTIONS_SETTINGS_SET_TIME_BUTTON" desc="In the settings tab, the prompt on the button to open a dialog to set date and time.">
Set date and time
</message>
......
......@@ -306,11 +306,6 @@
</div>
</div>
<div class="checkbox settings-row">
<label>
<input id="use-24hour-clock" pref="settings.clock.use_24hour_clock"
metric="Options_Use24HourClockCheckbox" type="checkbox">
<span i18n-content="use24HourClock"></span>
</label>
<div id="resolve-timezone-by-geolocation-selection" hidden>
<label>
<input id="resolve-timezone-by-geolocation"
......@@ -319,9 +314,12 @@
<span i18n-content="resolveTimezoneByGeoLocation"></span>
</label>
</div>
<label>
<input id="use-24hour-clock" pref="settings.clock.use_24hour_clock"
metric="Options_Use24HourClockCheckbox" type="checkbox">
<span i18n-content="use24HourClock"></span>
</label>
</div>
<div id="time-synced-explanation" class="settings-row"
i18n-content="timeSyncedExplanation"></div>
<div id="set-time" class="settings-row" hidden>
<button id="set-time-button"
i18n-content="setTimeButton"></button>
......
......@@ -407,6 +407,8 @@ cr.define('options', function() {
if (loadTimeData.getBoolean('enableTimeZoneTrackingOption')) {
$('resolve-timezone-by-geolocation-selection').hidden = false;
this.setSystemTimezoneManaged_(false);
$('timezone-value-select').disabled = loadTimeData.getBoolean(
'resolveTimezoneByGeolocationInitialValue');
}
}
......@@ -2113,7 +2115,6 @@ cr.define('options', function() {
*/
setCanSetTime_: function(canSetTime) {
// If the time has been network-synced, it cannot be set manually.
$('time-synced-explanation').hidden = canSetTime;
$('set-time').hidden = !canSetTime;
},
......@@ -2192,6 +2193,7 @@ cr.define('options', function() {
'setMetricsReportingSettingVisibility',
'setProfilesInfo',
'setSpokenFeedbackCheckboxState',
'setSystemTimezoneManaged',
'setThemesResetButtonEnabled',
'setVirtualKeyboardCheckboxState',
'setupPageZoomSelector',
......
......@@ -681,6 +681,9 @@ void BrowserOptionsHandler::GetLocalizedValues(base::DictionaryValue* values) {
values->SetBoolean("enableTimeZoneTrackingOption",
!have_disable_time_zone_tracking_option_switch &&
!chromeos::system::HasSystemTimezonePolicy());
values->SetBoolean("resolveTimezoneByGeolocationInitialValue",
Profile::FromWebUI(web_ui())->GetPrefs()->GetBoolean(
prefs::kResolveTimezoneByGeolocation));
#endif
}
......
......@@ -26,14 +26,12 @@ DateTimeOptionsWebUITest.prototype = {
TEST_F('DateTimeOptionsWebUITest', 'testShowSetTimeButton', function() {
assertEquals(this.browsePreload, document.location.href);
// Hide label and show button.
// Show button.
BrowserOptions.setCanSetTime(true);
expectTrue($('time-synced-explanation').hidden);
expectFalse($('set-time').hidden);
// Show label and hide button.
// Hide button.
BrowserOptions.setCanSetTime(false);
expectFalse($('time-synced-explanation').hidden);
expectTrue($('set-time').hidden);
});
......
......@@ -33,9 +33,6 @@ void DateTimeOptionsHandler::GetLocalizedValues(
localized_strings->SetString(
"setTimeButton",
l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_SET_TIME_BUTTON));
localized_strings->SetString(
"timeSyncedExplanation",
l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_TIME_SYNCED_EXPLANATION));
}
void DateTimeOptionsHandler::InitializeHandler() {
......
......@@ -118,11 +118,17 @@ class SharedOptionsTest : public LoginManagerTest {
browser->tab_strip_model()->GetActiveWebContents();
for (size_t i = 0; i < sizeof(kPrefTests) / sizeof(kPrefTests[0]); i++) {
CheckPreference(contents,
kPrefTests[i].pref_name,
!is_owner && kPrefTests[i].owner_only,
!is_owner && kPrefTests[i].indicator ? "owner" :
std::string());
bool disabled = !is_owner && kPrefTests[i].owner_only;
if (strcmp(kPrefTests[i].pref_name, kSystemTimezone) == 0) {
disabled = ProfileHelper::Get()
->GetProfileByUserUnsafe(user)
->GetPrefs()
->GetBoolean(prefs::kResolveTimezoneByGeolocation);
}
CheckPreference(
contents, kPrefTests[i].pref_name, disabled,
!is_owner && kPrefTests[i].indicator ? "owner" : std::string());
}
CheckBanner(contents, is_primary);
CheckSharedSections(contents, is_primary);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment