| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/storage_monitor/storage_monitor_mac.h" | 5 #include "chrome/browser/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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 base::mac::GetValueFromDictionary<CFBooleanRef>( | 92 base::mac::GetValueFromDictionary<CFBooleanRef>( |
| 93 dict, kDADiskDescriptionMediaRemovableKey); | 93 dict, kDADiskDescriptionMediaRemovableKey); |
| 94 bool is_removable = is_removable_ref && CFBooleanGetValue(is_removable_ref); | 94 bool is_removable = is_removable_ref && CFBooleanGetValue(is_removable_ref); |
| 95 // Checking for DCIM only matters on removable devices. | 95 // Checking for DCIM only matters on removable devices. |
| 96 bool has_dcim = is_removable && MediaStorageUtil::HasDcim(location); | 96 bool has_dcim = is_removable && MediaStorageUtil::HasDcim(location); |
| 97 StorageInfo::Type device_type = GetDeviceType(is_removable, has_dcim); | 97 StorageInfo::Type device_type = GetDeviceType(is_removable, has_dcim); |
| 98 std::string device_id; | 98 std::string device_id; |
| 99 if (!unique_id.empty()) | 99 if (!unique_id.empty()) |
| 100 device_id = StorageInfo::MakeDeviceId(device_type, unique_id); | 100 device_id = StorageInfo::MakeDeviceId(device_type, unique_id); |
| 101 | 101 |
| 102 return StorageInfo(device_id, string16(), location.value(), label, vendor, | 102 return StorageInfo(device_id, location.value(), label, vendor, model, |
| 103 model, size_in_bytes); | 103 size_in_bytes); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void GetDiskInfoAndUpdateOnFileThread( | 106 void GetDiskInfoAndUpdateOnFileThread( |
| 107 const base::WeakPtr<StorageMonitorMac>& monitor, | 107 const base::WeakPtr<StorageMonitorMac>& monitor, |
| 108 base::ScopedCFTypeRef<CFDictionaryRef> dict, | 108 base::ScopedCFTypeRef<CFDictionaryRef> dict, |
| 109 StorageMonitorMac::UpdateType update_type) { | 109 StorageMonitorMac::UpdateType update_type) { |
| 110 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); | 110 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
| 111 | 111 |
| 112 std::string bsd_name; | 112 std::string bsd_name; |
| 113 StorageInfo info = BuildStorageInfo(dict, &bsd_name); | 113 StorageInfo info = BuildStorageInfo(dict, &bsd_name); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 } | 367 } |
| 368 } | 368 } |
| 369 return false; | 369 return false; |
| 370 } | 370 } |
| 371 | 371 |
| 372 StorageMonitor* StorageMonitor::Create() { | 372 StorageMonitor* StorageMonitor::Create() { |
| 373 return new StorageMonitorMac(); | 373 return new StorageMonitorMac(); |
| 374 } | 374 } |
| 375 | 375 |
| 376 } // namespace chrome | 376 } // namespace chrome |
| OLD | NEW |