Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7192)

Unified Diff: ash/system/chromeos/network/network_connect.cc

Issue 23712002: Cleanup network type matching. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Generalized network type matching. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/system/chromeos/network/network_connect.cc
diff --git a/ash/system/chromeos/network/network_connect.cc b/ash/system/chromeos/network/network_connect.cc
index 3002856f25c3002af961b850cbc7abc562dbb56e..8c802b137e75a70fd1b7af4e80f2d0286a50976d 100644
--- a/ash/system/chromeos/network/network_connect.cc
+++ b/ash/system/chromeos/network/network_connect.cc
@@ -24,6 +24,7 @@
#include "chromeos/network/network_profile_handler.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
+#include "chromeos/network/shill_property_util.h"
#include "grit/ash_resources.h"
#include "grit/ash_strings.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
@@ -40,6 +41,7 @@ using chromeos::NetworkProfile;
using chromeos::NetworkProfileHandler;
using chromeos::NetworkState;
using chromeos::NetworkStateHandler;
+using chromeos::NetworkTypePattern;
namespace ash {
@@ -281,10 +283,11 @@ void ConnectToNetwork(const std::string& service_path,
CallConnectToNetwork(service_path, check_error_state, owning_window);
}
-void SetTechnologyEnabled(const std::string& technology, bool enabled_state) {
+void SetTechnologyEnabled(const NetworkTypePattern& technology,
+ bool enabled_state) {
std::string log_string =
base::StringPrintf("technology %s, target state: %s",
- technology.c_str(),
+ technology.ToDebugString().c_str(),
(enabled_state ? "ENABLED" : "DISABLED"));
NET_LOG_USER("SetTechnologyEnabled", log_string);
NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler();
@@ -302,8 +305,7 @@ void SetTechnologyEnabled(const std::string& technology, bool enabled_state) {
// If we're dealing with a mobile network, then handle SIM lock here.
// SIM locking only applies to cellular, so the code below won't execute
// if |technology| has been explicitly set to WiMAX.
- if (technology == NetworkStateHandler::kMatchTypeMobile ||
- technology == flimflam::kTypeCellular) {
+ if (technology.Matches(flimflam::kTypeCellular)) {
stevenjb 2013/09/03 16:22:43 This should be technology.Matches(NetworkTypePatte
pneubeck (no reviews) 2013/09/04 12:57:29 Done.
const DeviceState* mobile = handler->GetDeviceStateByType(technology);
if (!mobile) {
NET_LOG_ERROR("SetTechnologyEnabled with no device", log_string);

Powered by Google App Engine
This is Rietveld 408576698