| 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" |
| 11 #include "chrome/browser/storage_monitor/image_capture_device_manager.h" | 11 #include "chrome/browser/storage_monitor/image_capture_device_manager.h" |
| 12 #include "chrome/browser/storage_monitor/media_storage_util.h" | 12 #include "chrome/browser/storage_monitor/media_storage_util.h" |
| 13 #include "chrome/browser/storage_monitor/storage_info.h" | 13 #include "chrome/browser/storage_monitor/storage_info.h" |
| 14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 | 15 |
| 16 namespace chrome { | |
| 17 | |
| 18 namespace { | 16 namespace { |
| 19 | 17 |
| 20 const char kDiskImageModelName[] = "Disk Image"; | 18 const char kDiskImageModelName[] = "Disk Image"; |
| 21 | 19 |
| 22 string16 GetUTF16FromDictionary(CFDictionaryRef dictionary, CFStringRef key) { | 20 string16 GetUTF16FromDictionary(CFDictionaryRef dictionary, CFStringRef key) { |
| 23 CFStringRef value = | 21 CFStringRef value = |
| 24 base::mac::GetValueFromDictionary<CFStringRef>(dictionary, key); | 22 base::mac::GetValueFromDictionary<CFStringRef>(dictionary, key); |
| 25 if (!value) | 23 if (!value) |
| 26 return string16(); | 24 return string16(); |
| 27 return base::SysCFStringRefToUTF16(value); | 25 return base::SysCFStringRefToUTF16(value); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 session_, | 189 session_, |
| 192 kDADiskDescriptionMatchVolumeMountable, | 190 kDADiskDescriptionMatchVolumeMountable, |
| 193 kDADiskDescriptionWatchVolumePath, | 191 kDADiskDescriptionWatchVolumePath, |
| 194 DiskDescriptionChangedCallback, | 192 DiskDescriptionChangedCallback, |
| 195 this); | 193 this); |
| 196 | 194 |
| 197 DASessionScheduleWithRunLoop( | 195 DASessionScheduleWithRunLoop( |
| 198 session_, CFRunLoopGetCurrent(), kCFRunLoopCommonModes); | 196 session_, CFRunLoopGetCurrent(), kCFRunLoopCommonModes); |
| 199 | 197 |
| 200 if (base::mac::IsOSLionOrLater()) { | 198 if (base::mac::IsOSLionOrLater()) { |
| 201 image_capture_device_manager_.reset(new chrome::ImageCaptureDeviceManager); | 199 image_capture_device_manager_.reset(new ImageCaptureDeviceManager); |
| 202 image_capture_device_manager_->SetNotifications(receiver()); | 200 image_capture_device_manager_->SetNotifications(receiver()); |
| 203 } | 201 } |
| 204 } | 202 } |
| 205 | 203 |
| 206 void StorageMonitorMac::UpdateDisk( | 204 void StorageMonitorMac::UpdateDisk( |
| 207 const std::string& bsd_name, | 205 const std::string& bsd_name, |
| 208 const StorageInfo& info, | 206 const StorageInfo& info, |
| 209 UpdateType update_type) { | 207 UpdateType update_type) { |
| 210 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 208 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 211 | 209 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 *info = it->second; | 376 *info = it->second; |
| 379 return true; | 377 return true; |
| 380 } | 378 } |
| 381 } | 379 } |
| 382 return false; | 380 return false; |
| 383 } | 381 } |
| 384 | 382 |
| 385 StorageMonitor* StorageMonitor::Create() { | 383 StorageMonitor* StorageMonitor::Create() { |
| 386 return new StorageMonitorMac(); | 384 return new StorageMonitorMac(); |
| 387 } | 385 } |
| 388 | |
| 389 } // namespace chrome | |
| OLD | NEW |