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

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

Issue 12334096: Regularize ownerships and lifecycle for storage monitor platform classes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Document lifecycle in storage_monitor.h Created 7 years, 9 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
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 // RemovableDeviceNotificationsLinux listens for mount point changes, notifies 5 // RemovableDeviceNotificationsLinux listens for mount point changes, notifies
6 // listeners about the addition and deletion of media devices, and 6 // listeners about the addition and deletion of media devices, and
7 // answers queries about mounted devices. 7 // answers queries about mounted devices.
8 8
9 #ifndef CHROME_BROWSER_STORAGE_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_LINUX_H_ 9 #ifndef CHROME_BROWSER_STORAGE_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_LINUX_H_
10 #define CHROME_BROWSER_STORAGE_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_LINUX_H_ 10 #define CHROME_BROWSER_STORAGE_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_LINUX_H_
(...skipping 21 matching lines...) Expand all
32 // Gets device information given a |device_path|. On success, fills in 32 // Gets device information given a |device_path|. On success, fills in
33 // |unique_id|, |name|, |removable| and |partition_size_in_bytes|. 33 // |unique_id|, |name|, |removable| and |partition_size_in_bytes|.
34 typedef void (*GetDeviceInfoFunc)(const base::FilePath& device_path, 34 typedef void (*GetDeviceInfoFunc)(const base::FilePath& device_path,
35 std::string* unique_id, 35 std::string* unique_id,
36 string16* name, 36 string16* name,
37 bool* removable, 37 bool* removable,
38 uint64* partition_size_in_bytes); 38 uint64* partition_size_in_bytes);
39 39
40 namespace chrome { 40 namespace chrome {
41 41
42 class MediaTransferProtocolDeviceObserverLinux;
43
42 class RemovableDeviceNotificationsLinux 44 class RemovableDeviceNotificationsLinux
43 : public StorageMonitor, 45 : public StorageMonitor,
44 public base::RefCountedThreadSafe<RemovableDeviceNotificationsLinux, 46 public base::RefCountedThreadSafe<RemovableDeviceNotificationsLinux,
45 content::BrowserThread::DeleteOnFileThread> { 47 content::BrowserThread::DeleteOnFileThread> {
46 public: 48 public:
47 // Should only be called by browser start up code. Use GetInstance() instead. 49 // Should only be called by browser start up code. Use GetInstance() instead.
48 explicit RemovableDeviceNotificationsLinux(const base::FilePath& path); 50 explicit RemovableDeviceNotificationsLinux(const base::FilePath& path);
49 51
50 // Must be called for RemovableDeviceNotificationsLinux to work. 52 // Must be called for RemovableDeviceNotificationsLinux to work.
51 void Init(); 53 void Init();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // Keep in mind on Linux, a device can be mounted at multiple mount points, 136 // Keep in mind on Linux, a device can be mounted at multiple mount points,
135 // and multiple devices can be mounted at a mount point. 137 // and multiple devices can be mounted at a mount point.
136 MountMap mount_info_map_; 138 MountMap mount_info_map_;
137 139
138 // Because a device can be mounted to multiple places, we only want to 140 // Because a device can be mounted to multiple places, we only want to
139 // notify about one of them. If (and only if) that one is unmounted, we need 141 // notify about one of them. If (and only if) that one is unmounted, we need
140 // to notify about it's departure and notify about another one of it's mount 142 // to notify about it's departure and notify about another one of it's mount
141 // points. 143 // points.
142 MountPriorityMap mount_priority_map_; 144 MountPriorityMap mount_priority_map_;
143 145
146 scoped_ptr<MediaTransferProtocolDeviceObserverLinux>
147 media_transfer_protocol_device_observer_;
148
144 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsLinux); 149 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsLinux);
145 }; 150 };
146 151
147 } // namespace chrome 152 } // namespace chrome
148 153
149 #endif // CHROME_BROWSER_STORAGE_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_LINUX_H _ 154 #endif // CHROME_BROWSER_STORAGE_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_LINUX_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698