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

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

Issue 2416763002: Replace FOR_EACH_OBSERVER in c/b/chromeos with range-based for (Closed)
Patch Set: Created 4 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 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 chromeos::MountAccessMode access_mode) { 74 chromeos::MountAccessMode access_mode) {
75 mount_requests_.push_back( 75 mount_requests_.push_back(
76 MountRequest(source_path, source_format, mount_label, type, access_mode)); 76 MountRequest(source_path, source_format, mount_label, type, access_mode));
77 77
78 const MountPointInfo mount_point( 78 const MountPointInfo mount_point(
79 source_path, 79 source_path,
80 source_path, 80 source_path,
81 type, 81 type,
82 chromeos::disks::MOUNT_CONDITION_NONE); 82 chromeos::disks::MOUNT_CONDITION_NONE);
83 mount_points_.insert(make_pair(source_path, mount_point)); 83 mount_points_.insert(make_pair(source_path, mount_point));
84 FOR_EACH_OBSERVER(DiskMountManager::Observer, observers_, 84 for (auto& observer : observers_) {
85 OnMountEvent(DiskMountManager::MOUNTING, 85 observer.OnMountEvent(DiskMountManager::MOUNTING,
86 chromeos::MOUNT_ERROR_NONE, 86 chromeos::MOUNT_ERROR_NONE, mount_point);
87 mount_point)); 87 }
88 } 88 }
89 89
90 void FakeDiskMountManager::UnmountPath(const std::string& mount_path, 90 void FakeDiskMountManager::UnmountPath(const std::string& mount_path,
91 chromeos::UnmountOptions options, 91 chromeos::UnmountOptions options,
92 const UnmountPathCallback& callback) { 92 const UnmountPathCallback& callback) {
93 unmount_requests_.push_back(UnmountRequest(mount_path, options)); 93 unmount_requests_.push_back(UnmountRequest(mount_path, options));
94 94
95 MountPointMap::iterator iter = mount_points_.find(mount_path); 95 MountPointMap::iterator iter = mount_points_.find(mount_path);
96 if (iter == mount_points_.end()) 96 if (iter == mount_points_.end())
97 return; 97 return;
98 98
99 const MountPointInfo mount_point = iter->second; 99 const MountPointInfo mount_point = iter->second;
100 mount_points_.erase(iter); 100 mount_points_.erase(iter);
101 FOR_EACH_OBSERVER(DiskMountManager::Observer, observers_, 101 for (auto& observer : observers_) {
102 OnMountEvent(DiskMountManager::UNMOUNTING, 102 observer.OnMountEvent(DiskMountManager::UNMOUNTING,
103 chromeos::MOUNT_ERROR_NONE, 103 chromeos::MOUNT_ERROR_NONE, mount_point);
104 mount_point)); 104 }
105 105
106 // Enqueue callback so that |FakeDiskMountManager::FinishAllUnmountRequest()| 106 // Enqueue callback so that |FakeDiskMountManager::FinishAllUnmountRequest()|
107 // can call them. 107 // can call them.
108 pending_unmount_callbacks_.push(callback); 108 pending_unmount_callbacks_.push(callback);
109 } 109 }
110 110
111 bool FakeDiskMountManager::FinishAllUnmountPathRequests() { 111 bool FakeDiskMountManager::FinishAllUnmountPathRequests() {
112 if (pending_unmount_callbacks_.empty()) 112 if (pending_unmount_callbacks_.empty())
113 return false; 113 return false;
114 114
(...skipping 18 matching lines...) Expand all
133 } 133 }
134 134
135 bool FakeDiskMountManager::AddMountPointForTest( 135 bool FakeDiskMountManager::AddMountPointForTest(
136 const MountPointInfo& mount_point) { 136 const MountPointInfo& mount_point) {
137 return false; 137 return false;
138 } 138 }
139 139
140 void FakeDiskMountManager::InvokeDiskEventForTest( 140 void FakeDiskMountManager::InvokeDiskEventForTest(
141 chromeos::disks::DiskMountManager::DiskEvent event, 141 chromeos::disks::DiskMountManager::DiskEvent event,
142 const chromeos::disks::DiskMountManager::Disk* disk) { 142 const chromeos::disks::DiskMountManager::Disk* disk) {
143 FOR_EACH_OBSERVER(chromeos::disks::DiskMountManager::Observer, 143 for (auto& observer : observers_)
144 observers_, 144 observer.OnDiskEvent(event, disk);
145 OnDiskEvent(event, disk));
146 } 145 }
147 146
148 } // namespace file_manager 147 } // namespace file_manager
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_integration_service.cc ('k') | chrome/browser/chromeos/file_manager/volume_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698