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

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

Issue 23383009: [StorageMonitor] Handle EjectDevice call for MTP devices (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
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_win.h" 5 #include "chrome/browser/storage_monitor/storage_monitor_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
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 return true; 91 return true;
92 } 92 }
93 93
94 return GetDeviceInfo(path, device_info); 94 return GetDeviceInfo(path, device_info);
95 } 95 }
96 96
97 void StorageMonitorWin::EjectDevice( 97 void StorageMonitorWin::EjectDevice(
98 const std::string& device_id, 98 const std::string& device_id,
99 base::Callback<void(EjectStatus)> callback) { 99 base::Callback<void(EjectStatus)> callback) {
100 StorageInfo::Type type; 100 StorageInfo::Type type;
101
102 if (!StorageInfo::CrackDeviceId(device_id, &type, NULL)) { 101 if (!StorageInfo::CrackDeviceId(device_id, &type, NULL)) {
103 callback.Run(EJECT_FAILURE); 102 callback.Run(EJECT_FAILURE);
104 return; 103 return;
105 } 104 }
106 105
107 if (type == StorageInfo::MTP_OR_PTP) 106 if (type == StorageInfo::MTP_OR_PTP)
108 portable_device_watcher_->EjectDevice(device_id, callback); 107 portable_device_watcher_->EjectDevice(device_id, callback);
109 else if (StorageInfo::IsRemovableDevice(device_id)) 108 else if (StorageInfo::IsRemovableDevice(device_id))
110 volume_mount_watcher_->EjectDevice(device_id, callback); 109 volume_mount_watcher_->EjectDevice(device_id, callback);
111 else 110 else
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 volume_mount_watcher_->OnWindowMessage(event_type, data); 159 volume_mount_watcher_->OnWindowMessage(event_type, data);
161 portable_device_watcher_->OnWindowMessage(event_type, data); 160 portable_device_watcher_->OnWindowMessage(event_type, data);
162 } 161 }
163 162
164 StorageMonitor* StorageMonitor::Create() { 163 StorageMonitor* StorageMonitor::Create() {
165 return new StorageMonitorWin(new VolumeMountWatcherWin(), 164 return new StorageMonitorWin(new VolumeMountWatcherWin(),
166 new PortableDeviceWatcherWin()); 165 new PortableDeviceWatcherWin());
167 } 166 }
168 167
169 } // namespace chrome 168 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698