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

Side by Side Diff: chrome/browser/system_monitor/volume_mount_watcher_win.cc

Issue 11573048: [Media Galleries] Move RemovableStorageInfo notifications to chrome namespace (part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Working on windows Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/system_monitor/volume_mount_watcher_win.h ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/system_monitor/volume_mount_watcher_win.h" 5 #include "chrome/browser/system_monitor/volume_mount_watcher_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <dbt.h> 8 #include <dbt.h>
9 #include <fileapi.h> 9 #include <fileapi.h>
10 10
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/system_monitor/media_device_notifications_utils.h" 15 #include "chrome/browser/system_monitor/media_device_notifications_utils.h"
16 #include "chrome/browser/system_monitor/media_storage_util.h" 16 #include "chrome/browser/system_monitor/media_storage_util.h"
17 #include "chrome/browser/system_monitor/removable_storage_notifications.h"
17 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
18 19
19 using base::SystemMonitor;
20 using content::BrowserThread; 20 using content::BrowserThread;
21 21
22 namespace { 22 namespace {
23 23
24 const DWORD kMaxPathBufLen = MAX_PATH + 1; 24 const DWORD kMaxPathBufLen = MAX_PATH + 1;
25 25
26 bool IsRemovable(const string16& mount_point) { 26 bool IsRemovable(const string16& mount_point) {
27 if (GetDriveType(mount_point.c_str()) != DRIVE_REMOVABLE) 27 if (GetDriveType(mount_point.c_str()) != DRIVE_REMOVABLE)
28 return false; 28 return false;
29 29
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 312 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
313 313
314 device_metadata_[device_path.value()] = info; 314 device_metadata_[device_path.value()] = info;
315 315
316 DeviceCheckComplete(device_path); 316 DeviceCheckComplete(device_path);
317 317
318 // Don't call removable storage observers for fixed volumes. 318 // Don't call removable storage observers for fixed volumes.
319 if (!info.removable) 319 if (!info.removable)
320 return; 320 return;
321 321
322 SystemMonitor* monitor = SystemMonitor::Get(); 322 RemovableStorageNotifications* notifications =
323 if (monitor) { 323 RemovableStorageNotifications::GetInstance();
324 if (notifications) {
324 string16 display_name = GetDisplayNameForDevice(0, info.name); 325 string16 display_name = GetDisplayNameForDevice(0, info.name);
325 monitor->ProcessRemovableStorageAttached(info.device_id, display_name, 326 notifications->ProcessAttach(info.device_id, display_name,
326 device_path.value()); 327 device_path.value());
327 } 328 }
328 } 329 }
329 330
330 void VolumeMountWatcherWin::HandleDeviceDetachEventOnUIThread( 331 void VolumeMountWatcherWin::HandleDeviceDetachEventOnUIThread(
331 const string16& device_location) { 332 const string16& device_location) {
332 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 333 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
333 334
334 MountPointDeviceMetadataMap::const_iterator device_info = 335 MountPointDeviceMetadataMap::const_iterator device_info =
335 device_metadata_.find(device_location); 336 device_metadata_.find(device_location);
336 // If the device isn't type removable (like a CD), it won't be there. 337 // If the device isn't type removable (like a CD), it won't be there.
337 if (device_info == device_metadata_.end()) 338 if (device_info == device_metadata_.end())
338 return; 339 return;
339 340
340 SystemMonitor* monitor = SystemMonitor::Get(); 341 RemovableStorageNotifications* notifications =
341 if (monitor) 342 RemovableStorageNotifications::GetInstance();
342 monitor->ProcessRemovableStorageDetached(device_info->second.device_id); 343 if (notifications)
344 notifications->ProcessDetach(device_info->second.device_id);
343 device_metadata_.erase(device_info); 345 device_metadata_.erase(device_info);
344 } 346 }
345 347
346 } // namespace chrome 348 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/system_monitor/volume_mount_watcher_win.h ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698