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

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

Issue 12211084: [Media Galleries] Populate volume metadata in ChromeOS/Linux (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add larger constructor, put linux data structures back 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 // StorageMonitorLinux listens for mount point changes, notifies listeners 5 // StorageMonitorLinux listens for mount point changes, notifies listeners
6 // about the addition and deletion of media devices, and answers queries about 6 // about the addition and deletion of media devices, and answers queries about
7 // mounted devices. 7 // mounted devices.
8 8
9 #ifndef CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_LINUX_H_ 9 #ifndef CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_LINUX_H_
10 #define CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_LINUX_H_ 10 #define CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_LINUX_H_
(...skipping 11 matching lines...) Expand all
22 #include "base/compiler_specific.h" 22 #include "base/compiler_specific.h"
23 #include "base/files/file_path_watcher.h" 23 #include "base/files/file_path_watcher.h"
24 #include "base/memory/ref_counted.h" 24 #include "base/memory/ref_counted.h"
25 #include "chrome/browser/storage_monitor/storage_monitor.h" 25 #include "chrome/browser/storage_monitor/storage_monitor.h"
26 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
27 27
28 namespace base { 28 namespace base {
29 class FilePath; 29 class FilePath;
30 } 30 }
31 31
32 // Gets device information given a |device_path|. On success, fills in 32 // Gets device information given a |device_path| and |mount_point|.
33 // |unique_id|, |name|, |removable| and |partition_size_in_bytes|. 33 // On success, fills in metadata fields.
34 typedef void (*GetDeviceInfoFunc)(const base::FilePath& device_path, 34 typedef void (*GetDeviceInfoFunc)(const base::FilePath& device_path,
35 std::string* unique_id, 35 const base::FilePath& mount_point,
36 std::string* device_id,
36 string16* name, 37 string16* name,
37 bool* removable, 38 bool* removable,
38 uint64* partition_size_in_bytes); 39 uint64* partition_size_in_bytes,
40 string16* volume_label,
41 string16* vendor_name,
42 string16* model_name);
39 43
40 namespace chrome { 44 namespace chrome {
41 45
42 class StorageMonitorLinux 46 class StorageMonitorLinux
43 : public StorageMonitor, 47 : public StorageMonitor,
44 public base::RefCountedThreadSafe<StorageMonitorLinux, 48 public base::RefCountedThreadSafe<StorageMonitorLinux,
45 content::BrowserThread::DeleteOnFileThread> { 49 content::BrowserThread::DeleteOnFileThread> {
46 public: 50 public:
47 // Should only be called by browser start up code. Use GetInstance() instead. 51 // Should only be called by browser start up code. Use GetInstance() instead.
48 explicit StorageMonitorLinux(const base::FilePath& path); 52 explicit StorageMonitorLinux(const base::FilePath& path);
(...skipping 26 matching lines...) Expand all
75 79
76 private: 80 private:
77 friend class base::RefCountedThreadSafe<StorageMonitorLinux>; 81 friend class base::RefCountedThreadSafe<StorageMonitorLinux>;
78 friend class base::DeleteHelper<StorageMonitorLinux>; 82 friend class base::DeleteHelper<StorageMonitorLinux>;
79 friend struct content::BrowserThread::DeleteOnThread< 83 friend struct content::BrowserThread::DeleteOnThread<
80 content::BrowserThread::FILE>; 84 content::BrowserThread::FILE>;
81 85
82 // Structure to save mounted device information such as device path, unique 86 // Structure to save mounted device information such as device path, unique
83 // identifier, device name and partition size. 87 // identifier, device name and partition size.
84 struct MountPointInfo { 88 struct MountPointInfo {
85 MountPointInfo();
86
87 base::FilePath mount_device; 89 base::FilePath mount_device;
88 std::string device_id; 90 StorageInfo storage_info;
89 string16 device_name;
90 uint64 partition_size_in_bytes;
91 }; 91 };
92 92
93 // Mapping of mount points to MountPointInfo. 93 // Mapping of mount points to MountPointInfo.
94 typedef std::map<base::FilePath, MountPointInfo> MountMap; 94 typedef std::map<base::FilePath, MountPointInfo> MountMap;
95 95
96 // (mount point, priority) 96 // (mount point, priority)
97 // For devices that are mounted to multiple mount points, this helps us track 97 // For devices that are mounted to multiple mount points, this helps us track
98 // which one we've notified system monitor about. 98 // which one we've notified system monitor about.
99 typedef std::map<base::FilePath, bool> ReferencedMountPoint; 99 typedef std::map<base::FilePath, bool> ReferencedMountPoint;
100 100
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // to notify about it's departure and notify about another one of it's mount 140 // to notify about it's departure and notify about another one of it's mount
141 // points. 141 // points.
142 MountPriorityMap mount_priority_map_; 142 MountPriorityMap mount_priority_map_;
143 143
144 DISALLOW_COPY_AND_ASSIGN(StorageMonitorLinux); 144 DISALLOW_COPY_AND_ASSIGN(StorageMonitorLinux);
145 }; 145 };
146 146
147 } // namespace chrome 147 } // namespace chrome
148 148
149 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_LINUX_H_ 149 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_LINUX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698