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

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

Issue 15988011: Refine StorageMonitor storage device getter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix SystemInfoStorageApiTest failures in browser_tests Created 7 years, 6 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
« no previous file with comments | « chrome/browser/storage_monitor/storage_monitor_win_unittest.cc ('k') | no next file » | 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/storage_monitor/volume_mount_watcher_win.h" 5 #include "chrome/browser/storage_monitor/volume_mount_watcher_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <dbt.h> 9 #include <dbt.h>
10 #include <fileapi.h> 10 #include <fileapi.h>
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 483
484 void VolumeMountWatcherWin::HandleDeviceAttachEventOnUIThread( 484 void VolumeMountWatcherWin::HandleDeviceAttachEventOnUIThread(
485 const base::FilePath& device_path, 485 const base::FilePath& device_path,
486 const StorageInfo& info) { 486 const StorageInfo& info) {
487 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 487 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
488 488
489 device_metadata_[device_path.value()] = info; 489 device_metadata_[device_path.value()] = info;
490 490
491 DeviceCheckComplete(device_path); 491 DeviceCheckComplete(device_path);
492 492
493 // Don't call removable storage observers for fixed volumes.
494 if (!StorageInfo::IsRemovableDevice(info.device_id()))
495 return;
496
497 if (notifications_) 493 if (notifications_)
498 notifications_->ProcessAttach(info); 494 notifications_->ProcessAttach(info);
499 } 495 }
500 496
501 void VolumeMountWatcherWin::HandleDeviceDetachEventOnUIThread( 497 void VolumeMountWatcherWin::HandleDeviceDetachEventOnUIThread(
502 const base::string16& device_location) { 498 const base::string16& device_location) {
503 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 499 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
504 500
505 MountPointDeviceMetadataMap::const_iterator device_info = 501 MountPointDeviceMetadataMap::const_iterator device_info =
506 device_metadata_.find(device_location); 502 device_metadata_.find(device_location);
(...skipping 19 matching lines...) Expand all
526 callback.Run(StorageMonitor::EJECT_FAILURE); 522 callback.Run(StorageMonitor::EJECT_FAILURE);
527 return; 523 return;
528 } 524 }
529 525
530 task_runner_->PostTask( 526 task_runner_->PostTask(
531 FROM_HERE, 527 FROM_HERE,
532 base::Bind(&EjectDeviceInThreadPool, device, callback, task_runner_, 0)); 528 base::Bind(&EjectDeviceInThreadPool, device, callback, task_runner_, 0));
533 } 529 }
534 530
535 } // namespace chrome 531 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/storage_monitor/storage_monitor_win_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698