| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 // MtabWatcherLinux listens for mount point changes from a mtab file and | 5 // MtabWatcherLinux listens for mount point changes from a mtab file and |
| 6 // notifies a StorageMonitorLinux about them. | 6 // notifies a StorageMonitorLinux about them. |
| 7 // MtabWatcherLinux lives on the FILE thread. | 7 // MtabWatcherLinux lives on the FILE thread. |
| 8 | 8 |
| 9 #ifndef CHROME_BROWSER_STORAGE_MONITOR_MTAB_WATCHER_LINUX_H_ | 9 #ifndef CHROME_BROWSER_STORAGE_MONITOR_MTAB_WATCHER_LINUX_H_ |
| 10 #define CHROME_BROWSER_STORAGE_MONITOR_MTAB_WATCHER_LINUX_H_ | 10 #define CHROME_BROWSER_STORAGE_MONITOR_MTAB_WATCHER_LINUX_H_ |
| 11 | 11 |
| 12 #if defined(OS_CHROMEOS) | 12 #if defined(OS_CHROMEOS) |
| 13 #error "ChromeOS does not use MtabWatcherLinux." | 13 #error "ChromeOS does not use MtabWatcherLinux." |
| 14 #endif | 14 #endif |
| 15 | 15 |
| 16 #include <map> | 16 #include <map> |
| 17 | 17 |
| 18 #include "base/basictypes.h" | 18 #include "base/basictypes.h" |
| 19 #include "base/files/file_path.h" | 19 #include "base/files/file_path.h" |
| 20 #include "base/files/file_path_watcher.h" | 20 #include "base/files/file_path_watcher.h" |
| 21 #include "base/memory/weak_ptr.h" | 21 #include "base/memory/weak_ptr.h" |
| 22 | 22 |
| 23 namespace chrome { | |
| 24 | |
| 25 class MtabWatcherLinux { | 23 class MtabWatcherLinux { |
| 26 public: | 24 public: |
| 27 // (mount point, mount device) | 25 // (mount point, mount device) |
| 28 // A mapping from mount point to mount device, as extracted from the mtab | 26 // A mapping from mount point to mount device, as extracted from the mtab |
| 29 // file. | 27 // file. |
| 30 typedef std::map<base::FilePath, base::FilePath> MountPointDeviceMap; | 28 typedef std::map<base::FilePath, base::FilePath> MountPointDeviceMap; |
| 31 | 29 |
| 32 class Delegate { | 30 class Delegate { |
| 33 public: | 31 public: |
| 34 virtual ~Delegate() {} | 32 virtual ~Delegate() {} |
| (...skipping 19 matching lines...) Expand all Loading... |
| 54 // Watcher for |mtab_path_|. | 52 // Watcher for |mtab_path_|. |
| 55 base::FilePathWatcher file_watcher_; | 53 base::FilePathWatcher file_watcher_; |
| 56 | 54 |
| 57 base::WeakPtr<Delegate> delegate_; | 55 base::WeakPtr<Delegate> delegate_; |
| 58 | 56 |
| 59 base::WeakPtrFactory<MtabWatcherLinux> weak_ptr_factory_; | 57 base::WeakPtrFactory<MtabWatcherLinux> weak_ptr_factory_; |
| 60 | 58 |
| 61 DISALLOW_COPY_AND_ASSIGN(MtabWatcherLinux); | 59 DISALLOW_COPY_AND_ASSIGN(MtabWatcherLinux); |
| 62 }; | 60 }; |
| 63 | 61 |
| 64 } // namespace chrome | |
| 65 | |
| 66 #endif // CHROME_BROWSER_STORAGE_MONITOR_MTAB_WATCHER_LINUX_H_ | 62 #endif // CHROME_BROWSER_STORAGE_MONITOR_MTAB_WATCHER_LINUX_H_ |
| OLD | NEW |