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

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

Issue 23727009: Cleanup: Remove chrome namespace for storage monitor and media galleries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nit Created 7 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 #ifndef CHROME_BROWSER_STORAGE_MONITOR_VOLUME_MOUNT_WATCHER_WIN_H_ 5 #ifndef CHROME_BROWSER_STORAGE_MONITOR_VOLUME_MOUNT_WATCHER_WIN_H_
6 #define CHROME_BROWSER_STORAGE_MONITOR_VOLUME_MOUNT_WATCHER_WIN_H_ 6 #define CHROME_BROWSER_STORAGE_MONITOR_VOLUME_MOUNT_WATCHER_WIN_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/sequenced_task_runner.h" 17 #include "base/sequenced_task_runner.h"
18 #include "base/strings/string16.h" 18 #include "base/strings/string16.h"
19 #include "base/threading/sequenced_worker_pool.h" 19 #include "base/threading/sequenced_worker_pool.h"
20 #include "chrome/browser/storage_monitor/storage_info.h" 20 #include "chrome/browser/storage_monitor/storage_info.h"
21 #include "chrome/browser/storage_monitor/storage_monitor.h" 21 #include "chrome/browser/storage_monitor/storage_monitor.h"
22 22
23 namespace chrome {
24
25 namespace test {
26 class TestVolumeMountWatcherWin; 23 class TestVolumeMountWatcherWin;
27 }
28 24
29 // This class watches the volume mount points and sends notifications to 25 // This class watches the volume mount points and sends notifications to
30 // StorageMonitor about the device attach/detach events. 26 // StorageMonitor about the device attach/detach events.
31 // This is a singleton class instantiated by StorageMonitorWin. 27 // This is a singleton class instantiated by StorageMonitorWin.
32 class VolumeMountWatcherWin { 28 class VolumeMountWatcherWin {
33 public: 29 public:
34 VolumeMountWatcherWin(); 30 VolumeMountWatcherWin();
35 virtual ~VolumeMountWatcherWin(); 31 virtual ~VolumeMountWatcherWin();
36 32
37 // Returns the volume file path of the drive specified by the |drive_number|. 33 // Returns the volume file path of the drive specified by the |drive_number|.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 virtual GetAttachedDevicesCallbackType GetAttachedDevicesCallback() const; 85 virtual GetAttachedDevicesCallbackType GetAttachedDevicesCallback() const;
90 virtual GetDeviceDetailsCallbackType GetDeviceDetailsCallback() const; 86 virtual GetDeviceDetailsCallbackType GetDeviceDetailsCallback() const;
91 87
92 // Worker pool used to collect device information. Used because some 88 // Worker pool used to collect device information. Used because some
93 // devices freeze workers trying to get device info, resulting in 89 // devices freeze workers trying to get device info, resulting in
94 // shutdown hangs. 90 // shutdown hangs.
95 scoped_refptr<base::SequencedWorkerPool> device_info_worker_pool_; 91 scoped_refptr<base::SequencedWorkerPool> device_info_worker_pool_;
96 scoped_refptr<base::SequencedTaskRunner> task_runner_; 92 scoped_refptr<base::SequencedTaskRunner> task_runner_;
97 93
98 private: 94 private:
99 friend class test::TestVolumeMountWatcherWin; 95 friend class TestVolumeMountWatcherWin;
100 96
101 // Key: Mass storage device mount point. 97 // Key: Mass storage device mount point.
102 // Value: Mass storage device metadata. 98 // Value: Mass storage device metadata.
103 typedef std::map<base::FilePath, StorageInfo> MountPointDeviceMetadataMap; 99 typedef std::map<base::FilePath, StorageInfo> MountPointDeviceMetadataMap;
104 100
105 // Maintain a set of device attribute check calls in-flight. Only accessed 101 // Maintain a set of device attribute check calls in-flight. Only accessed
106 // on the UI thread. This is to try and prevent the same device from 102 // on the UI thread. This is to try and prevent the same device from
107 // occupying our worker pool in case of windows API call hangs. 103 // occupying our worker pool in case of windows API call hangs.
108 std::set<base::FilePath> pending_device_checks_; 104 std::set<base::FilePath> pending_device_checks_;
109 105
110 // A map from device mount point to device metadata. Only accessed on the UI 106 // A map from device mount point to device metadata. Only accessed on the UI
111 // thread. 107 // thread.
112 MountPointDeviceMetadataMap device_metadata_; 108 MountPointDeviceMetadataMap device_metadata_;
113 109
114 base::WeakPtrFactory<VolumeMountWatcherWin> weak_factory_; 110 base::WeakPtrFactory<VolumeMountWatcherWin> weak_factory_;
115 111
116 // The notifications object to use to signal newly attached volumes. Only 112 // The notifications object to use to signal newly attached volumes. Only
117 // removable devices will be notified. 113 // removable devices will be notified.
118 StorageMonitor::Receiver* notifications_; 114 StorageMonitor::Receiver* notifications_;
119 115
120 DISALLOW_COPY_AND_ASSIGN(VolumeMountWatcherWin); 116 DISALLOW_COPY_AND_ASSIGN(VolumeMountWatcherWin);
121 }; 117 };
122 118
123 } // namespace chrome
124
125 #endif // CHROME_BROWSER_STORAGE_MONITOR_VOLUME_MOUNT_WATCHER_WIN_H_ 119 #endif // CHROME_BROWSER_STORAGE_MONITOR_VOLUME_MOUNT_WATCHER_WIN_H_
OLDNEW
« no previous file with comments | « chrome/browser/storage_monitor/udev_util_linux.cc ('k') | chrome/browser/storage_monitor/volume_mount_watcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698