summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/options/network_config_view.cc3
-rw-r--r--chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc8
-rw-r--r--chrome/browser/resources/options/chromeos/internet_detail.js54
-rw-r--r--chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc26
-rw-r--r--chrome/browser/ui/webui/options/chromeos/internet_options_handler.h2
-rw-r--r--chrome/test/data/extensions/api_test/networking_private/chromeos/test.js13
-rw-r--r--chromeos/dbus/fake_shill_service_client.cc34
-rw-r--r--chromeos/network/managed_network_configuration_handler_impl.cc11
-rw-r--r--chromeos/network/network_state.cc8
-rw-r--r--chromeos/network/network_state.h3
-rw-r--r--chromeos/network/network_state_handler.cc10
-rw-r--r--chromeos/network/network_state_handler.h4
-rw-r--r--chromeos/network/network_util.cc2
-rw-r--r--chromeos/network/onc/onc_translation_tables.cc15
-rw-r--r--chromeos/network/onc/onc_translator.h10
-rw-r--r--chromeos/network/onc/onc_translator_shill_to_onc.cc42
-rw-r--r--chromeos/network/onc/onc_translator_unittest.cc3
-rw-r--r--chromeos/network/policy_applicator.cc6
-rw-r--r--components/device_event_log/device_event_log_impl.cc2
-rw-r--r--components/onc/docs/onc_spec.html13
-rw-r--r--ui/chromeos/network/network_connect.cc16
-rw-r--r--ui/chromeos/network/network_state_notifier.cc9
-rw-r--r--ui/chromeos/network/network_state_notifier.h8
23 files changed, 105 insertions, 197 deletions
diff --git a/chrome/browser/chromeos/options/network_config_view.cc b/chrome/browser/chromeos/options/network_config_view.cc
index 4c2de1f..b41bd47 100644
--- a/chrome/browser/chromeos/options/network_config_view.cc
+++ b/chrome/browser/chromeos/options/network_config_view.cc
@@ -25,7 +25,6 @@
#include "chromeos/login/login_state.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
-#include "components/device_event_log/device_event_log.h"
#include "components/user_manager/user.h"
#include "ui/accessibility/ax_view_state.h"
#include "ui/aura/window_event_dispatcher.h"
@@ -137,7 +136,6 @@ void NetworkConfigView::Show(const std::string& service_path,
delete view;
return;
}
- NET_LOG(USER) << "NetworkConfigView::Show: " << service_path;
view->ShowDialog(parent);
}
@@ -153,7 +151,6 @@ void NetworkConfigView::ShowForType(const std::string& type,
delete view;
return;
}
- NET_LOG(USER) << "NetworkConfigView::ShowForType: " << type;
view->ShowDialog(parent);
}
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc b/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc
index 89a201f..171e974 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc
+++ b/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc
@@ -20,8 +20,6 @@
#include "chromeos/dbus/shill_profile_client.h"
#include "chromeos/dbus/shill_service_client.h"
#include "chromeos/login/user_names.h"
-#include "chromeos/network/network_handler.h"
-#include "chromeos/network/network_state_handler.h"
#include "chromeos/network/onc/onc_utils.h"
#include "chromeos/network/portal_detector/network_portal_detector.h"
#include "components/onc/onc_constants.h"
@@ -548,12 +546,6 @@ IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, GetManagedProperties) {
EXPECT_TRUE(RunNetworkingSubtest("getManagedProperties")) << message_;
}
-IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, GetErrorState) {
- chromeos::NetworkHandler::Get()->network_state_handler()->SetLastErrorForTest(
- kWifi1ServicePath, "TestErrorState");
- EXPECT_TRUE(RunNetworkingSubtest("getErrorState")) << message_;
-}
-
IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest,
OnNetworksChangedEventConnect) {
EXPECT_TRUE(RunNetworkingSubtest("onNetworksChangedEventConnect"))
diff --git a/chrome/browser/resources/options/chromeos/internet_detail.js b/chrome/browser/resources/options/chromeos/internet_detail.js
index a077fbd..1b49bc6 100644
--- a/chrome/browser/resources/options/chromeos/internet_detail.js
+++ b/chrome/browser/resources/options/chromeos/internet_detail.js
@@ -1189,62 +1189,14 @@ cr.define('options.internet', function() {
};
DetailsInternetPage.loginFromDetails = function() {
- DetailsInternetPage.configureOrConnect();
- PageManager.closeOverlay();
- };
-
- /**
- * This function identifies unconfigured networks and networks that are
- * likely to fail (e.g. due to a bad passphrase on a previous connect
- * attempt). For such networks a configure dialog will be opened. Otherwise
- * a connection will be attempted.
- */
- DetailsInternetPage.configureOrConnect = function() {
var detailsPage = DetailsInternetPage.getInstance();
if (detailsPage.type_ == 'WiFi')
sendChromeMetricsAction('Options_NetworkConnectToWifi');
else if (detailsPage.type_ == 'VPN')
sendChromeMetricsAction('Options_NetworkConnectToVPN');
-
- var onc = detailsPage.onc_;
- var guid = onc.guid();
- var type = onc.getActiveValue('Type');
-
- // VPNs do not correctly set 'Connectable', so we always show the
- // configuration UI.
- if (type == 'VPN') {
- chrome.send('configureNetwork', [guid]);
- return;
- }
-
- // If 'Connectable' is false for WiFi or WiMAX, Shill requires
- // additional configuration to connect, so show the configuration UI.
- if ((type == 'WiFi' || type == 'WiMAX') &&
- !onc.getActiveValue('Connectable')) {
- chrome.send('configureNetwork', [guid]);
- return;
- }
-
- // Secure WiFi networks with ErrorState set most likely require
- // configuration (e.g. a correct passphrase) before connecting.
- if (type == 'WiFi' && onc.getWiFiSecurity() != 'None') {
- var errorState = onc.getActiveValue('ErrorState');
- if (errorState && errorState != 'Unknown') {
- chrome.send('configureNetwork', [guid]);
- return;
- }
- }
-
- // Cellular networks need to be activated before they can be connected to.
- if (type == 'Cellular') {
- var activationState = onc.getActiveValue('Cellular.ActivationState');
- if (activationState != 'Activated' && activationState != 'Unknown') {
- DetailsInternetPage.activateCellular(guid);
- return;
- }
- }
-
- chrome.networkingPrivate.startConnect(guid);
+ // TODO(stevenjb): chrome.networkingPrivate.startConnect
+ chrome.send('startConnect', [detailsPage.onc_.guid()]);
+ PageManager.closeOverlay();
};
DetailsInternetPage.disconnectNetwork = function() {
diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
index 97387dd..8868fc7 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
@@ -91,6 +91,10 @@ const char kUpdateConnectionDataFunction[] =
const char kShowMorePlanInfoMessage[] = "showMorePlanInfo";
const char kSimOperationMessage[] = "simOperation";
+// TODO(stevenjb): Replace these with the matching networkingPrivate methods.
+// crbug.com/279351.
+const char kStartConnectMessage[] = "startConnect";
+
// TODO(stevenjb): Deprecate this once we handle events in the JS.
const char kSetNetworkGuidMessage[] = "setNetworkGuid";
@@ -256,6 +260,11 @@ void InternetOptionsHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback(kSetNetworkGuidMessage,
base::Bind(&InternetOptionsHandler::SetNetworkGuidCallback,
base::Unretained(this)));
+
+ // networkingPrivate methods
+ web_ui()->RegisterMessageCallback(kStartConnectMessage,
+ base::Bind(&InternetOptionsHandler::StartConnectCallback,
+ base::Unretained(this)));
}
void InternetOptionsHandler::OnExtensionLoaded(
@@ -337,6 +346,23 @@ void InternetOptionsHandler::SetNetworkGuidCallback(
details_guid_ = guid;
}
+
+////////////////////////////////////////////////////////////////////////////////
+// networkingPrivate implementation methods. TODO(stevenjb): Use the
+// networkingPrivate API directly in the settings JS and deprecate these
+// methods. crbug.com/279351.
+
+void InternetOptionsHandler::StartConnectCallback(const base::ListValue* args) {
+ std::string guid;
+ if (!args->GetString(0, &guid)) {
+ NOTREACHED();
+ return;
+ }
+ std::string service_path = ServicePathFromGuid(guid);
+ if (!service_path.empty())
+ ui::NetworkConnect::Get()->ConnectToNetwork(service_path);
+}
+
////////////////////////////////////////////////////////////////////////////////
void InternetOptionsHandler::UpdateVPNProviders() {
diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.h b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.h
index c7e9188..086d545 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.h
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.h
@@ -68,6 +68,8 @@ class InternetOptionsHandler : public ::options::OptionsPageUIHandler,
// networkingPrvate callbacks
void GetManagedPropertiesCallback(const base::ListValue* args);
+ void StartConnectCallback(const base::ListValue* args);
+ void SetPropertiesCallback(const base::ListValue* args);
// Updates the list of VPN providers enabled in the primary user's profile.
void UpdateVPNProviders();
diff --git a/chrome/test/data/extensions/api_test/networking_private/chromeos/test.js b/chrome/test/data/extensions/api_test/networking_private/chromeos/test.js
index 3c8e20a..7c85379 100644
--- a/chrome/test/data/extensions/api_test/networking_private/chromeos/test.js
+++ b/chrome/test/data/extensions/api_test/networking_private/chromeos/test.js
@@ -616,19 +616,6 @@ var availableTests = [
'non_existent',
callbackFail('Error.InvalidNetworkGuid'));
},
- function getErrorState() {
- // Both getState and getProperties should have ErrorState set.
- chrome.networkingPrivate.getState(
- 'stub_wifi1_guid',
- function(result) {
- assertEq('TestErrorState', result.ErrorState);
- chrome.networkingPrivate.getProperties(
- 'stub_wifi1_guid',
- callbackPass(function(result2) {
- assertEq('TestErrorState', result2.ErrorState);
- }));
- });
- },
function onNetworksChangedEventConnect() {
var network = 'stub_wifi2_guid';
var done = chrome.test.callbackAdded();
diff --git a/chromeos/dbus/fake_shill_service_client.cc b/chromeos/dbus/fake_shill_service_client.cc
index fdae9db..d4e789c3 100644
--- a/chromeos/dbus/fake_shill_service_client.cc
+++ b/chromeos/dbus/fake_shill_service_client.cc
@@ -178,8 +178,8 @@ void FakeShillServiceClient::Connect(const dbus::ObjectPath& service_path,
const ErrorCallback& error_callback) {
VLOG(1) << "FakeShillServiceClient::Connect: " << service_path.value();
base::DictionaryValue* service_properties = NULL;
- if (!stub_services_.GetDictionary(service_path.value(),
- &service_properties)) {
+ if (!stub_services_.GetDictionary(
+ service_path.value(), &service_properties)) {
LOG(ERROR) << "Service not found: " << service_path.value();
error_callback.Run("Error.InvalidService", "Invalid Service");
return;
@@ -190,22 +190,21 @@ void FakeShillServiceClient::Connect(const dbus::ObjectPath& service_path,
// sending an update.
SetOtherServicesOffline(service_path.value());
- // Clear Error.
- service_properties->SetStringWithoutPathExpansion(shill::kErrorProperty, "");
-
// Set Associating.
base::StringValue associating_value(shill::kStateAssociation);
- SetServiceProperty(service_path.value(), shill::kStateProperty,
+ SetServiceProperty(service_path.value(),
+ shill::kStateProperty,
associating_value);
// Stay Associating until the state is changed again after a delay.
base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&FakeShillServiceClient::ContinueConnect,
- weak_ptr_factory_.GetWeakPtr(), service_path.value()),
+ weak_ptr_factory_.GetWeakPtr(),
+ service_path.value()),
base::TimeDelta::FromSeconds(GetInteractiveDelay()));
- base::MessageLoop::current()->PostTask(FROM_HERE, callback);
+ callback.Run();
}
void FakeShillServiceClient::Disconnect(const dbus::ObjectPath& service_path,
@@ -607,7 +606,8 @@ void FakeShillServiceClient::SetCellularActivated(
error_callback);
}
-void FakeShillServiceClient::ContinueConnect(const std::string& service_path) {
+void FakeShillServiceClient::ContinueConnect(
+ const std::string& service_path) {
VLOG(1) << "FakeShillServiceClient::ContinueConnect: " << service_path;
base::DictionaryValue* service_properties = NULL;
if (!stub_services_.GetDictionary(service_path, &service_properties)) {
@@ -625,24 +625,26 @@ void FakeShillServiceClient::ContinueConnect(const std::string& service_path) {
// No custom connect behavior set, continue with the default connect behavior.
std::string passphrase;
- service_properties->GetStringWithoutPathExpansion(shill::kPassphraseProperty,
- &passphrase);
+ service_properties->GetStringWithoutPathExpansion(
+ shill::kPassphraseProperty, &passphrase);
if (passphrase == "failure") {
// Simulate a password failure.
- SetServiceProperty(service_path, shill::kErrorProperty,
- base::StringValue(shill::kErrorBadPassphrase));
- SetServiceProperty(service_path, shill::kStateProperty,
+ SetServiceProperty(service_path,
+ shill::kStateProperty,
base::StringValue(shill::kStateFailure));
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(
base::IgnoreResult(&FakeShillServiceClient::SetServiceProperty),
- weak_ptr_factory_.GetWeakPtr(), service_path, shill::kErrorProperty,
+ weak_ptr_factory_.GetWeakPtr(),
+ service_path,
+ shill::kErrorProperty,
base::StringValue(shill::kErrorBadPassphrase)));
} else {
// Set Online.
VLOG(1) << "Setting state to Online " << service_path;
- SetServiceProperty(service_path, shill::kStateProperty,
+ SetServiceProperty(service_path,
+ shill::kStateProperty,
base::StringValue(shill::kStateOnline));
}
}
diff --git a/chromeos/network/managed_network_configuration_handler_impl.cc b/chromeos/network/managed_network_configuration_handler_impl.cc
index f20cdcc3..a92be66 100644
--- a/chromeos/network/managed_network_configuration_handler_impl.cc
+++ b/chromeos/network/managed_network_configuration_handler_impl.cc
@@ -164,12 +164,9 @@ void ManagedNetworkConfigurationHandlerImpl::SendManagedProperties(
::onc::ONCSource onc_source;
FindPolicyByGUID(userhash, guid, &onc_source);
- const NetworkState* network_state =
- network_state_handler_->GetNetworkState(service_path);
scoped_ptr<base::DictionaryValue> active_settings(
- onc::TranslateShillServiceToONCPart(*shill_properties, onc_source,
- &onc::kNetworkWithStateSignature,
- network_state));
+ onc::TranslateShillServiceToONCPart(
+ *shill_properties, onc_source, &onc::kNetworkWithStateSignature));
const base::DictionaryValue* network_policy = NULL;
const base::DictionaryValue* global_policy = NULL;
@@ -216,12 +213,10 @@ void ManagedNetworkConfigurationHandlerImpl::SendProperties(
const network_handler::ErrorCallback& error_callback,
const std::string& service_path,
scoped_ptr<base::DictionaryValue> shill_properties) {
- const NetworkState* network_state =
- network_state_handler_->GetNetworkState(service_path);
scoped_ptr<base::DictionaryValue> onc_network(
onc::TranslateShillServiceToONCPart(
*shill_properties, ::onc::ONC_SOURCE_UNKNOWN,
- &onc::kNetworkWithStateSignature, network_state));
+ &onc::kNetworkWithStateSignature));
callback.Run(service_path, *onc_network);
}
diff --git a/chromeos/network/network_state.cc b/chromeos/network/network_state.cc
index 93c12e4..f4ad959 100644
--- a/chromeos/network/network_state.cc
+++ b/chromeos/network/network_state.cc
@@ -231,6 +231,8 @@ void NetworkState::GetStateProperties(base::DictionaryValue* dictionary) const {
profile_path());
if (visible()) {
+ if (!error().empty())
+ dictionary->SetStringWithoutPathExpansion(shill::kErrorProperty, error());
dictionary->SetStringWithoutPathExpansion(shill::kStateProperty,
connection_state());
}
@@ -396,12 +398,6 @@ bool NetworkState::UpdateName(const base::DictionaryValue& properties) {
return false;
}
-std::string NetworkState::GetErrorState() const {
- if (ErrorIsValid(error()))
- return error();
- return last_error();
-}
-
// static
bool NetworkState::StateIsConnected(const std::string& connection_state) {
return (connection_state == shill::kStateReady ||
diff --git a/chromeos/network/network_state.h b/chromeos/network/network_state.h
index 518e568..e4d9cce 100644
--- a/chromeos/network/network_state.h
+++ b/chromeos/network/network_state.h
@@ -126,9 +126,6 @@ class CHROMEOS_EXPORT NetworkState : public ManagedState {
// Set the GUID. Called exclusively by NetworkStateHandler.
void SetGuid(const std::string& guid);
- // Returns |error_| if valid, otherwise returns |last_error_|.
- std::string GetErrorState() const;
-
// Helpers (used e.g. when a state, error, or shill dictionary is cached)
static bool StateIsConnected(const std::string& connection_state);
static bool StateIsConnecting(const std::string& connection_state);
diff --git a/chromeos/network/network_state_handler.cc b/chromeos/network/network_state_handler.cc
index a8a9ebf..236789c 100644
--- a/chromeos/network/network_state_handler.cc
+++ b/chromeos/network/network_state_handler.cc
@@ -417,16 +417,6 @@ const NetworkState* NetworkStateHandler::GetEAPForEthernet(
return list.front();
}
-void NetworkStateHandler::SetLastErrorForTest(const std::string& service_path,
- const std::string& error) {
- NetworkState* network_state = GetModifiableNetworkState(service_path);
- if (!network_state) {
- LOG(ERROR) << "No matching NetworkState for: " << service_path;
- return;
- }
- network_state->last_error_ = error;
-}
-
//------------------------------------------------------------------------------
// ShillPropertyHandler::Delegate overrides
diff --git a/chromeos/network/network_state_handler.h b/chromeos/network/network_state_handler.h
index f032f77..135d225 100644
--- a/chromeos/network/network_state_handler.h
+++ b/chromeos/network/network_state_handler.h
@@ -224,10 +224,6 @@ class CHROMEOS_EXPORT NetworkStateHandler
return default_network_path_;
}
- // Sets the |last_error_| property of the matching NetworkState for tests.
- void SetLastErrorForTest(const std::string& service_path,
- const std::string& error);
-
// Constructs and initializes an instance for testing.
static NetworkStateHandler* InitializeForTest();
diff --git a/chromeos/network/network_util.cc b/chromeos/network/network_util.cc
index 5fa7de5..b5d50b3 100644
--- a/chromeos/network/network_util.cc
+++ b/chromeos/network/network_util.cc
@@ -179,7 +179,7 @@ scoped_ptr<base::DictionaryValue> TranslateNetworkStateToONC(
scoped_ptr<base::DictionaryValue> onc_dictionary =
TranslateShillServiceToONCPart(*shill_dictionary, onc_source,
- &onc::kNetworkWithStateSignature, network);
+ &onc::kNetworkWithStateSignature);
return onc_dictionary.Pass();
}
diff --git a/chromeos/network/onc/onc_translation_tables.cc b/chromeos/network/onc/onc_translation_tables.cc
index ad7eef8..285a7e1 100644
--- a/chromeos/network/onc/onc_translation_tables.cc
+++ b/chromeos/network/onc/onc_translation_tables.cc
@@ -187,23 +187,24 @@ const FieldTranslationEntry cellular_fields[] = {
const FieldTranslationEntry network_fields[] = {
{::onc::network_config::kGUID, shill::kGuidProperty},
{::onc::network_config::kConnectable, shill::kConnectableProperty},
+ {::onc::network_config::kErrorState, shill::kErrorProperty},
{::onc::network_config::kPriority, shill::kPriorityProperty},
// Shill doesn't allow setting the name for non-VPN networks.
// Name is conditionally translated, see onc_translator_*.
- // {::onc::network_config::kName, shill::kNameProperty },
+ // { ::onc::network_config::kName, shill::kNameProperty },
// Type is converted during translation, see onc_translator_*.
- // {::onc::network_config::kType, shill::kTypeProperty },
+ // { ::onc::network_config::kType, shill::kTypeProperty },
// These fields are converted during translation, see
// onc_translator_shill_to_onc.cc. They are only converted when going from
// Shill->ONC, and ignored otherwise.
- // {::onc::network_config::kConnectionState, shill::kStateProperty },
- // {::onc::network_config::kErrorState, shill::kErrorProperty},
- // {::onc::network_config::kRestrictedConnectivity, shill::kStateProperty },
- // {::onc::network_config::kSource, shill::kProfileProperty },
- // {::onc::network_config::kMacAddress, shill::kAddressProperty },
+ // { ::onc::network_config::kConnectionState, shill::kStateProperty },
+ // { ::onc::network_config::kRestrictedConnectivity,
+ // shill::kStateProperty },
+ // { ::onc::network_config::kSource, shill::kProfileProperty },
+ // { ::onc::network_config::kMacAddress, shill::kAddressProperty },
{NULL}};
const FieldTranslationEntry ipconfig_fields[] = {
diff --git a/chromeos/network/onc/onc_translator.h b/chromeos/network/onc/onc_translator.h
index db1cb71..dc5afa3 100644
--- a/chromeos/network/onc/onc_translator.h
+++ b/chromeos/network/onc/onc_translator.h
@@ -14,9 +14,6 @@ class DictionaryValue;
}
namespace chromeos {
-
-class NetworkState;
-
namespace onc {
struct OncValueSignature;
@@ -42,15 +39,12 @@ scoped_ptr<base::DictionaryValue> TranslateONCObjectToShill(
// only a subset of it and includes only the values that are actually required
// by the UI. If |onc_source| != ONC_SOURCE_UNKNOWN then the 'Source' property
// of the ONC dictionary will be set accordingly. Note: ONC_SOURCE_USER_IMPORT
-// is treated the same as ONC_SOURCE_NONE. If |network_state| is provided it
-// will be used to set the ErrorState property. Otherwise ErrorState will not
-// be set.
+// is treated the same as ONC_SOURCE_NONE.
CHROMEOS_EXPORT
scoped_ptr<base::DictionaryValue> TranslateShillServiceToONCPart(
const base::DictionaryValue& shill_dictionary,
::onc::ONCSource onc_source,
- const OncValueSignature* onc_signature,
- const NetworkState* network_state);
+ const OncValueSignature* onc_signature);
} // namespace onc
} // namespace chromeos
diff --git a/chromeos/network/onc/onc_translator_shill_to_onc.cc b/chromeos/network/onc/onc_translator_shill_to_onc.cc
index aca9133..d918156 100644
--- a/chromeos/network/onc/onc_translator_shill_to_onc.cc
+++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc
@@ -52,25 +52,21 @@ class ShillToONCTranslator {
public:
ShillToONCTranslator(const base::DictionaryValue& shill_dictionary,
::onc::ONCSource onc_source,
- const OncValueSignature& onc_signature,
- const NetworkState* network_state)
+ const OncValueSignature& onc_signature)
: shill_dictionary_(&shill_dictionary),
onc_source_(onc_source),
- onc_signature_(&onc_signature),
- network_state_(network_state) {
+ onc_signature_(&onc_signature) {
field_translation_table_ = GetFieldTranslationTable(onc_signature);
}
ShillToONCTranslator(const base::DictionaryValue& shill_dictionary,
::onc::ONCSource onc_source,
const OncValueSignature& onc_signature,
- const FieldTranslationEntry* field_translation_table,
- const NetworkState* network_state)
+ const FieldTranslationEntry* field_translation_table)
: shill_dictionary_(&shill_dictionary),
onc_source_(onc_source),
onc_signature_(&onc_signature),
- field_translation_table_(field_translation_table),
- network_state_(network_state) {}
+ field_translation_table_(field_translation_table) {}
// Translates the associated Shill dictionary and creates an ONC object of the
// given signature.
@@ -146,7 +142,6 @@ class ShillToONCTranslator {
const OncValueSignature* onc_signature_;
const FieldTranslationEntry* field_translation_table_;
scoped_ptr<base::DictionaryValue> onc_object_;
- const NetworkState* network_state_;
DISALLOW_COPY_AND_ASSIGN(ShillToONCTranslator);
};
@@ -387,9 +382,9 @@ void ShillToONCTranslator::TranslateCellularWithState() {
if (device_dictionary) {
// Merge the Device dictionary with this one (Cellular) using the
// CellularDevice signature.
- ShillToONCTranslator nested_translator(
- *device_dictionary, onc_source_, kCellularWithStateSignature,
- kCellularDeviceTable, network_state_);
+ ShillToONCTranslator nested_translator(*device_dictionary, onc_source_,
+ kCellularWithStateSignature,
+ kCellularDeviceTable);
scoped_ptr<base::DictionaryValue> nested_object =
nested_translator.CreateTranslatedONCObject();
onc_object_->MergeDictionary(nested_object.get());
@@ -479,17 +474,6 @@ void ShillToONCTranslator::TranslateNetworkWithState() {
}
}
- // 'ErrorState' reflects the most recent error maintained in NetworkState
- // (which may not match Shill's Error or PreviousError properties). Non
- // visible networks (with null network_state_) do not set ErrorState.
- if (network_state_) {
- std::string error_state = network_state_->GetErrorState();
- if (!error_state.empty()) {
- onc_object_->SetStringWithoutPathExpansion(
- ::onc::network_config::kErrorState, error_state);
- }
- }
-
std::string profile_path;
if (onc_source_ != ::onc::ONC_SOURCE_UNKNOWN &&
shill_dictionary_->GetStringWithoutPathExpansion(shill::kProfileProperty,
@@ -617,8 +601,7 @@ void ShillToONCTranslator::TranslateAndAddNestedObject(
return;
}
ShillToONCTranslator nested_translator(dictionary, onc_source_,
- *field_signature->value_signature,
- network_state_);
+ *field_signature->value_signature);
scoped_ptr<base::DictionaryValue> nested_object =
nested_translator.CreateTranslatedONCObject();
if (nested_object->empty())
@@ -659,8 +642,7 @@ void ShillToONCTranslator::TranslateAndAddListOfObjects(
continue;
ShillToONCTranslator nested_translator(
*shill_value, onc_source_,
- *field_signature->value_signature->onc_array_entry_signature,
- network_state_);
+ *field_signature->value_signature->onc_array_entry_signature);
scoped_ptr<base::DictionaryValue> nested_object =
nested_translator.CreateTranslatedONCObject();
// If the nested object couldn't be parsed, simply omit it.
@@ -746,12 +728,10 @@ std::string ShillToONCTranslator::GetName() {
scoped_ptr<base::DictionaryValue> TranslateShillServiceToONCPart(
const base::DictionaryValue& shill_dictionary,
::onc::ONCSource onc_source,
- const OncValueSignature* onc_signature,
- const NetworkState* network_state) {
+ const OncValueSignature* onc_signature) {
CHECK(onc_signature != NULL);
- ShillToONCTranslator translator(shill_dictionary, onc_source, *onc_signature,
- network_state);
+ ShillToONCTranslator translator(shill_dictionary, onc_source, *onc_signature);
return translator.CreateTranslatedONCObject();
}
diff --git a/chromeos/network/onc/onc_translator_unittest.cc b/chromeos/network/onc/onc_translator_unittest.cc
index 45701c6..f637761 100644
--- a/chromeos/network/onc/onc_translator_unittest.cc
+++ b/chromeos/network/onc/onc_translator_unittest.cc
@@ -83,8 +83,7 @@ TEST_P(ONCTranslatorShillToOncTest, Translate) {
test_utils::ReadTestDictionary(result_onc_filename));
scoped_ptr<base::DictionaryValue> translation(TranslateShillServiceToONCPart(
- *shill_network, ::onc::ONC_SOURCE_NONE, &kNetworkWithStateSignature,
- nullptr /* network_state */));
+ *shill_network, ::onc::ONC_SOURCE_NONE, &kNetworkWithStateSignature));
EXPECT_TRUE(test_utils::Equals(expected_onc_network.get(),
translation.get()));
diff --git a/chromeos/network/policy_applicator.cc b/chromeos/network/policy_applicator.cc
index a5dd9ff..53ff817 100644
--- a/chromeos/network/policy_applicator.cc
+++ b/chromeos/network/policy_applicator.cc
@@ -131,9 +131,9 @@ void PolicyApplicator::GetEntryCallback(
<< profile_.ToDebugString();
scoped_ptr<base::DictionaryValue> onc_part(
- onc::TranslateShillServiceToONCPart(
- entry_properties, ::onc::ONC_SOURCE_UNKNOWN,
- &onc::kNetworkWithStateSignature, nullptr /* network_state */));
+ onc::TranslateShillServiceToONCPart(entry_properties,
+ ::onc::ONC_SOURCE_UNKNOWN,
+ &onc::kNetworkWithStateSignature));
std::string old_guid;
if (!onc_part->GetStringWithoutPathExpansion(::onc::network_config::kGUID,
diff --git a/components/device_event_log/device_event_log_impl.cc b/components/device_event_log/device_event_log_impl.cc
index 49cdbd3..3d7b886 100644
--- a/components/device_event_log/device_event_log_impl.cc
+++ b/components/device_event_log/device_event_log_impl.cc
@@ -157,7 +157,7 @@ void SendLogEntryToVLogOrErrorLog(
const bool show_time = true;
const bool show_file = true;
const bool show_type = true;
- const bool show_level = log_entry.log_level != LOG_LEVEL_ERROR;
+ const bool show_level = false;
const bool format_html = false;
std::string output = LogEntryToString(log_entry, show_time, show_file,
show_type, show_level, format_html);
diff --git a/components/onc/docs/onc_spec.html b/components/onc/docs/onc_spec.html
index e0fcb48..5f001fc 100644
--- a/components/onc/docs/onc_spec.html
+++ b/components/onc/docs/onc_spec.html
@@ -456,10 +456,10 @@
(optional, read-only)
<span class="type">string</span>
</span>
- The current error state for this network, if any. Error states are
- provided by the system and are not explicitly defined here. They may or
- may not be human-readable. This field will be empty or absent if the
- network is not in an error state.
+ The current error state for this network. Error states are provided by
+ the system and are not explicitly defined here. They may or may not be
+ human-readable. This field will be empty or absent if the network is not
+ in an error state.
</dd>
<dt class="field">MacAddress</dt>
@@ -720,10 +720,7 @@
</span>
Describes the passphrase for WEP/WPA/WPA2
connections. If <span class="value">WEP-PSK</span> is used, the passphrase
- must be of the format 0x&lt;
-hex - number& gt;
-, where& lt;
-hex - number& gt; is
+ must be of the format 0x&lt;hex-number&gt;, where &lt;hex-number&gt; is
40, 104, 128, or 232 bits.
</dd>
diff --git a/ui/chromeos/network/network_connect.cc b/ui/chromeos/network/network_connect.cc
index e492f12..380a6db 100644
--- a/ui/chromeos/network/network_connect.cc
+++ b/ui/chromeos/network/network_connect.cc
@@ -207,6 +207,20 @@ void NetworkConnectImpl::OnConnectFailed(
scoped_ptr<base::DictionaryValue> error_data) {
NET_LOG_ERROR("Connect Failed: " + error_name, service_path);
+ // If a new connect attempt canceled this connect, or a connect attempt to
+ // the same network is in progress, no need to notify the user here since they
+ // will be notified when the new or existing attempt completes.
+ if (error_name == NetworkConnectionHandler::kErrorConnectCanceled ||
+ error_name == NetworkConnectionHandler::kErrorConnecting) {
+ return;
+ }
+
+ // Already connected to the network, show the settings UI for the network.
+ if (error_name == NetworkConnectionHandler::kErrorConnected) {
+ ShowNetworkSettingsForPath(service_path);
+ return;
+ }
+
if (error_name == NetworkConnectionHandler::kErrorBadPassphrase ||
error_name == NetworkConnectionHandler::kErrorPassphraseRequired ||
error_name == NetworkConnectionHandler::kErrorConfigurationRequired ||
@@ -233,6 +247,7 @@ void NetworkConnectImpl::OnConnectFailed(
void NetworkConnectImpl::OnConnectSucceeded(const std::string& service_path) {
NET_LOG_USER("Connect Succeeded", service_path);
+ network_state_notifier_->RemoveConnectNotification();
}
// If |check_error_state| is true, error state for the network is checked,
@@ -240,6 +255,7 @@ void NetworkConnectImpl::OnConnectSucceeded(const std::string& service_path) {
// networks or repeat connect attempts).
void NetworkConnectImpl::CallConnectToNetwork(const std::string& service_path,
bool check_error_state) {
+ network_state_notifier_->RemoveConnectNotification();
NetworkHandler::Get()->network_connection_handler()->ConnectToNetwork(
service_path, base::Bind(&NetworkConnectImpl::OnConnectSucceeded,
weak_factory_.GetWeakPtr(), service_path),
diff --git a/ui/chromeos/network/network_state_notifier.cc b/ui/chromeos/network/network_state_notifier.cc
index 3bcbb67..fbb02d1 100644
--- a/ui/chromeos/network/network_state_notifier.cc
+++ b/ui/chromeos/network/network_state_notifier.cc
@@ -118,15 +118,6 @@ NetworkStateNotifier::~NetworkStateNotifier() {
NetworkHandler::Get()->network_connection_handler()->RemoveObserver(this);
}
-void NetworkStateNotifier::ConnectToNetworkRequested(
- const std::string& service_path) {
- RemoveConnectNotification();
-}
-
-void NetworkStateNotifier::ConnectSucceeded(const std::string& service_path) {
- RemoveConnectNotification();
-}
-
void NetworkStateNotifier::ConnectFailed(const std::string& service_path,
const std::string& error_name) {
// Only show a notification for certain errors. Other failures are expected
diff --git a/ui/chromeos/network/network_state_notifier.h b/ui/chromeos/network/network_state_notifier.h
index 3f5efd0..85741ea 100644
--- a/ui/chromeos/network/network_state_notifier.h
+++ b/ui/chromeos/network/network_state_notifier.h
@@ -45,8 +45,6 @@ class UI_CHROMEOS_EXPORT NetworkStateNotifier
~NetworkStateNotifier() override;
// NetworkConnectionObserver
- void ConnectToNetworkRequested(const std::string& service_path) override;
- void ConnectSucceeded(const std::string& service_path) override;
void ConnectFailed(const std::string& service_path,
const std::string& error_name) override;
void DiconnectRequested(const std::string& service_path) override;
@@ -67,6 +65,9 @@ class UI_CHROMEOS_EXPORT NetworkStateNotifier
// Show a mobile activation error notification.
void ShowMobileActivationError(const std::string& service_path);
+ // Removes any existing connect notifications.
+ void RemoveConnectNotification();
+
static const char kNotifierNetwork[];
static const char kNotifierNetworkError[];
static const char kNetworkConnectNotificationId[];
@@ -89,9 +90,6 @@ class UI_CHROMEOS_EXPORT NetworkStateNotifier
const base::DictionaryValue& shill_properties);
void ShowVpnDisconnectedNotification(const chromeos::NetworkState* vpn);
- // Removes any existing connect notifications.
- void RemoveConnectNotification();
-
// Returns true if the default network changed.
bool UpdateDefaultNetwork(const chromeos::NetworkState* network);