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

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

Issue 11297002: [Media Gallery] Added code to support mtp device media file system on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed DCHECK, added lock in PortableDeviceWatcherWin and fixed tests. Created 8 years 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/system_monitor/removable_device_notifications_window_wi n.h" 5 #include "chrome/browser/system_monitor/removable_device_notifications_window_wi n.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/threading/sequenced_worker_pool.h"
11 #include "base/win/wrapped_window_proc.h" 12 #include "base/win/wrapped_window_proc.h"
12 #include "chrome/browser/system_monitor/media_storage_util.h" 13 #include "chrome/browser/system_monitor/media_storage_util.h"
13 #include "chrome/browser/system_monitor/portable_device_watcher_win.h" 14 #include "chrome/browser/system_monitor/portable_device_watcher_win.h"
14 #include "chrome/browser/system_monitor/removable_device_constants.h" 15 #include "chrome/browser/system_monitor/removable_device_constants.h"
15 #include "chrome/browser/system_monitor/volume_mount_watcher_win.h" 16 #include "chrome/browser/system_monitor/volume_mount_watcher_win.h"
17 #include "content/public/browser/browser_thread.h"
16 18
17 namespace chrome { 19 namespace chrome {
18 20
19 namespace { 21 namespace {
20 22
21 const char16 kWindowClassName[] = L"Chrome_RemovableDeviceNotificationWindow"; 23 const char16 kWindowClassName[] = L"Chrome_RemovableDeviceNotificationWindow";
22 24
23 RemovableDeviceNotificationsWindowWin* 25 RemovableDeviceNotificationsWindowWin*
24 g_removable_device_notifications_window_win = NULL; 26 g_removable_device_notifications_window_win = NULL;
25 27
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 127 }
126 return true; 128 return true;
127 } 129 }
128 130
129 uint64 RemovableDeviceNotificationsWindowWin::GetStorageSize( 131 uint64 RemovableDeviceNotificationsWindowWin::GetStorageSize(
130 const std::string& location) const { 132 const std::string& location) const {
131 NOTIMPLEMENTED(); 133 NOTIMPLEMENTED();
132 return 0ULL; 134 return 0ULL;
133 } 135 }
134 136
137 bool RemovableDeviceNotificationsWindowWin::GetMTPStorageInfoFromDeviceId(
138 const std::string& storage_device_id,
139 string16* device_location,
140 string16* storage_object_id) const {
141 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
Peter Kasting 2012/12/21 18:13:30 Doesn't the rest of this class run on the UI threa
kmadhusu 2013/01/02 19:48:31 I thought about this. There is a small chance of d
142 MediaStorageUtil::Type type;
143 MediaStorageUtil::CrackDeviceId(storage_device_id, &type, NULL);
144 return ((type == MediaStorageUtil::MTP_OR_PTP) &&
145 portable_device_watcher_->GetMTPStorageInfoFromDeviceId(
146 storage_device_id, device_location, storage_object_id));
147 }
148
135 // static 149 // static
136 LRESULT CALLBACK RemovableDeviceNotificationsWindowWin::WndProcThunk( 150 LRESULT CALLBACK RemovableDeviceNotificationsWindowWin::WndProcThunk(
137 HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { 151 HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) {
138 RemovableDeviceNotificationsWindowWin* msg_wnd = 152 RemovableDeviceNotificationsWindowWin* msg_wnd =
139 reinterpret_cast<RemovableDeviceNotificationsWindowWin*>( 153 reinterpret_cast<RemovableDeviceNotificationsWindowWin*>(
140 GetWindowLongPtr(hwnd, GWLP_USERDATA)); 154 GetWindowLongPtr(hwnd, GWLP_USERDATA));
141 if (msg_wnd) 155 if (msg_wnd)
142 return msg_wnd->WndProc(hwnd, message, wparam, lparam); 156 return msg_wnd->WndProc(hwnd, message, wparam, lparam);
143 return ::DefWindowProc(hwnd, message, wparam, lparam); 157 return ::DefWindowProc(hwnd, message, wparam, lparam);
144 } 158 }
(...skipping 27 matching lines...) Expand all
172 portable_device_watcher_->OnWindowMessage(event_type, data); 186 portable_device_watcher_->OnWindowMessage(event_type, data);
173 } 187 }
174 188
175 // static 189 // static
176 RemovableStorageNotifications* RemovableStorageNotifications::GetInstance() { 190 RemovableStorageNotifications* RemovableStorageNotifications::GetInstance() {
177 DCHECK(g_removable_device_notifications_window_win); 191 DCHECK(g_removable_device_notifications_window_win);
178 return g_removable_device_notifications_window_win; 192 return g_removable_device_notifications_window_win;
179 } 193 }
180 194
181 } // namespace chrome 195 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698