| Index: chrome/browser/media_galleries/media_galleries_preferences.cc
|
| ===================================================================
|
| --- chrome/browser/media_galleries/media_galleries_preferences.cc (revision 213035)
|
| +++ chrome/browser/media_galleries/media_galleries_preferences.cc (working copy)
|
| @@ -33,7 +33,6 @@
|
| #include "components/user_prefs/pref_registry_syncable.h"
|
| #include "grit/generated_resources.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| -#include "ui/base/text/bytes_formatting.h"
|
|
|
| using base::DictionaryValue;
|
| using base::ListValue;
|
| @@ -221,40 +220,6 @@
|
| return false;
|
| }
|
|
|
| -string16 GetDisplayNameForDevice(uint64 storage_size_in_bytes,
|
| - const string16& name) {
|
| - DCHECK(!name.empty());
|
| - return (storage_size_in_bytes == 0) ?
|
| - name : ui::FormatBytes(storage_size_in_bytes) + ASCIIToUTF16(" ") + name;
|
| -}
|
| -
|
| -// For a device with |device_name| and a relative path |sub_folder|, construct
|
| -// a display name. If |sub_folder| is empty, then just return |device_name|.
|
| -string16 GetDisplayNameForSubFolder(const string16& device_name,
|
| - const base::FilePath& sub_folder) {
|
| - if (sub_folder.empty())
|
| - return device_name;
|
| - return (sub_folder.BaseName().LossyDisplayName() +
|
| - ASCIIToUTF16(" - ") +
|
| - device_name);
|
| -}
|
| -
|
| -string16 GetFullProductName(const string16& vendor_name,
|
| - const string16& model_name) {
|
| - if (vendor_name.empty() && model_name.empty())
|
| - return string16();
|
| -
|
| - string16 product_name;
|
| - if (vendor_name.empty())
|
| - product_name = model_name;
|
| - else if (model_name.empty())
|
| - product_name = vendor_name;
|
| - else if (!vendor_name.empty() && !model_name.empty())
|
| - product_name = vendor_name + UTF8ToUTF16(", ") + model_name;
|
| -
|
| - return product_name;
|
| -}
|
| -
|
| } // namespace
|
|
|
| MediaGalleryPrefInfo::MediaGalleryPrefInfo()
|
| @@ -274,33 +239,9 @@
|
| }
|
|
|
| string16 MediaGalleryPrefInfo::GetGalleryDisplayName() const {
|
| - if (!StorageInfo::IsRemovableDevice(device_id)) {
|
| - // For fixed storage, the name is the directory name, or, in the case
|
| - // of a root directory, the root directory name.
|
| - // TODO(gbillock): Using only the BaseName can lead to ambiguity. The
|
| - // tooltip resolves it. Is that enough?
|
| - base::FilePath path = AbsolutePath();
|
| - if (!display_name.empty())
|
| - return display_name;
|
| - if (path == path.DirName())
|
| - return path.LossyDisplayName();
|
| - return path.BaseName().LossyDisplayName();
|
| - }
|
| -
|
| - string16 name = display_name;
|
| - if (name.empty())
|
| - name = volume_label;
|
| - if (name.empty())
|
| - name = GetFullProductName(vendor_name, model_name);
|
| - if (name.empty())
|
| - name = l10n_util::GetStringUTF16(IDS_MEDIA_GALLERIES_UNLABELED_DEVICE);
|
| -
|
| - name = GetDisplayNameForDevice(total_size_in_bytes, name);
|
| -
|
| - if (!path.empty())
|
| - name = GetDisplayNameForSubFolder(name, path);
|
| -
|
| - return name;
|
| + StorageInfo info(device_id, AbsolutePath().value(), volume_label,
|
| + vendor_name, model_name, total_size_in_bytes);
|
| + return info.GetDisplayNameWithOverride(display_name, true);
|
| }
|
|
|
| string16 MediaGalleryPrefInfo::GetGalleryTooltip() const {
|
| @@ -381,8 +322,8 @@
|
| base::FilePath relative_path;
|
| StorageInfo info;
|
| if (MediaStorageUtil::GetDeviceInfoFromPath(path, &info, &relative_path)) {
|
| - AddGalleryInternal(info.device_id(), info.name(), relative_path, false,
|
| - info.storage_label(), info.vendor_name(),
|
| + AddGalleryInternal(info.device_id(), base::string16(), relative_path,
|
| + false, info.storage_label(), info.vendor_name(),
|
| info.model_name(), info.total_size_in_bytes(),
|
| base::Time(), true, 2);
|
| }
|
|
|