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. ...@@ -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."> <message name="IDS_OPTIONS_SETTINGS_STORAGE_DESCRIPTION" desc="The 'Storage' button on the chrome://settings page.">
Stored data... Stored data...
</message> </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."> <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 Set date and time
</message> </message>
......
...@@ -306,11 +306,6 @@ ...@@ -306,11 +306,6 @@
</div> </div>
</div> </div>
<div class="checkbox settings-row"> <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> <div id="resolve-timezone-by-geolocation-selection" hidden>
<label> <label>
<input id="resolve-timezone-by-geolocation" <input id="resolve-timezone-by-geolocation"
...@@ -319,9 +314,12 @@ ...@@ -319,9 +314,12 @@
<span i18n-content="resolveTimezoneByGeoLocation"></span> <span i18n-content="resolveTimezoneByGeoLocation"></span>
</label> </label>
</div> </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>
<div id="time-synced-explanation" class="settings-row"
i18n-content="timeSyncedExplanation"></div>
<div id="set-time" class="settings-row" hidden> <div id="set-time" class="settings-row" hidden>
<button id="set-time-button" <button id="set-time-button"
i18n-content="setTimeButton"></button> i18n-content="setTimeButton"></button>
......
...@@ -407,6 +407,8 @@ cr.define('options', function() { ...@@ -407,6 +407,8 @@ cr.define('options', function() {
if (loadTimeData.getBoolean('enableTimeZoneTrackingOption')) { if (loadTimeData.getBoolean('enableTimeZoneTrackingOption')) {
$('resolve-timezone-by-geolocation-selection').hidden = false; $('resolve-timezone-by-geolocation-selection').hidden = false;
this.setSystemTimezoneManaged_(false); this.setSystemTimezoneManaged_(false);
$('timezone-value-select').disabled = loadTimeData.getBoolean(
'resolveTimezoneByGeolocationInitialValue');
} }
} }
...@@ -2113,7 +2115,6 @@ cr.define('options', function() { ...@@ -2113,7 +2115,6 @@ cr.define('options', function() {
*/ */
setCanSetTime_: function(canSetTime) { setCanSetTime_: function(canSetTime) {
// If the time has been network-synced, it cannot be set manually. // If the time has been network-synced, it cannot be set manually.
$('time-synced-explanation').hidden = canSetTime;
$('set-time').hidden = !canSetTime; $('set-time').hidden = !canSetTime;
}, },
...@@ -2192,6 +2193,7 @@ cr.define('options', function() { ...@@ -2192,6 +2193,7 @@ cr.define('options', function() {
'setMetricsReportingSettingVisibility', 'setMetricsReportingSettingVisibility',
'setProfilesInfo', 'setProfilesInfo',
'setSpokenFeedbackCheckboxState', 'setSpokenFeedbackCheckboxState',
'setSystemTimezoneManaged',
'setThemesResetButtonEnabled', 'setThemesResetButtonEnabled',
'setVirtualKeyboardCheckboxState', 'setVirtualKeyboardCheckboxState',
'setupPageZoomSelector', 'setupPageZoomSelector',
......
...@@ -681,6 +681,9 @@ void BrowserOptionsHandler::GetLocalizedValues(base::DictionaryValue* values) { ...@@ -681,6 +681,9 @@ void BrowserOptionsHandler::GetLocalizedValues(base::DictionaryValue* values) {
values->SetBoolean("enableTimeZoneTrackingOption", values->SetBoolean("enableTimeZoneTrackingOption",
!have_disable_time_zone_tracking_option_switch && !have_disable_time_zone_tracking_option_switch &&
!chromeos::system::HasSystemTimezonePolicy()); !chromeos::system::HasSystemTimezonePolicy());
values->SetBoolean("resolveTimezoneByGeolocationInitialValue",
Profile::FromWebUI(web_ui())->GetPrefs()->GetBoolean(
prefs::kResolveTimezoneByGeolocation));
#endif #endif
} }
......
...@@ -26,14 +26,12 @@ DateTimeOptionsWebUITest.prototype = { ...@@ -26,14 +26,12 @@ DateTimeOptionsWebUITest.prototype = {
TEST_F('DateTimeOptionsWebUITest', 'testShowSetTimeButton', function() { TEST_F('DateTimeOptionsWebUITest', 'testShowSetTimeButton', function() {
assertEquals(this.browsePreload, document.location.href); assertEquals(this.browsePreload, document.location.href);
// Hide label and show button. // Show button.
BrowserOptions.setCanSetTime(true); BrowserOptions.setCanSetTime(true);
expectTrue($('time-synced-explanation').hidden);
expectFalse($('set-time').hidden); expectFalse($('set-time').hidden);
// Show label and hide button. // Hide button.
BrowserOptions.setCanSetTime(false); BrowserOptions.setCanSetTime(false);
expectFalse($('time-synced-explanation').hidden);
expectTrue($('set-time').hidden); expectTrue($('set-time').hidden);
}); });
......
...@@ -33,9 +33,6 @@ void DateTimeOptionsHandler::GetLocalizedValues( ...@@ -33,9 +33,6 @@ void DateTimeOptionsHandler::GetLocalizedValues(
localized_strings->SetString( localized_strings->SetString(
"setTimeButton", "setTimeButton",
l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_SET_TIME_BUTTON)); 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() { void DateTimeOptionsHandler::InitializeHandler() {
......
...@@ -118,11 +118,17 @@ class SharedOptionsTest : public LoginManagerTest { ...@@ -118,11 +118,17 @@ class SharedOptionsTest : public LoginManagerTest {
browser->tab_strip_model()->GetActiveWebContents(); browser->tab_strip_model()->GetActiveWebContents();
for (size_t i = 0; i < sizeof(kPrefTests) / sizeof(kPrefTests[0]); i++) { for (size_t i = 0; i < sizeof(kPrefTests) / sizeof(kPrefTests[0]); i++) {
CheckPreference(contents, bool disabled = !is_owner && kPrefTests[i].owner_only;
kPrefTests[i].pref_name, if (strcmp(kPrefTests[i].pref_name, kSystemTimezone) == 0) {
!is_owner && kPrefTests[i].owner_only, disabled = ProfileHelper::Get()
!is_owner && kPrefTests[i].indicator ? "owner" : ->GetProfileByUserUnsafe(user)
std::string()); ->GetPrefs()
->GetBoolean(prefs::kResolveTimezoneByGeolocation);
}
CheckPreference(
contents, kPrefTests[i].pref_name, disabled,
!is_owner && kPrefTests[i].indicator ? "owner" : std::string());
} }
CheckBanner(contents, is_primary); CheckBanner(contents, is_primary);
CheckSharedSections(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