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

Side by Side Diff: chrome/browser/storage_monitor/storage_monitor_mac.mm

Issue 12544005: Consolidate storage_monitor/MediaDeviceNotificationsUtils into MediaStorageUtil. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mac apply patch Created 7 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 (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/mac_util.h" 7 #include "base/mac/mac_util.h"
8 #include "chrome/browser/storage_monitor/image_capture_device_manager.h" 8 #include "chrome/browser/storage_monitor/image_capture_device_manager.h"
9 #include "chrome/browser/storage_monitor/media_device_notifications_utils.h" 9 #include "chrome/browser/storage_monitor/media_storage_util.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 11
12 namespace chrome { 12 namespace chrome {
13 13
14 namespace { 14 namespace {
15 15
16 const char kDiskImageModelName[] = "Disk Image"; 16 const char kDiskImageModelName[] = "Disk Image";
17 17
18 // TODO(gbillock): Make these take weak pointers and don't have 18 // TODO(gbillock): Make these take weak pointers and don't have
19 // RemovableDeviceNotificationsMac be ref counted. 19 // RemovableDeviceNotificationsMac be ref counted.
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 147
148 if (update_type == UPDATE_DEVICE_REMOVED) { 148 if (update_type == UPDATE_DEVICE_REMOVED) {
149 if (it != disk_info_map_.end()) 149 if (it != disk_info_map_.end())
150 disk_info_map_.erase(it); 150 disk_info_map_.erase(it);
151 } else { 151 } else {
152 disk_info_map_[info.bsd_name()] = info; 152 disk_info_map_[info.bsd_name()] = info;
153 MediaStorageUtil::RecordDeviceInfoHistogram(true, info.device_id(), 153 MediaStorageUtil::RecordDeviceInfoHistogram(true, info.device_id(),
154 info.device_name()); 154 info.device_name());
155 if (ShouldPostNotificationForDisk(info)) { 155 if (ShouldPostNotificationForDisk(info)) {
156 string16 display_name = GetDisplayNameForDevice( 156 string16 display_name = MediaStorageUtil::GetDisplayNameForDevice(
157 info.total_size_in_bytes(), info.device_name()); 157 info.total_size_in_bytes(), info.device_name());
158 receiver()->ProcessAttach(StorageInfo( 158 receiver()->ProcessAttach(StorageInfo(
159 info.device_id(), display_name, info.mount_point().value())); 159 info.device_id(), display_name, info.mount_point().value()));
160 } 160 }
161 } 161 }
162 } 162 }
163 163
164 bool StorageMonitorMac::GetStorageInfoForPath(const base::FilePath& path, 164 bool StorageMonitorMac::GetStorageInfoForPath(const base::FilePath& path,
165 StorageInfo* device_info) const { 165 StorageInfo* device_info) const {
166 if (!path.IsAbsolute()) 166 if (!path.IsAbsolute())
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 it = disk_info_map_.begin(); it != disk_info_map_.end(); ++it) { 270 it = disk_info_map_.begin(); it != disk_info_map_.end(); ++it) {
271 if (it->second.mount_point() == mount_point) { 271 if (it->second.mount_point() == mount_point) {
272 *info = it->second; 272 *info = it->second;
273 return true; 273 return true;
274 } 274 }
275 } 275 }
276 return false; 276 return false;
277 } 277 }
278 278
279 } // namespace chrome 279 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698