Chromium Code Reviews| 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/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 346 } | 346 } |
| 347 | 347 |
| 348 | 348 |
| 349 bool StorageMonitorMac::ShouldPostNotificationForDisk( | 349 bool StorageMonitorMac::ShouldPostNotificationForDisk( |
| 350 const StorageInfo& info) const { | 350 const StorageInfo& info) const { |
| 351 // Only post notifications about disks that have no empty fields and | 351 // Only post notifications about disks that have no empty fields and |
| 352 // are removable. Also exclude disk images (DMGs). | 352 // are removable. Also exclude disk images (DMGs). |
| 353 return !info.device_id().empty() && | 353 return !info.device_id().empty() && |
| 354 !info.location().empty() && | 354 !info.location().empty() && |
| 355 info.model_name() != ASCIIToUTF16(kDiskImageModelName) && | 355 info.model_name() != ASCIIToUTF16(kDiskImageModelName) && |
| 356 StorageInfo::IsRemovableDevice(info.device_id()) && | |
|
Hongbo Min
2013/06/04 02:52:29
Why to remove it?
| |
| 357 StorageInfo::IsMassStorageDevice(info.device_id()); | 356 StorageInfo::IsMassStorageDevice(info.device_id()); |
| 358 } | 357 } |
| 359 | 358 |
| 360 bool StorageMonitorMac::FindDiskWithMountPoint( | 359 bool StorageMonitorMac::FindDiskWithMountPoint( |
| 361 const base::FilePath& mount_point, | 360 const base::FilePath& mount_point, |
| 362 StorageInfo* info) const { | 361 StorageInfo* info) const { |
| 363 for (std::map<std::string, StorageInfo>::const_iterator | 362 for (std::map<std::string, StorageInfo>::const_iterator |
| 364 it = disk_info_map_.begin(); it != disk_info_map_.end(); ++it) { | 363 it = disk_info_map_.begin(); it != disk_info_map_.end(); ++it) { |
| 365 if (it->second.location() == mount_point.value()) { | 364 if (it->second.location() == mount_point.value()) { |
| 366 *info = it->second; | 365 *info = it->second; |
| 367 return true; | 366 return true; |
| 368 } | 367 } |
| 369 } | 368 } |
| 370 return false; | 369 return false; |
| 371 } | 370 } |
| 372 | 371 |
| 373 } // namespace chrome | 372 } // namespace chrome |
| OLD | NEW |