Skip to content

Commit

Permalink
[CrOS Tether] Update strings shown in the settings network summary.
Browse files Browse the repository at this point in the history
For both Wi-Fi and Mobile data networks:
(1) If connected, display: the connected network's name
(2) If not connected, but there are available networks to join,
    display: "Not connected"
(3) If not connected, and there are no networks to join, display:
    "No network"

This CL also adds the "cellular off" icon, which is displayed in these
cases.

Bug: 764110, 672263
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: If502538dd1e52e93ebead098d97cd3bc5080c871
Reviewed-on: https://chromium-review.googlesource.com/699634
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Commit-Queue: Kyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506279}
  • Loading branch information
Kyle Horimoto authored and Commit Bot committed Oct 4, 2017
1 parent bd29fa6 commit 7eabc09
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 8 deletions.
5 changes: 4 additions & 1 deletion chrome/app/chromeos_strings.grdp
Original file line number Diff line number Diff line change
Expand Up @@ -2310,7 +2310,10 @@ Press any key to continue exploring.
<message name="IDS_NETWORK_LIST_INITIALIZING" desc="Text in the network list element when a Cellular network is initiailizing.">
Initializing...
</message>
<message name="IDS_NETWORK_LIST_NOT_CONNECTED" desc="Text in the network list element when there is no network for the type.">
<message name="IDS_NETWORK_LIST_NOT_CONNECTED" desc="Text in the network list element when there is a network for the type, but it is not connected or connecting.">
Not connected
</message>
<message name="IDS_NETWORK_LIST_NO_NETWORK" desc="Text in the network list element when there is no network for the type.">
No network
</message>
<message name="IDS_NETWORK_LIST_CONNECTING_TO" desc="Text in a network summary element when the default network for a type (e.g. WiFi) is connecting.">
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/resources/chromeos/login/oobe_welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ Polymer({
loadTimeData.getString('networkListItemInitializing'),
networkListItemNotConnected:
loadTimeData.getString('networkListItemNotConnected'),
networkListItemNoNetwork:
loadTimeData.getString('networkListItemNoNetwork'),
vpnNameTemplate: loadTimeData.getString('vpnNameTemplate'),

// Additional strings for custom items.
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/resources/chromeos/network_ui/network_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ var NetworkUI = (function() {
loadTimeData.getString('networkListItemInitializing'),
networkListItemNotConnected:
loadTimeData.getString('networkListItemNotConnected'),
networkListItemNoNetwork:
loadTimeData.getString('networkListItemNoNetwork'),
vpnNameTemplate: loadTimeData.getString('vpnNameTemplate'),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,14 +485,14 @@ Polymer({
if (this.connectNotAllowed_(networkProperties, globalPolicy))
return false;
var type = networkProperties.Type;
if (type == CrOnc.Type.CELLULAR)
if (type == CrOnc.Type.CELLULAR || type == CrOnc.Type.TETHER)
return false;
if ((type == CrOnc.Type.WI_FI || type == CrOnc.Type.WI_MAX) &&
networkProperties.ConnectionState !=
CrOnc.ConnectionState.NOT_CONNECTED) {
return false;
}
return type != CrOnc.Type.CELLULAR;
return true;
},

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,11 @@ Polymer({
return this.i18n('tetherEnableBluetooth');
}
// Enabled or enabling states.
if (deviceState.State == CrOnc.DeviceState.ENABLED)
return CrOncStrings.networkListItemNotConnected;
if (deviceState.State == CrOnc.DeviceState.ENABLED) {
if (this.networkStateList.length > 0)
return CrOncStrings.networkListItemNotConnected;
return CrOncStrings.networkListItemNoNetwork;
}
if (deviceState.State == CrOnc.DeviceState.ENABLING)
return this.i18n('internetDeviceEnabling');
}
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/resources/settings/settings_ui/settings_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ Polymer({
loadTimeData.getString('networkListItemInitializing'),
networkListItemNotConnected:
loadTimeData.getString('networkListItemNotConnected'),
networkListItemNoNetwork:
loadTimeData.getString('networkListItemNoNetwork'),
vpnNameTemplate: loadTimeData.getString('vpnNameTemplate'),
};
// </if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ struct {
{"networkListItemConnectingTo", IDS_NETWORK_LIST_CONNECTING_TO},
{"networkListItemInitializing", IDS_NETWORK_LIST_INITIALIZING},
{"networkListItemNotConnected", IDS_NETWORK_LIST_NOT_CONNECTED},
{"networkListItemNoNetwork", IDS_NETWORK_LIST_NO_NETWORK},
{"vpnNameTemplate", IDS_NETWORK_LIST_THIRD_PARTY_VPN_NAME_TEMPLATE},
};
} // namespace
Expand All @@ -43,6 +44,8 @@ void AddLocalizedValuesToBuilder(::login::LocalizedValuesBuilder* builder) {
builder->Add(entry.name, entry.id);
}

// TODO(stevenjb): Remove this function; it is mostly a duplicate of the strings
// above.
void AddDetailsLocalizedStrings(content::WebUIDataSource* html_source) {
struct {
const char* name;
Expand All @@ -58,6 +61,7 @@ void AddDetailsLocalizedStrings(content::WebUIDataSource* html_source) {
{"networkListItemConnecting", IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING},
{"networkListItemConnectingTo", IDS_NETWORK_LIST_CONNECTING_TO},
{"networkListItemNotConnected", IDS_NETWORK_LIST_NOT_CONNECTED},
{"networkListItemNoNetwork", IDS_NETWORK_LIST_NO_NETWORK},
{"vpnNameTemplate", IDS_NETWORK_LIST_THIRD_PARTY_VPN_NAME_TEMPLATE},
};
for (const auto& entry : localized_strings)
Expand Down
1 change: 1 addition & 0 deletions chrome/test/data/webui/settings/internet_page_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ suite('Internet', function() {
networkListItemConnecting: 'networkListItemConnecting',
networkListItemConnectingTo: 'networkListItemConnectingTo',
networkListItemNotConnected: 'networkListItemNotConnected',
networkListItemNoNetwork: 'networkListItemNoNetwork',
vpnNameTemplate: 'vpnNameTemplate',
};

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@
background: url(cellular_4.svg);
}

#icon.cellular-off {
background: url(cellular_off.svg);
}

#icon.cellular-connecting {
animation: cellular-levels 750ms infinite;
animation-direction: alternate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ Polymer({
if (!this.isListItem &&
(!connectionState ||
connectionState == CrOnc.ConnectionState.NOT_CONNECTED)) {
if (type != CrOnc.Type.CELLULAR && type != CrOnc.Type.TETHER)
return prefix + 'off';
strength = 0;
return prefix + 'off';
} else {
strength = CrOnc.getSignalStrength(this.networkState);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
* networkListItemConnectingTo: string,
* networkListItemInitializing: string,
* networkListItemNotConnected: string,
* networkListItemNoNetwork: string,
* vpnNameTemplate: string,
* }}
*/
Expand Down
3 changes: 3 additions & 0 deletions ui/webui/resources/cr_elements_images.grdp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
<include name="IDR_CR_ELEMENTS_CELLULAR_4_SVG"
file="cr_elements/chromeos/network/cellular_4.svg"
type="BINDATA" />
<include name="IDR_CR_ELEMENTS_CELLULAR_OFF_SVG"
file="cr_elements/chromeos/network/cellular_off.svg"
type="BINDATA" />
<include name="IDR_CR_ELEMENTS_ETHERNET_SVG"
file="cr_elements/chromeos/network/ethernet.svg" type="BINDATA" />
<include name="IDR_CR_ELEMENTS_VPN_SVG"
Expand Down

0 comments on commit 7eabc09

Please sign in to comment.