gdata: Apply correct mount label when mounting archives in GData

Ben recently added support in cros-disks for an optional mount label.
(https://gerrit.chromium.org/gerrit/#change,21171)

Make use of this option to display a user-friendly file name for the
mounted archive, instead of the actual file name of the cache blob
"<resource_id>.<md5>.mounted".

BUG=chromium-os:28678
TEST=Tested mounting archives (both local and on gdata).


Review URL: http://codereview.chromium.org/10231010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134632 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chromeos/dbus/cros_disks_client.cc b/chromeos/dbus/cros_disks_client.cc
index b9c420f..693372d 100644
--- a/chromeos/dbus/cros_disks_client.cc
+++ b/chromeos/dbus/cros_disks_client.cc
@@ -6,6 +6,7 @@
 
 #include "base/bind.h"
 #include "base/stl_util.h"
+#include "base/stringprintf.h"
 #include "dbus/bus.h"
 #include "dbus/message.h"
 #include "dbus/object_path.h"
@@ -27,6 +28,8 @@
   "force",
 };
 
+const char kMountLabelOption[] = "mountlabel";
+
 // Checks if retrieved media type is in boundaries of DeviceMediaType.
 bool IsValidMediaType(uint32 type) {
   return type < static_cast<uint32>(cros_disks::DEVICE_MEDIA_NUM_VALUES);
@@ -114,6 +117,7 @@
   // CrosDisksClient override.
   virtual void Mount(const std::string& source_path,
                      const std::string& source_format,
+                     const std::string& mount_label,
                      MountType type,
                      const MountCallback& callback,
                      const ErrorCallback& error_callback) OVERRIDE {
@@ -125,6 +129,12 @@
     std::vector<std::string> mount_options(kDefaultMountOptions,
                                            kDefaultMountOptions +
                                            arraysize(kDefaultMountOptions));
+    if (!mount_label.empty()) {
+      std::string mount_label_option = base::StringPrintf("%s=%s",
+                                                          kMountLabelOption,
+                                                          mount_label.c_str());
+      mount_options.push_back(mount_label_option);
+    }
     writer.AppendArrayOfStrings(mount_options);
     proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
                        base::Bind(&CrosDisksClientImpl::OnMount,
@@ -377,6 +387,7 @@
 
   virtual void Mount(const std::string& source_path,
                      const std::string& source_format,
+                     const std::string& mount_label,
                      MountType type,
                      const MountCallback& callback,
                      const ErrorCallback& error_callback) OVERRIDE {}