PM: Make the connection type an enum class.
This improves type safety and encapsulation, but otherwise a superficial
syntactic substitution.
BUG=None
TEST=Unit tests.
Change-Id: I0ec880833704227cf6277ff37e37b51f8a8c5ce7
Reviewed-on: https://chromium-review.googlesource.com/189852
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
diff --git a/policy_manager/real_shill_provider.h b/policy_manager/real_shill_provider.h
index ba24234..55125bc 100644
--- a/policy_manager/real_shill_provider.h
+++ b/policy_manager/real_shill_provider.h
@@ -43,7 +43,7 @@
// storing it to |*conn_type_p|. Returns |true| on success; |false| on
// failure, in which case no value is written.
bool GetConnectionType(const std::string& service_path,
- ShillConnType* conn_type_p);
+ ConnectionType* conn_type_p);
// Issues a GetProperties call to shill's manager interface, storing the
// result to |*result_p|. Returns |true| on success.
@@ -58,7 +58,7 @@
typedef struct {
const char *str;
- ShillConnType type;
+ ConnectionType type;
} ConnStrToType;
// A mapping from shill connection type strings to enum values.
@@ -80,7 +80,7 @@
DBusGProxy* GetProxy(const char* path, const char* interface);
// Converts a shill connection type string into a symbolic value.
- ShillConnType ParseConnType(const char* str);
+ ConnectionType ParseConnType(const char* str);
DISALLOW_COPY_AND_ASSIGN(ShillConnector);
};
@@ -115,7 +115,7 @@
std::string default_service_path_;
// The last known type of the default connection.
- ShillConnType conn_type_ = kShillConnTypeUnknown;
+ ConnectionType conn_type_ = ConnectionType::kUnknown;
// Whether the last known connection type is valid.
bool is_conn_type_valid_ = false;