0

Elim unused Chrome OS networking UI code

BUG=none

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

Cr-Commit-Position: refs/heads/master@{#343852}
This commit is contained in:
stevenjb
2015-08-18 00:56:13 -07:00
committed by Commit bot
parent c1f3000555
commit 948821a87b
6 changed files with 7 additions and 84 deletions
chrome/browser
resources
ui
webui
chromeos/network
extensions/browser/api/networking_private

@ -251,12 +251,7 @@
<table class="option-control-table">
<tr>
<td class="option-name" i18n-content="serviceName"></td>
<td id="service-name" class="option-value">
<select id="select-carrier">
</select>
<div id="switch-carrier-spinner" class="inline-spinner" hidden>
</div>
</td>
<td id="service-name" class="option-value"></td>
</tr>
<tr>
<td class="option-name" i18n-content="networkTechnology"></td>

@ -17,7 +17,6 @@ cr.define('options.internet', function() {
/** @const */ var IPAddressField = options.internet.IPAddressField;
/** @const */ var GoogleNameServers = ['8.8.4.4', '8.8.8.8'];
/** @const */ var CarrierGenericUMTS = 'Generic UMTS';
/** @const */ var CarrierSprint = 'Sprint';
/** @const */ var CarrierVerizon = 'Verizon Wireless';
@ -1088,33 +1087,6 @@ cr.define('options.internet', function() {
}
};
/**
* Shows a spinner while the carrier is changed.
*/
DetailsInternetPage.showCarrierChangeSpinner = function(visible) {
if (!DetailsInternetPage.getInstance().visible)
return;
$('switch-carrier-spinner').hidden = !visible;
// Disable any buttons that allow us to operate on cellular networks.
DetailsInternetPage.changeCellularButtonsState(visible);
};
/**
* Changes the network carrier.
*/
DetailsInternetPage.handleCarrierChanged = function() {
var carrierSelector = $('select-carrier');
var carrier = carrierSelector[carrierSelector.selectedIndex].textContent;
DetailsInternetPage.showCarrierChangeSpinner(true);
var guid = DetailsInternetPage.getInstance().onc_.guid();
var oncData = new OncData({});
oncData.setProperty('Cellular.Carrier', carrier);
chrome.networkingPrivate.setProperties(guid, oncData.getData(), function() {
// Start activation or show the activation UI after changing carriers.
DetailsInternetPage.activateCellular(guid);
});
};
/**
* If the network is not already activated, starts the activation process or
* shows the activation UI. Otherwise does nothing.
@ -1123,17 +1095,13 @@ cr.define('options.internet', function() {
chrome.networkingPrivate.getProperties(guid, function(properties) {
var oncData = new OncData(properties);
if (oncData.getActiveValue('Cellular.ActivationState') == 'Activated') {
DetailsInternetPage.showCarrierChangeSpinner(false);
return;
}
var carrier = oncData.getActiveValue('Cellular.Carrier');
if (carrier == CarrierSprint) {
// Sprint is directly ativated, call startActivate().
chrome.networkingPrivate.startActivate(guid, '', function() {
DetailsInternetPage.showCarrierChangeSpinner(false);
});
chrome.networkingPrivate.startActivate(guid, '');
} else {
DetailsInternetPage.showCarrierChangeSpinner(false);
chrome.send('showMorePlanInfo', [guid]);
}
});
@ -1689,32 +1657,7 @@ cr.define('options.internet', function() {
var isGsm = onc.getActiveValue('Cellular.Family') == 'GSM';
var currentCarrierIndex = -1;
if (loadTimeData.getValue('showCarrierSelect')) {
var currentCarrier =
isGsm ? CarrierGenericUMTS : onc.getActiveValue('Cellular.Carrier');
var supportedCarriers =
onc.getActiveValue('Cellular.SupportedCarriers');
for (var c1 = 0; c1 < supportedCarriers.length; ++c1) {
if (supportedCarriers[c1] == currentCarrier) {
currentCarrierIndex = c1;
break;
}
}
if (currentCarrierIndex != -1) {
var carrierSelector = $('select-carrier');
carrierSelector.onchange = DetailsInternetPage.handleCarrierChanged;
carrierSelector.options.length = 0;
for (var c2 = 0; c2 < supportedCarriers.length; ++c2) {
var option = document.createElement('option');
option.textContent = supportedCarriers[c2];
carrierSelector.add(option);
}
carrierSelector.selectedIndex = currentCarrierIndex;
}
}
if (currentCarrierIndex == -1)
$('service-name').textContent = networkName;
$('service-name').textContent = networkName;
// TODO(stevenjb): Ideally many of these should be localized.
$('network-technology').textContent =

@ -54,7 +54,6 @@ namespace {
// Keys for the initial "localized" dictionary values.
const char kLoggedInAsOwnerKey[] = "loggedInAsOwner";
const char kShowCarrierSelectKey[] = "showCarrierSelect";
// Functions we call in JavaScript.
const char kSetVPNProvidersFunction[] = "options.VPNProviders.setProviders";
@ -140,9 +139,6 @@ void InternetOptionsHandler::GetLocalizedValues(
bool logged_in_as_owner = LoginState::Get()->GetLoggedInUserType() ==
LoginState::LOGGED_IN_USER_OWNER;
localized_strings->SetBoolean(kLoggedInAsOwnerKey, logged_in_as_owner);
// TODO(anujsharma): Remove kShowCarrierSelectKey, as it is not
// required anymore.
localized_strings->SetBoolean(kShowCarrierSelectKey, false);
}
void InternetOptionsHandler::InitializePage() {

@ -187,8 +187,7 @@ scoped_ptr<base::ListValue> TranslateNetworkListToONC(
NetworkTypePattern pattern,
bool configured_only,
bool visible_only,
int limit,
bool debugging_properties) {
int limit) {
NetworkStateHandler::NetworkStateList network_states;
NetworkHandler::Get()->network_state_handler()->GetNetworkListByType(
pattern, configured_only, visible_only, limit, &network_states);
@ -197,14 +196,6 @@ scoped_ptr<base::ListValue> TranslateNetworkListToONC(
for (const NetworkState* state : network_states) {
scoped_ptr<base::DictionaryValue> onc_dictionary =
TranslateNetworkStateToONC(state);
if (debugging_properties) {
onc_dictionary->SetBoolean("connectable", state->connectable());
onc_dictionary->SetBoolean("visible", state->visible());
onc_dictionary->SetString("profile_path", state->profile_path());
onc_dictionary->SetString("service_path", state->path());
}
network_properties_list->Append(onc_dictionary.release());
}
return network_properties_list.Pass();

@ -101,14 +101,12 @@ CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> TranslateNetworkStateToONC(
// |configured_only|, and |visible_only| to NetworkStateHandler::
// GetNetworkListByType(). Translates the result into a list of ONC
// dictionaries using TranslateShillServiceToONCPart. |limit| is used to limit
// the number of results. If |debugging_properties| is true then also include
// additional debugging properties (used in release code for chrome://network).
// the number of results.
CHROMEOS_EXPORT scoped_ptr<base::ListValue> TranslateNetworkListToONC(
NetworkTypePattern pattern,
bool configured_only,
bool visible_only,
int limit,
bool debugging_properties);
int limit);
// Returns the Shill type corresponding to ONC |type| or an empty string if
// there is no match. Only valid for ethernet, wifi, wimax, cellular, and vpn.

@ -293,7 +293,7 @@ void NetworkingPrivateChromeOS::GetNetworks(
chromeos::onc::NetworkTypePatternFromOncType(network_type);
scoped_ptr<base::ListValue> network_properties_list =
chromeos::network_util::TranslateNetworkListToONC(
pattern, configured_only, visible_only, limit, false /* debugging */);
pattern, configured_only, visible_only, limit);
success_callback.Run(network_properties_list.Pass());
}