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

Side by Side Diff: components/storage_monitor/storage_monitor_linux.h

Issue 623133002: replace OVERRIDE and FINAL with override and final in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 processes mount point change events, notifies listeners 5 // StorageMonitorLinux processes mount point change events, 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 // StorageMonitorLinux lives on the UI thread, and uses a MtabWatcherLinux on 8 // StorageMonitorLinux lives on the UI thread, and uses a MtabWatcherLinux on
9 // the FILE thread to get mount point change events. 9 // the FILE thread to get mount point change events.
10 10
(...skipping 24 matching lines...) Expand all
35 class StorageMonitorLinux : public StorageMonitor, 35 class StorageMonitorLinux : public StorageMonitor,
36 public MtabWatcherLinux::Delegate { 36 public MtabWatcherLinux::Delegate {
37 public: 37 public:
38 // Should only be called by browser start up code. 38 // Should only be called by browser start up code.
39 // Use StorageMonitor::GetInstance() instead. 39 // Use StorageMonitor::GetInstance() instead.
40 // |mtab_file_path| is the path to a mtab file to watch for mount points. 40 // |mtab_file_path| is the path to a mtab file to watch for mount points.
41 explicit StorageMonitorLinux(const base::FilePath& mtab_file_path); 41 explicit StorageMonitorLinux(const base::FilePath& mtab_file_path);
42 virtual ~StorageMonitorLinux(); 42 virtual ~StorageMonitorLinux();
43 43
44 // Must be called for StorageMonitorLinux to work. 44 // Must be called for StorageMonitorLinux to work.
45 virtual void Init() OVERRIDE; 45 virtual void Init() override;
46 46
47 protected: 47 protected:
48 // Gets device information given a |device_path| and |mount_point|. 48 // Gets device information given a |device_path| and |mount_point|.
49 typedef base::Callback<scoped_ptr<StorageInfo>( 49 typedef base::Callback<scoped_ptr<StorageInfo>(
50 const base::FilePath& device_path, 50 const base::FilePath& device_path,
51 const base::FilePath& mount_point)> GetDeviceInfoCallback; 51 const base::FilePath& mount_point)> GetDeviceInfoCallback;
52 52
53 void SetGetDeviceInfoCallbackForTest( 53 void SetGetDeviceInfoCallbackForTest(
54 const GetDeviceInfoCallback& get_device_info_callback); 54 const GetDeviceInfoCallback& get_device_info_callback);
55 55
56 void SetMediaTransferProtocolManagerForTest( 56 void SetMediaTransferProtocolManagerForTest(
57 device::MediaTransferProtocolManager* test_manager); 57 device::MediaTransferProtocolManager* test_manager);
58 58
59 // MtabWatcherLinux::Delegate implementation. 59 // MtabWatcherLinux::Delegate implementation.
60 virtual void UpdateMtab( 60 virtual void UpdateMtab(
61 const MtabWatcherLinux::MountPointDeviceMap& new_mtab) OVERRIDE; 61 const MtabWatcherLinux::MountPointDeviceMap& new_mtab) override;
62 62
63 private: 63 private:
64 // Structure to save mounted device information such as device path, unique 64 // Structure to save mounted device information such as device path, unique
65 // identifier, device name and partition size. 65 // identifier, device name and partition size.
66 struct MountPointInfo { 66 struct MountPointInfo {
67 base::FilePath mount_device; 67 base::FilePath mount_device;
68 StorageInfo storage_info; 68 StorageInfo storage_info;
69 }; 69 };
70 70
71 // For use with scoped_ptr. 71 // For use with scoped_ptr.
(...skipping 12 matching lines...) Expand all
84 // which one we've notified system monitor about. 84 // which one we've notified system monitor about.
85 typedef std::map<base::FilePath, bool> ReferencedMountPoint; 85 typedef std::map<base::FilePath, bool> ReferencedMountPoint;
86 86
87 // (mount device, map of known mount points) 87 // (mount device, map of known mount points)
88 // For each mount device, track the places it is mounted and which one (if 88 // For each mount device, track the places it is mounted and which one (if
89 // any) we have notified system monitor about. 89 // any) we have notified system monitor about.
90 typedef std::map<base::FilePath, ReferencedMountPoint> MountPriorityMap; 90 typedef std::map<base::FilePath, ReferencedMountPoint> MountPriorityMap;
91 91
92 // StorageMonitor implementation. 92 // StorageMonitor implementation.
93 virtual bool GetStorageInfoForPath(const base::FilePath& path, 93 virtual bool GetStorageInfoForPath(const base::FilePath& path,
94 StorageInfo* device_info) const OVERRIDE; 94 StorageInfo* device_info) const override;
95 virtual void EjectDevice(const std::string& device_id, 95 virtual void EjectDevice(const std::string& device_id,
96 base::Callback<void(EjectStatus)> callback) OVERRIDE; 96 base::Callback<void(EjectStatus)> callback) override;
97 virtual device::MediaTransferProtocolManager* 97 virtual device::MediaTransferProtocolManager*
98 media_transfer_protocol_manager() OVERRIDE; 98 media_transfer_protocol_manager() override;
99 99
100 // Called when the MtabWatcher has been created. 100 // Called when the MtabWatcher has been created.
101 void OnMtabWatcherCreated(MtabWatcherLinux* watcher); 101 void OnMtabWatcherCreated(MtabWatcherLinux* watcher);
102 102
103 bool IsDeviceAlreadyMounted(const base::FilePath& mount_device) const; 103 bool IsDeviceAlreadyMounted(const base::FilePath& mount_device) const;
104 104
105 // Assuming |mount_device| is already mounted, and it gets mounted again at 105 // Assuming |mount_device| is already mounted, and it gets mounted again at
106 // |mount_point|, update the mappings. 106 // |mount_point|, update the mappings.
107 void HandleDeviceMountedMultipleTimes(const base::FilePath& mount_device, 107 void HandleDeviceMountedMultipleTimes(const base::FilePath& mount_device,
108 const base::FilePath& mount_point); 108 const base::FilePath& mount_point);
(...skipping 28 matching lines...) Expand all
137 scoped_ptr<MtabWatcherLinux, MtabWatcherLinuxDeleter> mtab_watcher_; 137 scoped_ptr<MtabWatcherLinux, MtabWatcherLinuxDeleter> mtab_watcher_;
138 138
139 base::WeakPtrFactory<StorageMonitorLinux> weak_ptr_factory_; 139 base::WeakPtrFactory<StorageMonitorLinux> weak_ptr_factory_;
140 140
141 DISALLOW_COPY_AND_ASSIGN(StorageMonitorLinux); 141 DISALLOW_COPY_AND_ASSIGN(StorageMonitorLinux);
142 }; 142 };
143 143
144 } // namespace storage_monitor 144 } // namespace storage_monitor
145 145
146 #endif // COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_LINUX_H_ 146 #endif // COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_LINUX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698