Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Unified Diff: chrome/browser/media_galleries/media_galleries_preferences.cc

Issue 120303003: [StorageMonitor] Move gallery name generation to StorageInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media_galleries/media_galleries_preferences.cc
diff --git a/chrome/browser/media_galleries/media_galleries_preferences.cc b/chrome/browser/media_galleries/media_galleries_preferences.cc
index fffa94a874194523aab009769d56f9a3f913c5c9..fea3c222baa67dd5f367fb0a8db499bba5c136c9 100644
--- a/chrome/browser/media_galleries/media_galleries_preferences.cc
+++ b/chrome/browser/media_galleries/media_galleries_preferences.cc
@@ -245,40 +245,6 @@ bool GetMediaGalleryPermissionFromDictionary(
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()
@@ -297,47 +263,6 @@ base::FilePath MediaGalleryPrefInfo::AbsolutePath() const {
return base_path.empty() ? base_path : base_path.Append(path);
}
-string16 MediaGalleryPrefInfo::GetGalleryDisplayName() const {
- if (!StorageInfo::IsRemovableDevice(device_id)) {
- // For fixed storage, the default name is the fully qualified directory
- // name, or in the case of a root directory, the root directory name.
- // Exception: ChromeOS -- the full pathname isn't visible there, so only
- // the directory name is used.
- base::FilePath path = AbsolutePath();
- if (!display_name.empty())
- return display_name;
-
-#if defined(OS_CHROMEOS)
- // See chrome/browser/chromeos/fileapi/file_system_backend.cc
- base::FilePath home_path;
- if (PathService::Get(base::DIR_HOME, &home_path)) {
- home_path = home_path.AppendASCII("Downloads");
- base::FilePath relative;
- if (home_path.AppendRelativePath(path, &relative))
- return relative.LossyDisplayName();
- }
- return path.BaseName().LossyDisplayName();
-#else
- return path.LossyDisplayName();
-#endif
- }
-
- 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;
-}
-
string16 MediaGalleryPrefInfo::GetGalleryTooltip() const {
return AbsolutePath().LossyDisplayName();
}

Powered by Google App Engine
This is Rietveld 408576698