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

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

Issue 15896007: [SystemInfo API] Rewrite storage info provider using storage monitor impl (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix comments from thestig 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
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 const std::string& storage_device_id, 127 const std::string& storage_device_id,
128 string16* device_location, 128 string16* device_location,
129 string16* storage_object_id) const { 129 string16* storage_object_id) const {
130 StorageInfo::Type type; 130 StorageInfo::Type type;
131 StorageInfo::CrackDeviceId(storage_device_id, &type, NULL); 131 StorageInfo::CrackDeviceId(storage_device_id, &type, NULL);
132 return ((type == StorageInfo::MTP_OR_PTP) && 132 return ((type == StorageInfo::MTP_OR_PTP) &&
133 portable_device_watcher_->GetMTPStorageInfoFromDeviceId( 133 portable_device_watcher_->GetMTPStorageInfoFromDeviceId(
134 storage_device_id, device_location, storage_object_id)); 134 storage_device_id, device_location, storage_object_id));
135 } 135 }
136 136
137 std::vector<StorageInfo> StorageMonitorWin::GetAllAvailableStorages() const {
138 std::vector<StorageInfo> results;
139 if (volume_mount_watcher_.get())
140 results = volume_mount_watcher_->GetAllVolumeStorages();
141 return results;
142 }
143
137 // static 144 // static
138 LRESULT CALLBACK StorageMonitorWin::WndProcThunk(HWND hwnd, UINT message, 145 LRESULT CALLBACK StorageMonitorWin::WndProcThunk(HWND hwnd, UINT message,
139 WPARAM wparam, LPARAM lparam) { 146 WPARAM wparam, LPARAM lparam) {
140 StorageMonitorWin* msg_wnd = reinterpret_cast<StorageMonitorWin*>( 147 StorageMonitorWin* msg_wnd = reinterpret_cast<StorageMonitorWin*>(
141 GetWindowLongPtr(hwnd, GWLP_USERDATA)); 148 GetWindowLongPtr(hwnd, GWLP_USERDATA));
142 if (msg_wnd) 149 if (msg_wnd)
143 return msg_wnd->WndProc(hwnd, message, wparam, lparam); 150 return msg_wnd->WndProc(hwnd, message, wparam, lparam);
144 return ::DefWindowProc(hwnd, message, wparam, lparam); 151 return ::DefWindowProc(hwnd, message, wparam, lparam);
145 } 152 }
146 153
(...skipping 17 matching lines...) Expand all
164 // portable device as a media gallery. 171 // portable device as a media gallery.
165 return volume_mount_watcher_->GetDeviceInfo(device_path, info); 172 return volume_mount_watcher_->GetDeviceInfo(device_path, info);
166 } 173 }
167 174
168 void StorageMonitorWin::OnDeviceChange(UINT event_type, LPARAM data) { 175 void StorageMonitorWin::OnDeviceChange(UINT event_type, LPARAM data) {
169 volume_mount_watcher_->OnWindowMessage(event_type, data); 176 volume_mount_watcher_->OnWindowMessage(event_type, data);
170 portable_device_watcher_->OnWindowMessage(event_type, data); 177 portable_device_watcher_->OnWindowMessage(event_type, data);
171 } 178 }
172 179
173 } // namespace chrome 180 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698