[shill] Start cleaning up some of the naming confusion
We have, so far, not been tidy wrt our objects naming themselves,
for human-readable stuff, RPC-path stuff, etc.
This starts to clean up some of that confusion.
BUG=chromium-os:17744
TEST=unit tests
Change-Id: If4d7f61ba51e527984328a0ccdf4dec461b36074
Reviewed-on: http://gerrit.chromium.org/gerrit/4311
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
diff --git a/profile.cc b/profile.cc
index cf6fab7..ef5182b 100644
--- a/profile.cc
+++ b/profile.cc
@@ -31,13 +31,18 @@
Profile::Profile(ControlInterface *control_interface,
GLib *glib,
- Manager *manager)
+ Manager *manager,
+ const Identifier &name,
+ bool connect_to_rpc)
: manager_(manager),
- adaptor_(control_interface->CreateProfileAdaptor(this)),
+ name_(name),
storage_(glib) {
+ if (connect_to_rpc)
+ adaptor_.reset(control_interface->CreateProfileAdaptor(this));
+
// flimflam::kCheckPortalListProperty: Registered in DefaultProfile
// flimflam::kCountryProperty: Registered in DefaultProfile
- store_.RegisterConstString(flimflam::kNameProperty, &name_);
+ store_.RegisterConstString(flimflam::kNameProperty, &name_.identifier);
// flimflam::kOfflineModeProperty: Registered in DefaultProfile
// flimflam::kPortalURLProperty: Registered in DefaultProfile
@@ -45,13 +50,21 @@
HelpRegisterDerivedStrings(flimflam::kServicesProperty,
&Profile::EnumerateAvailableServices,
NULL);
- // HelpRegisterDerivedStrings(flimflam::kEntriesProperty,
- // &Profile::EnumerateEntries,
- // NULL);
+ HelpRegisterDerivedStrings(flimflam::kEntriesProperty,
+ &Profile::EnumerateEntries,
+ NULL);
}
Profile::~Profile() {}
+string Profile::GetFriendlyName() {
+ return (name_.user.empty() ? "" : name_.user + "/") + name_.identifier;
+}
+
+string Profile::GetRpcIdentifier() {
+ return adaptor_->GetRpcIdentifier();
+}
+
bool Profile::AdoptService(const ServiceRefPtr &service) {
if (ContainsKey(services_, service->UniqueName()))
return false;
@@ -137,11 +150,6 @@
return true;
}
-string Profile::GetRpcPath(const Identifier &identifier) {
- string user = identifier.user.empty() ? "" : identifier.user + "/";
- return "/profile/" + user + identifier.identifier;
-}
-
bool Profile::GetStoragePath(const Identifier &identifier, FilePath *path) {
FilePath dir(
identifier.user.empty() ?