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

Side by Side Diff: components/storage_monitor/storage_monitor_mac.mm

Issue 120303003: [StorageMonitor] Move gallery name generation to StorageInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address vandebo's comments Created 6 years, 9 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/storage_monitor/storage_monitor_mac.h" 5 #include "components/storage_monitor/storage_monitor_mac.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 base::mac::GetValueFromDictionary<CFBooleanRef>( 94 base::mac::GetValueFromDictionary<CFBooleanRef>(
95 dict, kDADiskDescriptionMediaRemovableKey); 95 dict, kDADiskDescriptionMediaRemovableKey);
96 bool is_removable = is_removable_ref && CFBooleanGetValue(is_removable_ref); 96 bool is_removable = is_removable_ref && CFBooleanGetValue(is_removable_ref);
97 // Checking for DCIM only matters on removable devices. 97 // Checking for DCIM only matters on removable devices.
98 bool has_dcim = is_removable && MediaStorageUtil::HasDcim(location); 98 bool has_dcim = is_removable && MediaStorageUtil::HasDcim(location);
99 StorageInfo::Type device_type = GetDeviceType(is_removable, has_dcim); 99 StorageInfo::Type device_type = GetDeviceType(is_removable, has_dcim);
100 std::string device_id; 100 std::string device_id;
101 if (!unique_id.empty()) 101 if (!unique_id.empty())
102 device_id = StorageInfo::MakeDeviceId(device_type, unique_id); 102 device_id = StorageInfo::MakeDeviceId(device_type, unique_id);
103 103
104 return StorageInfo(device_id, base::string16(), location.value(), label, 104 return StorageInfo(device_id, location.value(), label, vendor, model,
105 vendor, model, size_in_bytes); 105 size_in_bytes);
106 } 106 }
107 107
108 void GetDiskInfoAndUpdateOnFileThread( 108 void GetDiskInfoAndUpdateOnFileThread(
109 const base::WeakPtr<StorageMonitorMac>& monitor, 109 const base::WeakPtr<StorageMonitorMac>& monitor,
110 base::ScopedCFTypeRef<CFDictionaryRef> dict, 110 base::ScopedCFTypeRef<CFDictionaryRef> dict,
111 StorageMonitorMac::UpdateType update_type) { 111 StorageMonitorMac::UpdateType update_type) {
112 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 112 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
113 113
114 std::string bsd_name; 114 std::string bsd_name;
115 StorageInfo info = BuildStorageInfo(dict, &bsd_name); 115 StorageInfo info = BuildStorageInfo(dict, &bsd_name);
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 } 382 }
383 } 383 }
384 return false; 384 return false;
385 } 385 }
386 386
387 StorageMonitor* StorageMonitor::CreateInternal() { 387 StorageMonitor* StorageMonitor::CreateInternal() {
388 return new StorageMonitorMac(); 388 return new StorageMonitorMac();
389 } 389 }
390 390
391 } // namespace storage_monitor 391 } // namespace storage_monitor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698