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

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

Issue 11088012: [Win, MediaGallery] Enumerate and handle mtp device attach/detach events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments Created 8 years, 2 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 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN_ H_ 5 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN_ H_
6 #define CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN_ H_ 6 #define CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN_ H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/system_monitor/system_monitor.h" 11 #include "base/system_monitor/system_monitor.h"
12 #include "chrome/browser/system_monitor/portable_device_watcher_win.h"
12 #include "chrome/browser/system_monitor/volume_mount_watcher_win.h" 13 #include "chrome/browser/system_monitor/volume_mount_watcher_win.h"
13 14
14 class FilePath; 15 class FilePath;
15 16
16 namespace chrome { 17 namespace chrome {
17 18
18 class RemovableDeviceNotificationsWindowWin; 19 class RemovableDeviceNotificationsWindowWin;
19 typedef RemovableDeviceNotificationsWindowWin RemovableDeviceNotifications; 20 typedef RemovableDeviceNotificationsWindowWin RemovableDeviceNotifications;
20 21
21 class RemovableDeviceNotificationsWindowWin { 22 class RemovableDeviceNotificationsWindowWin {
(...skipping 13 matching lines...) Expand all
35 36
36 // Finds the device that contains |path| and populates |device_info|. 37 // Finds the device that contains |path| and populates |device_info|.
37 // Returns false if unable to find the device. 38 // Returns false if unable to find the device.
38 bool GetDeviceInfoForPath( 39 bool GetDeviceInfoForPath(
39 const FilePath& path, 40 const FilePath& path,
40 base::SystemMonitor::RemovableStorageInfo* device_info); 41 base::SystemMonitor::RemovableStorageInfo* device_info);
41 42
42 private: 43 private:
43 friend class TestRemovableDeviceNotificationsWindowWin; 44 friend class TestRemovableDeviceNotificationsWindowWin;
44 45
45 explicit RemovableDeviceNotificationsWindowWin( 46 RemovableDeviceNotificationsWindowWin(
46 VolumeMountWatcherWin* volume_mount_watcher); 47 VolumeMountWatcherWin* volume_mount_watcher,
48 PortableDeviceWatcherWin* portable_device_watcher);
47 49
48 // Gets the removable storage information given a |device_path|. On success, 50 // Gets the removable storage information given a |device_path|. On success,
49 // returns true and fills in |device_location|, |unique_id|, |name| and 51 // returns true and fills in |device_location|, |unique_id|, |name| and
50 // |removable|. 52 // |removable|.
51 bool GetDeviceInfo(const FilePath& device_path, 53 bool GetDeviceInfo(const FilePath& device_path,
52 string16* device_location, 54 string16* device_location,
53 std::string* unique_id, 55 std::string* unique_id,
54 string16* name, 56 string16* name,
55 bool* removable); 57 bool* removable);
56 58
57 static LRESULT CALLBACK WndProcThunk(HWND hwnd, UINT message, WPARAM wparam, 59 static LRESULT CALLBACK WndProcThunk(HWND hwnd, UINT message, WPARAM wparam,
58 LPARAM lparam); 60 LPARAM lparam);
59 61
60 LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam, 62 LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam,
61 LPARAM lparam); 63 LPARAM lparam);
62 64
63 void OnDeviceChange(UINT event_type, LPARAM data); 65 void OnDeviceChange(UINT event_type, LPARAM data);
64 66
65 // The window class of |window_|. 67 // The window class of |window_|.
66 ATOM window_class_; 68 ATOM window_class_;
67 69
68 // The handle of the module that contains the window procedure of |window_|. 70 // The handle of the module that contains the window procedure of |window_|.
69 HMODULE instance_; 71 HMODULE instance_;
70 HWND window_; 72 HWND window_;
71 73
72 // Store the volume mount point watcher to manage the mounted devices. 74 // Store the volume mount point watcher to manage the mounted devices.
73 scoped_refptr<VolumeMountWatcherWin> volume_mount_watcher_; 75 scoped_refptr<VolumeMountWatcherWin> volume_mount_watcher_;
74 76
77 // Store the portable device watcher to manage mtp devices.
78 scoped_refptr<PortableDeviceWatcherWin> portable_device_watcher_;
79
75 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsWindowWin); 80 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsWindowWin);
76 }; 81 };
77 82
78 } // namespace chrome 83 } // namespace chrome
79 84
80 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_W IN_H_ 85 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_W IN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698