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

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

Issue 11573048: [Media Galleries] Move RemovableStorageInfo notifications to chrome namespace (part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing up tests Created 7 years, 11 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_VOLUME_MOUNT_WATCHER_WIN_H_ 5 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_VOLUME_MOUNT_WATCHER_WIN_H_
6 #define CHROME_BROWSER_SYSTEM_MONITOR_VOLUME_MOUNT_WATCHER_WIN_H_ 6 #define CHROME_BROWSER_SYSTEM_MONITOR_VOLUME_MOUNT_WATCHER_WIN_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/string16.h" 15 #include "base/string16.h"
16 #include "base/system_monitor/system_monitor.h"
17 16
18 namespace chrome { 17 namespace chrome {
19 18
20 // This class watches the volume mount points and sends notifications to 19 // This class watches the volume mount points and sends notifications to
21 // base::SystemMonitor about the device attach/detach events. This is a 20 // RemovableStorageNotifications about the device attach/detach events.
22 // singleton class instantiated by RemovableDeviceNotificationsWindowWin. 21 // This is a singleton class instantiated by
22 // RemovableDeviceNotificationsWindowWin.
23 class VolumeMountWatcherWin 23 class VolumeMountWatcherWin
24 : public base::RefCountedThreadSafe<VolumeMountWatcherWin> { 24 : public base::RefCountedThreadSafe<VolumeMountWatcherWin> {
25 public: 25 public:
26 // TODO(gbillock): Take the RemovableStorageNotifications as an argument.
26 VolumeMountWatcherWin(); 27 VolumeMountWatcherWin();
27 28
28 // Returns the volume file path of the drive specified by the |drive_number|. 29 // Returns the volume file path of the drive specified by the |drive_number|.
29 // |drive_number| inputs of 0 - 25 are valid. Returns an empty file path if 30 // |drive_number| inputs of 0 - 25 are valid. Returns an empty file path if
30 // the |drive_number| is invalid. 31 // the |drive_number| is invalid.
31 static FilePath DriveNumberToFilePath(int drive_number); 32 static FilePath DriveNumberToFilePath(int drive_number);
32 33
33 // Must be called after the file thread is created. 34 // Must be called after the file thread is created.
34 void Init(); 35 void Init();
35 36
36 // Gets the information about the device mounted at |device_path|. On success, 37 // Gets the information about the device mounted at |device_path|. On success,
37 // returns true and fills in |location|, |unique_id|, |name|, and |removable|. 38 // returns true and fills in |location|, |unique_id|, |name|, and |removable|.
38 virtual bool GetDeviceInfo(const FilePath& device_path, 39 virtual bool GetDeviceInfo(const FilePath& device_path,
39 string16* location, 40 string16* location,
40 std::string* unique_id, 41 std::string* unique_id,
41 string16* name, 42 string16* name,
42 bool* removable); 43 bool* removable);
43 44
44 // Processes DEV_BROADCAST_VOLUME messages and triggers a SystemMonitor 45 // Processes DEV_BROADCAST_VOLUME messages and triggers a
45 // notification if appropriate. 46 // notification if appropriate.
46 void OnWindowMessage(UINT event_type, LPARAM data); 47 void OnWindowMessage(UINT event_type, LPARAM data);
47 48
48 protected: 49 protected:
49 // VolumeMountWatcherWin is ref-counted. 50 // VolumeMountWatcherWin is ref-counted.
50 virtual ~VolumeMountWatcherWin(); 51 virtual ~VolumeMountWatcherWin();
51 52
52 // Returns a vector of all the removable mass storage devices that are 53 // Returns a vector of all the removable mass storage devices that are
53 // connected. 54 // connected.
54 virtual std::vector<FilePath> GetAttachedDevices(); 55 virtual std::vector<FilePath> GetAttachedDevices();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // A map from device mount point to device metadata. Only accessed on the UI 87 // A map from device mount point to device metadata. Only accessed on the UI
87 // thread. 88 // thread.
88 MountPointDeviceMetadataMap device_metadata_; 89 MountPointDeviceMetadataMap device_metadata_;
89 90
90 DISALLOW_COPY_AND_ASSIGN(VolumeMountWatcherWin); 91 DISALLOW_COPY_AND_ASSIGN(VolumeMountWatcherWin);
91 }; 92 };
92 93
93 } // namespace chrome 94 } // namespace chrome
94 95
95 #endif // CHROME_BROWSER_SYSTEM_MONITOR_VOLUME_MOUNT_WATCHER_WIN_H_ 96 #endif // CHROME_BROWSER_SYSTEM_MONITOR_VOLUME_MOUNT_WATCHER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698