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

Side by Side Diff: chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h

Issue 2451603002: Add a method to remount all removable devices in DiskMountManager. (Closed)
Patch Set: Add is_mounted() method. Created 4 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FAKE_DISK_MOUNT_MANAGER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FAKE_DISK_MOUNT_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FAKE_DISK_MOUNT_MANAGER_H_ 6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FAKE_DISK_MOUNT_MANAGER_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 25 matching lines...) Expand all
36 }; 36 };
37 37
38 struct UnmountRequest { 38 struct UnmountRequest {
39 UnmountRequest(const std::string& mount_path, 39 UnmountRequest(const std::string& mount_path,
40 chromeos::UnmountOptions options); 40 chromeos::UnmountOptions options);
41 41
42 std::string mount_path; 42 std::string mount_path;
43 chromeos::UnmountOptions options; 43 chromeos::UnmountOptions options;
44 }; 44 };
45 45
46 struct RemountAllRequest {
47 RemountAllRequest(chromeos::MountAccessMode access_mode);
48 chromeos::MountAccessMode access_mode;
49 };
50
46 FakeDiskMountManager(); 51 FakeDiskMountManager();
47 ~FakeDiskMountManager() override; 52 ~FakeDiskMountManager() override;
48 53
49 const std::vector<MountRequest>& mount_requests() const { 54 const std::vector<MountRequest>& mount_requests() const {
50 return mount_requests_; 55 return mount_requests_;
51 } 56 }
52 const std::vector<UnmountRequest>& unmount_requests() const { 57 const std::vector<UnmountRequest>& unmount_requests() const {
53 return unmount_requests_; 58 return unmount_requests_;
54 } 59 }
60 const std::vector<RemountAllRequest>& remount_all_requests() const {
61 return remount_all_requests_;
62 }
55 63
56 // Emulates that all mount request finished. 64 // Emulates that all mount request finished.
57 // Return true if there was one or more mount request enqueued, or false 65 // Return true if there was one or more mount request enqueued, or false
58 // otherwise. 66 // otherwise.
59 bool FinishAllUnmountPathRequests(); 67 bool FinishAllUnmountPathRequests();
60 68
61 // DiskMountManager overrides. 69 // DiskMountManager overrides.
62 void AddObserver(Observer* observer) override; 70 void AddObserver(Observer* observer) override;
63 void RemoveObserver(Observer* observer) override; 71 void RemoveObserver(Observer* observer) override;
64 const DiskMap& disks() const override; 72 const DiskMap& disks() const override;
65 const Disk* FindDiskBySourcePath( 73 const Disk* FindDiskBySourcePath(
66 const std::string& source_path) const override; 74 const std::string& source_path) const override;
67 const MountPointMap& mount_points() const override; 75 const MountPointMap& mount_points() const override;
68 void EnsureMountInfoRefreshed( 76 void EnsureMountInfoRefreshed(
69 const EnsureMountInfoRefreshedCallback& callback, 77 const EnsureMountInfoRefreshedCallback& callback,
70 bool force) override; 78 bool force) override;
71 void MountPath(const std::string& source_path, 79 void MountPath(const std::string& source_path,
72 const std::string& source_format, 80 const std::string& source_format,
73 const std::string& mount_label, 81 const std::string& mount_label,
74 chromeos::MountType type, 82 chromeos::MountType type,
75 chromeos::MountAccessMode access_mode) override; 83 chromeos::MountAccessMode access_mode) override;
76 // In order to simulate asynchronous invocation of callbacks after unmount 84 // In order to simulate asynchronous invocation of callbacks after unmount
77 // is finished, |callback| will be invoked only when 85 // is finished, |callback| will be invoked only when
78 // |FinishAllUnmountRequest()| is called. 86 // |FinishAllUnmountRequest()| is called.
79 void UnmountPath(const std::string& mount_path, 87 void UnmountPath(const std::string& mount_path,
80 chromeos::UnmountOptions options, 88 chromeos::UnmountOptions options,
81 const UnmountPathCallback& callback) override; 89 const UnmountPathCallback& callback) override;
90 void RemountAllRemovableDrives(
91 chromeos::MountAccessMode access_mode) override;
82 void FormatMountedDevice(const std::string& mount_path) override; 92 void FormatMountedDevice(const std::string& mount_path) override;
83 void UnmountDeviceRecursively( 93 void UnmountDeviceRecursively(
84 const std::string& device_path, 94 const std::string& device_path,
85 const UnmountDeviceRecursivelyCallbackType& callback) override; 95 const UnmountDeviceRecursivelyCallbackType& callback) override;
86 96
87 bool AddDiskForTest(std::unique_ptr<Disk> disk) override; 97 bool AddDiskForTest(std::unique_ptr<Disk> disk) override;
88 bool AddMountPointForTest(const MountPointInfo& mount_point) override; 98 bool AddMountPointForTest(const MountPointInfo& mount_point) override;
89 void InvokeDiskEventForTest(DiskEvent event, const Disk* disk); 99 void InvokeDiskEventForTest(DiskEvent event, const Disk* disk);
90 100
91 private: 101 private:
92 base::ObserverList<Observer> observers_; 102 base::ObserverList<Observer> observers_;
93 std::queue<UnmountPathCallback> pending_unmount_callbacks_; 103 std::queue<UnmountPathCallback> pending_unmount_callbacks_;
94 104
95 DiskMap disks_; 105 DiskMap disks_;
96 MountPointMap mount_points_; 106 MountPointMap mount_points_;
97 107
98 std::vector<MountRequest> mount_requests_; 108 std::vector<MountRequest> mount_requests_;
99 std::vector<UnmountRequest> unmount_requests_; 109 std::vector<UnmountRequest> unmount_requests_;
110 std::vector<RemountAllRequest> remount_all_requests_;
100 111
101 DISALLOW_COPY_AND_ASSIGN(FakeDiskMountManager); 112 DISALLOW_COPY_AND_ASSIGN(FakeDiskMountManager);
102 }; 113 };
103 114
104 } // namespace file_manager 115 } // namespace file_manager
105 116
106 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FAKE_DISK_MOUNT_MANAGER_H_ 117 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FAKE_DISK_MOUNT_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698