Commit 03dfc57b authored by kinaba@chromium.org's avatar kinaba@chromium.org

Use .volume_label property for notifying MTP volume labels.

Previously we've abused .volume_id for the purpose, but now we have a
dedicated field for the volume name.

Now the .volume_id field can be arbitrary human unreadable string,
but I'd like to keep it as in the current form since there's also no
other reason to make it cryptic.

BUG=none

Review URL: https://codereview.chromium.org/305053004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273826 0039d316-1c4b-4281-b951-d872f2087c98
parent a932d613
...@@ -729,9 +729,9 @@ void VolumeManager::OnRemovableStorageAttached( ...@@ -729,9 +729,9 @@ void VolumeManager::OnRemovableStorageAttached(
const std::string base_name = base::UTF16ToUTF8(info.model_name()); const std::string base_name = base::UTF16ToUTF8(info.model_name());
// Assign a fresh volume ID based on the volume name. // Assign a fresh volume ID based on the volume name.
std::string id = kMtpVolumeIdPrefix + base_name; std::string label = base_name;
for (int i = 2; mounted_volumes_.count(id); ++i) for (int i = 2; mounted_volumes_.count(kMtpVolumeIdPrefix + label); ++i)
id = kMtpVolumeIdPrefix + base_name + base::StringPrintf(" (%d)", i); label = base_name + base::StringPrintf(" (%d)", i);
bool result = bool result =
fileapi::ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( fileapi::ExternalMountPoints::GetSystemInstance()->RegisterFileSystem(
...@@ -750,7 +750,8 @@ void VolumeManager::OnRemovableStorageAttached( ...@@ -750,7 +750,8 @@ void VolumeManager::OnRemovableStorageAttached(
volume_info.mount_condition = chromeos::disks::MOUNT_CONDITION_NONE; volume_info.mount_condition = chromeos::disks::MOUNT_CONDITION_NONE;
volume_info.is_parent = true; volume_info.is_parent = true;
volume_info.is_read_only = true; volume_info.is_read_only = true;
volume_info.volume_id = id; volume_info.volume_id = kMtpVolumeIdPrefix + label;
volume_info.volume_label = label;
volume_info.source_path = path; volume_info.source_path = path;
volume_info.device_type = chromeos::DEVICE_TYPE_MOBILE; volume_info.device_type = chromeos::DEVICE_TYPE_MOBILE;
DoMountEvent(chromeos::MOUNT_ERROR_NONE, volume_info, false); DoMountEvent(chromeos::MOUNT_ERROR_NONE, volume_info, false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment