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

Side by Side Diff: chrome/browser/media_gallery/media_device_notifications_window_win.cc

Issue 10876093: Improve the device type constants. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 3 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/media_gallery/media_device_notifications_window_win.h" 5 #include "chrome/browser/media_gallery/media_device_notifications_window_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <dbt.h> 8 #include <dbt.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 DWORD unitmask = GetVolumeBitMaskFromBroadcastHeader(data); 97 DWORD unitmask = GetVolumeBitMaskFromBroadcastHeader(data);
98 for (int i = 0; unitmask; ++i, unitmask >>= 1) { 98 for (int i = 0; unitmask; ++i, unitmask >>= 1) {
99 if (unitmask & 0x01) { 99 if (unitmask & 0x01) {
100 FilePath::StringType drive(L"_:\\"); 100 FilePath::StringType drive(L"_:\\");
101 drive[0] = L'A' + i; 101 drive[0] = L'A' + i;
102 WCHAR volume_name[MAX_PATH + 1]; 102 WCHAR volume_name[MAX_PATH + 1];
103 if ((*volume_name_func_)(drive.c_str(), volume_name, MAX_PATH + 1)) { 103 if ((*volume_name_func_)(drive.c_str(), volume_name, MAX_PATH + 1)) {
104 // TODO(kmadhusu) We need to look up a real device id as well as 104 // TODO(kmadhusu) We need to look up a real device id as well as
105 // having a fall back for volume name. 105 // having a fall back for volume name.
106 std::string device_id = MediaStorageUtil::MakeDeviceId( 106 std::string device_id = MediaStorageUtil::MakeDeviceId(
107 MediaStorageUtil::USB_MASS_STORAGE_WITH_DCIM, 107 MediaStorageUtil::REMOVABLE_MASS_STORAGE_WITH_DCIM,
108 base::IntToString(i)); 108 base::IntToString(i));
109 BrowserThread::PostTask( 109 BrowserThread::PostTask(
110 BrowserThread::FILE, FROM_HERE, 110 BrowserThread::FILE, FROM_HERE,
111 base::Bind(&MediaDeviceNotificationsWindowWin:: 111 base::Bind(&MediaDeviceNotificationsWindowWin::
112 CheckDeviceTypeOnFileThread, this, device_id, 112 CheckDeviceTypeOnFileThread, this, device_id,
113 FilePath::StringType(volume_name), FilePath(drive))); 113 FilePath::StringType(volume_name), FilePath(drive)));
114 } 114 }
115 } 115 }
116 } 116 }
117 break; 117 break;
118 } 118 }
119 case DBT_DEVICEREMOVECOMPLETE: { 119 case DBT_DEVICEREMOVECOMPLETE: {
120 DWORD unitmask = GetVolumeBitMaskFromBroadcastHeader(data); 120 DWORD unitmask = GetVolumeBitMaskFromBroadcastHeader(data);
121 for (int i = 0; unitmask; ++i, unitmask >>= 1) { 121 for (int i = 0; unitmask; ++i, unitmask >>= 1) {
122 if (unitmask & 0x01) { 122 if (unitmask & 0x01) {
123 std::string device_id = MediaStorageUtil::MakeDeviceId( 123 std::string device_id = MediaStorageUtil::MakeDeviceId(
124 MediaStorageUtil::USB_MASS_STORAGE_WITH_DCIM, 124 MediaStorageUtil::REMOVABLE_MASS_STORAGE_WITH_DCIM,
125 base::IntToString(i)); 125 base::IntToString(i));
126 SystemMonitor::Get()->ProcessRemovableStorageDetached(device_id); 126 SystemMonitor::Get()->ProcessRemovableStorageDetached(device_id);
127 } 127 }
128 } 128 }
129 break; 129 break;
130 } 130 }
131 } 131 }
132 return TRUE; 132 return TRUE;
133 } 133 }
134 134
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 LPARAM lparam) { 180 LPARAM lparam) {
181 MediaDeviceNotificationsWindowWin* msg_wnd = 181 MediaDeviceNotificationsWindowWin* msg_wnd =
182 reinterpret_cast<MediaDeviceNotificationsWindowWin*>( 182 reinterpret_cast<MediaDeviceNotificationsWindowWin*>(
183 GetWindowLongPtr(hwnd, GWLP_USERDATA)); 183 GetWindowLongPtr(hwnd, GWLP_USERDATA));
184 if (msg_wnd) 184 if (msg_wnd)
185 return msg_wnd->WndProc(hwnd, message, wparam, lparam); 185 return msg_wnd->WndProc(hwnd, message, wparam, lparam);
186 return ::DefWindowProc(hwnd, message, wparam, lparam); 186 return ::DefWindowProc(hwnd, message, wparam, lparam);
187 } 187 }
188 188
189 } // namespace chrome 189 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698