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

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

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 #include "chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h" 5 #include "chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h"
6 6
7 namespace file_manager { 7 namespace file_manager {
8 8
9 FakeDiskMountManager::MountRequest::MountRequest( 9 FakeDiskMountManager::MountRequest::MountRequest(
10 const std::string& source_path, 10 const std::string& source_path,
(...skipping 10 matching lines...) Expand all
21 FakeDiskMountManager::MountRequest::MountRequest(const MountRequest& other) = 21 FakeDiskMountManager::MountRequest::MountRequest(const MountRequest& other) =
22 default; 22 default;
23 23
24 FakeDiskMountManager::UnmountRequest::UnmountRequest( 24 FakeDiskMountManager::UnmountRequest::UnmountRequest(
25 const std::string& mount_path, 25 const std::string& mount_path,
26 chromeos::UnmountOptions options) 26 chromeos::UnmountOptions options)
27 : mount_path(mount_path), 27 : mount_path(mount_path),
28 options(options) { 28 options(options) {
29 } 29 }
30 30
31 FakeDiskMountManager::RemountAllRequest::RemountAllRequest(
32 chromeos::MountAccessMode access_mode)
33 : access_mode(access_mode) {}
34
31 FakeDiskMountManager::FakeDiskMountManager() { 35 FakeDiskMountManager::FakeDiskMountManager() {
32 } 36 }
33 37
34 FakeDiskMountManager::~FakeDiskMountManager() { 38 FakeDiskMountManager::~FakeDiskMountManager() {
35 } 39 }
36 40
37 void FakeDiskMountManager::AddObserver(Observer* observer) { 41 void FakeDiskMountManager::AddObserver(Observer* observer) {
38 DCHECK(observer); 42 DCHECK(observer);
39 observers_.AddObserver(observer); 43 observers_.AddObserver(observer);
40 } 44 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 for (auto& observer : observers_) { 105 for (auto& observer : observers_) {
102 observer.OnMountEvent(DiskMountManager::UNMOUNTING, 106 observer.OnMountEvent(DiskMountManager::UNMOUNTING,
103 chromeos::MOUNT_ERROR_NONE, mount_point); 107 chromeos::MOUNT_ERROR_NONE, mount_point);
104 } 108 }
105 109
106 // Enqueue callback so that |FakeDiskMountManager::FinishAllUnmountRequest()| 110 // Enqueue callback so that |FakeDiskMountManager::FinishAllUnmountRequest()|
107 // can call them. 111 // can call them.
108 pending_unmount_callbacks_.push(callback); 112 pending_unmount_callbacks_.push(callback);
109 } 113 }
110 114
115 void FakeDiskMountManager::RemountAllRemovableDrives(
116 chromeos::MountAccessMode access_mode) {
117 remount_all_requests_.push_back(RemountAllRequest(access_mode));
118 }
119
111 bool FakeDiskMountManager::FinishAllUnmountPathRequests() { 120 bool FakeDiskMountManager::FinishAllUnmountPathRequests() {
112 if (pending_unmount_callbacks_.empty()) 121 if (pending_unmount_callbacks_.empty())
113 return false; 122 return false;
114 123
115 while (!pending_unmount_callbacks_.empty()) { 124 while (!pending_unmount_callbacks_.empty()) {
116 pending_unmount_callbacks_.front().Run(chromeos::MOUNT_ERROR_NONE); 125 pending_unmount_callbacks_.front().Run(chromeos::MOUNT_ERROR_NONE);
117 pending_unmount_callbacks_.pop(); 126 pending_unmount_callbacks_.pop();
118 } 127 }
119 return true; 128 return true;
120 } 129 }
(...skipping 17 matching lines...) Expand all
138 } 147 }
139 148
140 void FakeDiskMountManager::InvokeDiskEventForTest( 149 void FakeDiskMountManager::InvokeDiskEventForTest(
141 chromeos::disks::DiskMountManager::DiskEvent event, 150 chromeos::disks::DiskMountManager::DiskEvent event,
142 const chromeos::disks::DiskMountManager::Disk* disk) { 151 const chromeos::disks::DiskMountManager::Disk* disk) {
143 for (auto& observer : observers_) 152 for (auto& observer : observers_)
144 observer.OnDiskEvent(event, disk); 153 observer.OnDiskEvent(event, disk);
145 } 154 }
146 155
147 } // namespace file_manager 156 } // namespace file_manager
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h ('k') | chromeos/disks/disk_mount_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698