shill: stop passing around format strings for profiles

Prior to this CL, shill passed around format strings, to specify
where the user profiles should be stored. While this makes things
more configurable, it also a) makes things more complex, and
b) causes g++ to emit warnings that some format strings can't be
checked statically.

The location of user profiles doesn't need the full power of
printf-format style configurability. We really only need the
ability to specify which directory the user profiles are
stored in.

Note that this changes requires updating some unit tests,
which actually did take advantage of the flexibility. In
particular, some of the Manager and Profile unit tests placed
user profiles directly in a user profile directory, rather
than creating a user-specific sub-directory first. Creating
the user-specific directories seems like the right thing to
do, since that it what the normal (non-test) code does.

BUG=chromium:293668
TEST=unit tests

Change-Id: Ic1afeec84a7797105c9a49b8261a9677e17d91ee
Reviewed-on: https://chromium-review.googlesource.com/197061
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
diff --git a/profile.cc b/profile.cc
index 1de8fe3..0ec0121 100644
--- a/profile.cc
+++ b/profile.cc
@@ -8,7 +8,6 @@
 #include <string>
 #include <vector>
 
-#include <base/files/file_path.h>
 #include <base/file_util.h>
 #include <base/stl_util.h>
 #include <base/strings/string_split.h>
@@ -41,12 +40,12 @@
                  Metrics *metrics,
                  Manager *manager,
                  const Identifier &name,
-                 const string &user_storage_format,
+                 const string &user_storage_directory,
                  bool connect_to_rpc)
     : metrics_(metrics),
       manager_(manager),
       name_(name),
-      storage_format_(user_storage_format) {
+      storage_path_(user_storage_directory) {
   if (connect_to_rpc)
     adaptor_.reset(control_interface->CreateProfileAdaptor(this));
 
@@ -343,10 +342,10 @@
     LOG(ERROR) << "Non-default profiles cannot be stored globally.";
     return false;
   }
-  FilePath dir(base::StringPrintf(storage_format_.c_str(), name_.user.c_str()));
   // TODO(petkov): Validate the directory permissions, etc.
-  *path = dir.Append(base::StringPrintf("%s.profile",
-                                        name_.identifier.c_str()));
+  *path = storage_path_.Append(
+      base::StringPrintf("%s/%s.profile", name_.user.c_str(),
+                         name_.identifier.c_str()));
   return true;
 }