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

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: Make singleton pointer live in base class. 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.
vandebo (ex-Chrome) 2013/01/18 18:42:58 This is so that you could call ProcessAttach/Detac
Greg Billock 2013/01/22 20:00:39 Yes, that's the goal -- basically the platform-spe
26 VolumeMountWatcherWin(); 27 VolumeMountWatcherWin();
27 28
28 // Must be called after the file thread is created. 29 // Must be called after the file thread is created.
29 void Init(); 30 void Init();
30 31
31 // Gets the information about the device mounted at |device_path|. On success, 32 // Gets the information about the device mounted at |device_path|. On success,
32 // returns true and fills in |location|, |unique_id|, |name|, and |removable|. 33 // returns true and fills in |location|, |unique_id|, |name|, and |removable|.
33 virtual bool GetDeviceInfo(const FilePath& device_path, 34 virtual bool GetDeviceInfo(const FilePath& device_path,
34 string16* location, 35 string16* location,
35 std::string* unique_id, 36 std::string* unique_id,
36 string16* name, 37 string16* name,
37 bool* removable); 38 bool* removable);
38 39
39 // Processes DEV_BROADCAST_VOLUME messages and triggers a SystemMonitor 40 // Processes DEV_BROADCAST_VOLUME messages and triggers a
40 // notification if appropriate. 41 // notification if appropriate.
41 void OnWindowMessage(UINT event_type, LPARAM data); 42 void OnWindowMessage(UINT event_type, LPARAM data);
42 43
43 protected: 44 protected:
44 // VolumeMountWatcherWin is ref-counted. 45 // VolumeMountWatcherWin is ref-counted.
45 virtual ~VolumeMountWatcherWin(); 46 virtual ~VolumeMountWatcherWin();
46 47
47 // Returns a vector of all the removable mass storage devices that are 48 // Returns a vector of all the removable mass storage devices that are
48 // connected. 49 // connected.
49 virtual std::vector<FilePath> GetAttachedDevices(); 50 virtual std::vector<FilePath> GetAttachedDevices();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // A map from device mount point to device metadata. Only accessed on the UI 82 // A map from device mount point to device metadata. Only accessed on the UI
82 // thread. 83 // thread.
83 MountPointDeviceMetadataMap device_metadata_; 84 MountPointDeviceMetadataMap device_metadata_;
84 85
85 DISALLOW_COPY_AND_ASSIGN(VolumeMountWatcherWin); 86 DISALLOW_COPY_AND_ASSIGN(VolumeMountWatcherWin);
86 }; 87 };
87 88
88 } // namespace chrome 89 } // namespace chrome
89 90
90 #endif // CHROME_BROWSER_SYSTEM_MONITOR_VOLUME_MOUNT_WATCHER_WIN_H_ 91 #endif // CHROME_BROWSER_SYSTEM_MONITOR_VOLUME_MOUNT_WATCHER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698