Index: chrome/browser/system_monitor/media_device_notifications_utils.cc |
diff --git a/chrome/browser/system_monitor/media_device_notifications_utils.cc b/chrome/browser/system_monitor/media_device_notifications_utils.cc |
index 4054c2d17524c498bd4a3c4ec891aaa712d864d3..cc3d4a216b7a2594643a72b61f99f5255957fb63 100644 |
--- a/chrome/browser/system_monitor/media_device_notifications_utils.cc |
+++ b/chrome/browser/system_monitor/media_device_notifications_utils.cc |
@@ -6,8 +6,10 @@ |
#include "base/file_util.h" |
#include "base/string_util.h" |
+#include "base/utf_string_conversions.h" |
#include "chrome/browser/system_monitor/removable_device_constants.h" |
#include "content/public/browser/browser_thread.h" |
+#include "ui/base/text/bytes_formatting.h" |
namespace chrome { |
@@ -25,4 +27,26 @@ bool IsMediaDevice(const FilePath::StringType& mount_point) { |
return true; |
} |
+std::string GetFullProductName(const std::string& vendor_name, |
+ const std::string& model_name) { |
+ if (vendor_name.empty() && model_name.empty()) |
+ return std::string(); |
+ |
+ std::string product_name; |
+ if (vendor_name.empty()) |
+ product_name = model_name; |
+ else if (model_name.empty()) |
+ product_name = vendor_name; |
+ else |
+ product_name = vendor_name + ", " + model_name; |
+ return "(" + product_name + ")"; |
+} |
+ |
+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; |
+} |
+ |
} // namespace chrome |