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

Unified Diff: chrome/browser/system_monitor/media_storage_util.cc

Issue 11366144: [Media Gallery][ChromeOS] Improve device media gallery names. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments Created 8 years, 1 month 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/system_monitor/media_storage_util.cc
diff --git a/chrome/browser/system_monitor/media_storage_util.cc b/chrome/browser/system_monitor/media_storage_util.cc
index e7f39cdc5bd66f4605835222ed0ac442caed5a2d..3c7b15f60471f948fb0486c65fa3442799e4dbe8 100644
--- a/chrome/browser/system_monitor/media_storage_util.cc
+++ b/chrome/browser/system_monitor/media_storage_util.cc
@@ -14,6 +14,7 @@
#include "base/metrics/histogram.h"
#include "base/system_monitor/system_monitor.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/system_monitor/media_device_notifications_utils.h"
#include "content/public/browser/browser_thread.h"
#if defined(OS_CHROMEOS)
@@ -254,22 +255,31 @@ bool MediaStorageUtil::GetDeviceInfoFromPath(const FilePath& path,
#endif
if (found_device && IsRemovableDevice(device_info.device_id)) {
+ FilePath sub_folder_path;
Lei Zhang 2012/11/12 23:20:52 put this bit of new code below the |device_id| cod
kmadhusu 2012/11/13 01:03:58 Done.
+ if (device_name || relative_path) {
+ bool success = FilePath(device_info.location)
+ .AppendRelativePath(path, &sub_folder_path);
+ DCHECK(success);
+ }
+
if (device_id)
*device_id = device_info.device_id;
- if (device_name)
+
+ if (device_name) {
+#if defined(OS_CHROMEOS)
+ *device_name = GetDisplayNameForDevice(
+ notifier->GetStorageSize(device_info.location),
+ sub_folder_path.value().empty() ?
+ device_info.name :
+ sub_folder_path.BaseName().LossyDisplayName() +
+ ASCIIToUTF16(" - ") + device_info.name);
+#else
*device_name = device_info.name;
- if (relative_path) {
- *relative_path = FilePath();
- FilePath mount_point(device_info.location);
- bool success = mount_point.AppendRelativePath(path, relative_path);
-#if defined(OS_POSIX)
- if (!relative_path->value().empty() && device_name) {
- *device_name += ASCIIToUTF16(" (") +
- relative_path->BaseName().LossyDisplayName() + ASCIIToUTF16(")");
- }
#endif
- DCHECK(success);
}
+
+ if (relative_path)
+ *relative_path = sub_folder_path;
return true;
}

Powered by Google App Engine
This is Rietveld 408576698