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

Side by Side Diff: chrome/browser/chromeos/cros/mount_library.cc

Issue 7466046: Some filebrowser bugs and retiring DiskChanged event in filebrowser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/cros/mount_library.h" 5 #include "chrome/browser/chromeos/cros/mount_library.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 file_path_(file_path), 67 file_path_(file_path),
68 device_label_(device_label), 68 device_label_(device_label),
69 drive_label_(drive_label), 69 drive_label_(drive_label),
70 parent_path_(parent_path), 70 parent_path_(parent_path),
71 device_type_(device_type), 71 device_type_(device_type),
72 total_size_(total_size), 72 total_size_(total_size),
73 is_parent_(is_parent), 73 is_parent_(is_parent),
74 is_read_only_(is_read_only), 74 is_read_only_(is_read_only),
75 has_media_(has_media), 75 has_media_(has_media),
76 on_boot_device_(on_boot_device) { 76 on_boot_device_(on_boot_device) {
77 // Add trailing slash to mount path.
78 if (mount_path_.length() && mount_path_.at(mount_path_.length() -1) != '/')
79 mount_path_ = mount_path_.append("/");
80 } 77 }
81 78
82 MountLibrary::Disk::~Disk() {} 79 MountLibrary::Disk::~Disk() {}
83 80
84 class MountLibraryImpl : public MountLibrary { 81 class MountLibraryImpl : public MountLibrary {
85 82
86 struct UnmountDeviceRecursiveCallbackData { 83 struct UnmountDeviceRecursiveCallbackData {
87 MountLibraryImpl* const object; 84 MountLibraryImpl* const object;
88 void* user_data; 85 void* user_data;
89 UnmountDeviceRecursiveCallbackType callback; 86 UnmountDeviceRecursiveCallbackType callback;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 const MountPathOptions& options) OVERRIDE { 124 const MountPathOptions& options) OVERRIDE {
128 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 125 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
129 if (!CrosLibrary::Get()->EnsureLoaded()) { 126 if (!CrosLibrary::Get()->EnsureLoaded()) {
130 OnMountCompleted(MOUNT_ERROR_LIBRARY_NOT_LOADED, 127 OnMountCompleted(MOUNT_ERROR_LIBRARY_NOT_LOADED,
131 MountPointInfo(source_path, NULL, type)); 128 MountPointInfo(source_path, NULL, type));
132 return; 129 return;
133 } 130 }
134 MountSourcePath(source_path, type, options, &MountCompletedHandler, this); 131 MountSourcePath(source_path, type, options, &MountCompletedHandler, this);
135 } 132 }
136 133
137 virtual void UnmountPath(const char* path) OVERRIDE { 134 virtual void UnmountPath(const char* mount_path) OVERRIDE {
138 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 135 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
139 if (!CrosLibrary::Get()->EnsureLoaded()) { 136 if (!CrosLibrary::Get()->EnsureLoaded()) {
140 OnUnmountPath(path, 137 OnUnmountPath(mount_path,
141 MOUNT_METHOD_ERROR_LOCAL, 138 MOUNT_METHOD_ERROR_LOCAL,
142 kLibraryNotLoaded); 139 kLibraryNotLoaded);
143 return; 140 return;
144 } 141 }
145 UnmountMountPoint(path, &MountLibraryImpl::UnmountMountPointCallback, this); 142
143 UnmountMountPoint(mount_path, &MountLibraryImpl::UnmountMountPointCallback,
144 this);
146 } 145 }
147 146
148 virtual void FormatUnmountedDevice(const char* file_path) OVERRIDE { 147 virtual void FormatUnmountedDevice(const char* file_path) OVERRIDE {
149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
150 if (!CrosLibrary::Get()->EnsureLoaded()) { 149 if (!CrosLibrary::Get()->EnsureLoaded()) {
151 OnFormatDevice(file_path, 150 OnFormatDevice(file_path,
152 false, 151 false,
153 MOUNT_METHOD_ERROR_LOCAL, 152 MOUNT_METHOD_ERROR_LOCAL,
154 kLibraryNotLoaded); 153 kLibraryNotLoaded);
155 return; 154 return;
(...skipping 10 matching lines...) Expand all
166 } 165 }
167 } 166 }
168 FormatDevice(file_path, 167 FormatDevice(file_path,
169 "vfat", // currently format in vfat by default 168 "vfat", // currently format in vfat by default
170 &MountLibraryImpl::FormatDeviceCallback, 169 &MountLibraryImpl::FormatDeviceCallback,
171 this); 170 this);
172 } 171 }
173 172
174 virtual void FormatMountedDevice(const char* mount_path) OVERRIDE { 173 virtual void FormatMountedDevice(const char* mount_path) OVERRIDE {
175 DCHECK(mount_path); 174 DCHECK(mount_path);
176 std::string device_path, file_path; 175 std::string file_path;
177 for (MountLibrary::DiskMap::iterator it = disks_.begin(); 176 for (MountLibrary::DiskMap::iterator it = disks_.begin();
178 it != disks_.end(); ++it) { 177 it != disks_.end(); ++it) {
179 if (it->second->mount_path().compare(mount_path) == 0) { 178 if (it->second->mount_path().compare(mount_path) == 0) {
180 device_path = it->second->device_path();
181 file_path = it->second->file_path(); 179 file_path = it->second->file_path();
182 break; 180 break;
183 } 181 }
184 } 182 }
185 if (device_path.empty()) { 183 if (file_path.empty()) {
186 OnFormatDevice(device_path.c_str(), 184 OnFormatDevice(mount_path,
187 false, 185 false,
188 MOUNT_METHOD_ERROR_LOCAL, 186 MOUNT_METHOD_ERROR_LOCAL,
189 "Device with this mount path not found."); 187 "Device with this mount path not found.");
190 return; 188 return;
191 } 189 }
192 if (formatting_pending_.find(device_path) != formatting_pending_.end()) { 190 if (formatting_pending_.find(mount_path) != formatting_pending_.end()) {
193 OnFormatDevice(device_path.c_str(), 191 OnFormatDevice(mount_path,
194 false, 192 false,
195 MOUNT_METHOD_ERROR_LOCAL, 193 MOUNT_METHOD_ERROR_LOCAL,
196 "Formatting is already pending."); 194 "Formatting is already pending.");
197 return; 195 return;
198 } 196 }
199 // Formatting process continues, after unmounting. 197 // Formatting process continues, after unmounting.
200 formatting_pending_[device_path] = file_path; 198 formatting_pending_[mount_path] = file_path;
201 UnmountPath(device_path.c_str()); 199 UnmountPath(mount_path);
202 } 200 }
203 201
204 virtual void UnmountDeviceRecursive(const char* device_path, 202 virtual void UnmountDeviceRecursive(const char* device_path,
205 UnmountDeviceRecursiveCallbackType callback, void* user_data) 203 UnmountDeviceRecursiveCallbackType callback, void* user_data)
206 OVERRIDE { 204 OVERRIDE {
207 bool success = true; 205 bool success = true;
208 const char* error_message = NULL; 206 const char* error_message = NULL;
209 std::vector<const char*> devices_to_unmount; 207 std::vector<const char*> devices_to_unmount;
210 208
211 if (!CrosLibrary::Get()->EnsureLoaded()) { 209 if (!CrosLibrary::Get()->EnsureLoaded()) {
212 success = false; 210 success = false;
213 error_message = kLibraryNotLoaded; 211 error_message = kLibraryNotLoaded;
214 } else { 212 } else {
215 // Get list of all devices to unmount. 213 // Get list of all devices to unmount.
216 int device_path_len = strlen(device_path); 214 int device_path_len = strlen(device_path);
217 for (DiskMap::iterator it = disks_.begin(); it != disks_.end(); ++it) { 215 for (DiskMap::iterator it = disks_.begin(); it != disks_.end(); ++it) {
218 if (strncmp(device_path, it->second->device_path().c_str(), 216 if (!it->second->mount_path().empty() &&
219 device_path_len) == 0) { 217 strncmp(device_path, it->second->device_path().c_str(),
220 devices_to_unmount.push_back(it->second->device_path().c_str()); 218 device_path_len) == 0) {
219 devices_to_unmount.push_back(it->second->mount_path().c_str());
221 } 220 }
222 } 221 }
223 222
224 // We should detect at least original device. 223 // We should detect at least original device.
225 if (devices_to_unmount.size() == 0) { 224 if (devices_to_unmount.size() == 0) {
226 success = false; 225 if (disks_.find(device_path) == disks_.end()) {
227 error_message = kDeviceNotFound; 226 success = false;
227 error_message = kDeviceNotFound;
228 } else {
229 // Nothing to unmount.
230 callback(user_data, true);
231 return;
232 }
228 } 233 }
229 } 234 }
230 235
231 if (success) { 236 if (success) {
232 // We will send the same callback data object to all Unmount calls and use 237 // We will send the same callback data object to all Unmount calls and use
233 // it to syncronize callbacks. 238 // it to syncronize callbacks.
234 UnmountDeviceRecursiveCallbackData* 239 UnmountDeviceRecursiveCallbackData*
235 cb_data = new UnmountDeviceRecursiveCallbackData(this, user_data, 240 cb_data = new UnmountDeviceRecursiveCallbackData(this, user_data,
236 callback, devices_to_unmount.size()); 241 callback, devices_to_unmount.size());
237 for (std::vector<const char*>::iterator it = devices_to_unmount.begin(); 242 for (std::vector<const char*>::iterator it = devices_to_unmount.begin();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 MountType type, 278 MountType type,
274 const char* mount_path) { 279 const char* mount_path) {
275 DCHECK(object); 280 DCHECK(object);
276 MountLibraryImpl* self = static_cast<MountLibraryImpl*>(object); 281 MountLibraryImpl* self = static_cast<MountLibraryImpl*>(object);
277 self->OnMountCompleted(static_cast<MountError>(error_code), 282 self->OnMountCompleted(static_cast<MountError>(error_code),
278 MountPointInfo(source_path, mount_path, type)); 283 MountPointInfo(source_path, mount_path, type));
279 } 284 }
280 285
281 // Callback for UnmountRemovableDevice method. 286 // Callback for UnmountRemovableDevice method.
282 static void UnmountMountPointCallback(void* object, 287 static void UnmountMountPointCallback(void* object,
283 const char* device_path, 288 const char* mount_path,
284 MountMethodErrorType error, 289 MountMethodErrorType error,
285 const char* error_message) { 290 const char* error_message) {
286 DCHECK(object); 291 DCHECK(object);
287 MountLibraryImpl* self = static_cast<MountLibraryImpl*>(object); 292 MountLibraryImpl* self = static_cast<MountLibraryImpl*>(object);
288 self->OnUnmountPath(device_path, error, error_message); 293 self->OnUnmountPath(mount_path, error, error_message);
289 } 294 }
290 295
291 // Callback for FormatRemovableDevice method. 296 // Callback for FormatRemovableDevice method.
292 static void FormatDeviceCallback(void* object, 297 static void FormatDeviceCallback(void* object,
293 const char* device_path, 298 const char* device_path,
294 bool success, 299 bool success,
295 MountMethodErrorType error, 300 MountMethodErrorType error,
296 const char* error_message) { 301 const char* error_message) {
297 DCHECK(object); 302 DCHECK(object);
298 MountLibraryImpl* self = static_cast<MountLibraryImpl*>(object); 303 MountLibraryImpl* self = static_cast<MountLibraryImpl*>(object);
299 self->OnFormatDevice(device_path, success, error, error_message); 304 self->OnFormatDevice(device_path, success, error, error_message);
300 } 305 }
301 306
302 // Callback for UnmountDeviceRecursive. 307 // Callback for UnmountDeviceRecursive.
303 static void UnmountDeviceRecursiveCallback(void* object, 308 static void UnmountDeviceRecursiveCallback(void* object,
304 const char* device_path, 309 const char* mount_path,
305 MountMethodErrorType error, 310 MountMethodErrorType error,
306 const char* error_message) { 311 const char* error_message) {
307 DCHECK(object); 312 DCHECK(object);
308 UnmountDeviceRecursiveCallbackData* cb_data = 313 UnmountDeviceRecursiveCallbackData* cb_data =
309 static_cast<UnmountDeviceRecursiveCallbackData*>(object); 314 static_cast<UnmountDeviceRecursiveCallbackData*>(object);
310 315
311 // Do standard processing for Unmount event. 316 // Do standard processing for Unmount event.
312 cb_data->object->OnUnmountPath(device_path, 317 cb_data->object->OnUnmountPath(mount_path,
313 error, 318 error,
314 error_message); 319 error_message);
315 if (error == MOUNT_METHOD_ERROR_LOCAL) { 320 if (error == MOUNT_METHOD_ERROR_LOCAL) {
316 cb_data->success = false; 321 cb_data->success = false;
317 } else if (error == MOUNT_METHOD_ERROR_NONE) { 322 } else if (error == MOUNT_METHOD_ERROR_NONE) {
318 LOG(WARNING) << device_path << " unmounted."; 323 LOG(INFO) << mount_path << " unmounted.";
319 } 324 }
320 325
321 // This is safe as long as all callbacks are called on the same thread as 326 // This is safe as long as all callbacks are called on the same thread as
322 // UnmountDeviceRecursive. 327 // UnmountDeviceRecursive.
323 cb_data->pending_callbacks_count--; 328 cb_data->pending_callbacks_count--;
324 329
325 if (cb_data->pending_callbacks_count == 0) { 330 if (cb_data->pending_callbacks_count == 0) {
326 cb_data->callback(cb_data->user_data, cb_data->success); 331 cb_data->callback(cb_data->user_data, cb_data->success);
327 delete cb_data; 332 delete cb_data;
328 } 333 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 DCHECK(object); 368 DCHECK(object);
364 MountLibraryImpl* self = static_cast<MountLibraryImpl*>(object); 369 MountLibraryImpl* self = static_cast<MountLibraryImpl*>(object);
365 self->OnMountEvent(evt, device_path); 370 self->OnMountEvent(evt, device_path);
366 } 371 }
367 372
368 373
369 void OnMountCompleted(MountError error_code, 374 void OnMountCompleted(MountError error_code,
370 const MountPointInfo& mount_info) { 375 const MountPointInfo& mount_info) {
371 DCHECK(!mount_info.source_path.empty()); 376 DCHECK(!mount_info.source_path.empty());
372 377
373 FireMountCompleted(MOUNTING, 378 FireMountCompleted(MOUNTING, error_code, mount_info);
374 error_code,
375 mount_info);
376 379
377 if (error_code == MOUNT_ERROR_NONE && 380 if (error_code == MOUNT_ERROR_NONE &&
378 mount_points_.find(mount_info.source_path) == mount_points_.end()) { 381 mount_points_.find(mount_info.mount_path) == mount_points_.end()) {
379 mount_points_.insert(MountPointMap::value_type( 382 mount_points_.insert(MountPointMap::value_type(
380 mount_info.source_path.c_str(), 383 mount_info.mount_path.c_str(),
381 mount_info)); 384 mount_info));
382 } 385 }
383 386
384 if (error_code == MOUNT_ERROR_NONE && 387 if (error_code == MOUNT_ERROR_NONE &&
385 mount_info.mount_type == MOUNT_TYPE_DEVICE && 388 mount_info.mount_type == MOUNT_TYPE_DEVICE &&
386 !mount_info.source_path.empty() && 389 !mount_info.source_path.empty() &&
387 !mount_info.mount_path.empty()) { 390 !mount_info.mount_path.empty()) {
388 std::string path(mount_info.source_path); 391 std::string path(mount_info.source_path);
389 DiskMap::iterator iter = disks_.find(path); 392 DiskMap::iterator iter = disks_.find(path);
390 if (iter == disks_.end()) { 393 if (iter == disks_.end()) {
391 // disk might have been removed by now? 394 // disk might have been removed by now?
392 return; 395 return;
393 } 396 }
394 Disk* disk = iter->second; 397 Disk* disk = iter->second;
395 DCHECK(disk); 398 DCHECK(disk);
396 disk->set_mount_path(mount_info.mount_path.c_str()); 399 disk->set_mount_path(mount_info.mount_path.c_str());
397 FireDiskStatusUpdate(MOUNT_DISK_MOUNTED, disk); 400 FireDiskStatusUpdate(MOUNT_DISK_MOUNTED, disk);
398 } 401 }
399 } 402 }
400 403
401 void OnUnmountPath(const char* source_path, 404 void OnUnmountPath(const char* mount_path,
402 MountMethodErrorType error, 405 MountMethodErrorType error,
403 const char* error_message) { 406 const char* error_message) {
404 DCHECK(source_path); 407 DCHECK(mount_path);
405 408 if (error == MOUNT_METHOD_ERROR_NONE && mount_path) {
406 if (error == MOUNT_METHOD_ERROR_NONE && source_path) { 409 MountPointMap::iterator mount_points_it = mount_points_.find(mount_path);
407 MountPointMap::iterator mount_points_it = mount_points_.find(source_path);
408 if (mount_points_it == mount_points_.end()) 410 if (mount_points_it == mount_points_.end())
409 return; 411 return;
410 // TODO(tbarzic): Add separate, PathUnmounted event to Observer. 412 // TODO(tbarzic): Add separate, PathUnmounted event to Observer.
411 FireMountCompleted( 413 FireMountCompleted(
412 UNMOUNTING, 414 UNMOUNTING,
413 MOUNT_ERROR_NONE, 415 MOUNT_ERROR_NONE,
414 MountPointInfo(mount_points_it->second.source_path.c_str(), 416 MountPointInfo(mount_points_it->second.source_path.c_str(),
415 mount_points_it->second.mount_path.c_str(), 417 mount_points_it->second.mount_path.c_str(),
416 mount_points_it->second.mount_type)); 418 mount_points_it->second.mount_type));
419 std::string path(mount_points_it->second.source_path);
417 mount_points_.erase(mount_points_it); 420 mount_points_.erase(mount_points_it);
418 421
419 std::string path(source_path);
420 DiskMap::iterator iter = disks_.find(path); 422 DiskMap::iterator iter = disks_.find(path);
421 if (iter == disks_.end()) { 423 if (iter == disks_.end()) {
422 // disk might have been removed by now? 424 // disk might have been removed by now?
423 return; 425 return;
424 } 426 }
425 Disk* disk = iter->second; 427 Disk* disk = iter->second;
426 DCHECK(disk); 428 DCHECK(disk);
427 disk->clear_mount_path(); 429 disk->clear_mount_path();
428 FireDiskStatusUpdate(MOUNT_DISK_UNMOUNTED, disk); 430 FireDiskStatusUpdate(MOUNT_DISK_UNMOUNTED, disk);
429 // Check if there is a formatting scheduled 431 // Check if there is a formatting scheduled
430 PathMap::iterator it = formatting_pending_.find(source_path); 432 PathMap::iterator it = formatting_pending_.find(mount_path);
431 if (it != formatting_pending_.end()) { 433 if (it != formatting_pending_.end()) {
432 const std::string file_path = it->second; 434 const std::string file_path = it->second;
433 formatting_pending_.erase(it); 435 formatting_pending_.erase(it);
434 FormatUnmountedDevice(file_path.c_str()); 436 FormatUnmountedDevice(file_path.c_str());
435 } 437 }
436 } else { 438 } else {
437 LOG(WARNING) << "Unmount request failed for device " 439 LOG(WARNING) << "Unmount request failed for device "
438 << source_path << ", with error: " 440 << mount_path << ", with error: "
439 << (error_message ? error_message : "Unknown"); 441 << (error_message ? error_message : "Unknown");
440 } 442 }
441 } 443 }
442 444
443 void OnFormatDevice(const char* device_path, 445 void OnFormatDevice(const char* device_path,
444 bool success, 446 bool success,
445 MountMethodErrorType error, 447 MountMethodErrorType error,
446 const char* error_message) { 448 const char* error_message) {
447 DCHECK(device_path); 449 DCHECK(device_path);
448 450
449 if (error == MOUNT_METHOD_ERROR_NONE && device_path && success) { 451 if (error == MOUNT_METHOD_ERROR_NONE && device_path && success) {
450 FireDeviceStatusUpdate(MOUNT_FORMATTING_STARTED, device_path); 452 FireDeviceStatusUpdate(MOUNT_FORMATTING_STARTED, device_path);
451 } else { 453 } else {
452 FireDeviceStatusUpdate(MOUNT_FORMATTING_STARTED, 454 FireDeviceStatusUpdate(MOUNT_FORMATTING_STARTED,
453 std::string("!") + device_path); 455 std::string("!") + device_path);
454 LOG(WARNING) << "Format request failed for device " 456 LOG(WARNING) << "Format request failed for device "
455 << device_path << ", with error: " 457 << device_path << ", with error: "
456 << (error_message ? error_message : "Unknown"); 458 << (error_message ? error_message : "Unknown");
457 } 459 }
458 } 460 }
459 461
460
461 void OnGetDiskProperties(const char* device_path, 462 void OnGetDiskProperties(const char* device_path,
462 const DiskInfo* disk1, 463 const DiskInfo* disk1,
463 MountMethodErrorType error, 464 MountMethodErrorType error,
464 const char* error_message) { 465 const char* error_message) {
465 DCHECK(device_path); 466 DCHECK(device_path);
466 if (error == MOUNT_METHOD_ERROR_NONE && device_path) { 467 if (error == MOUNT_METHOD_ERROR_NONE && device_path) {
467 // TODO(zelidrag): Find a better way to filter these out before we 468 // TODO(zelidrag): Find a better way to filter these out before we
468 // fetch the properties: 469 // fetch the properties:
469 // Ignore disks coming from the device we booted the system from. 470 // Ignore disks coming from the device we booted the system from.
470 471
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 // MountLibrary overrides. 685 // MountLibrary overrides.
685 virtual void AddObserver(Observer* observer) OVERRIDE {} 686 virtual void AddObserver(Observer* observer) OVERRIDE {}
686 virtual void RemoveObserver(Observer* observer) OVERRIDE {} 687 virtual void RemoveObserver(Observer* observer) OVERRIDE {}
687 virtual const DiskMap& disks() const OVERRIDE { return disks_; } 688 virtual const DiskMap& disks() const OVERRIDE { return disks_; }
688 virtual const MountPointMap& mount_points() const OVERRIDE { 689 virtual const MountPointMap& mount_points() const OVERRIDE {
689 return mount_points_; 690 return mount_points_;
690 } 691 }
691 virtual void RequestMountInfoRefresh() OVERRIDE {} 692 virtual void RequestMountInfoRefresh() OVERRIDE {}
692 virtual void MountPath(const char* source_path, MountType type, 693 virtual void MountPath(const char* source_path, MountType type,
693 const MountPathOptions& options) OVERRIDE {} 694 const MountPathOptions& options) OVERRIDE {}
694 virtual void UnmountPath(const char* path) OVERRIDE {} 695 virtual void UnmountPath(const char* mount_path) OVERRIDE {}
695 virtual void FormatUnmountedDevice(const char* device_path) OVERRIDE {} 696 virtual void FormatUnmountedDevice(const char* device_path) OVERRIDE {}
696 virtual void FormatMountedDevice(const char* mount_path) OVERRIDE {} 697 virtual void FormatMountedDevice(const char* mount_path) OVERRIDE {}
697 virtual void UnmountDeviceRecursive(const char* device_path, 698 virtual void UnmountDeviceRecursive(const char* device_path,
698 UnmountDeviceRecursiveCallbackType callback, void* user_data) 699 UnmountDeviceRecursiveCallbackType callback, void* user_data)
699 OVERRIDE {} 700 OVERRIDE {}
700 701
701 private: 702 private:
702 // The list of disks found. 703 // The list of disks found.
703 DiskMap disks_; 704 DiskMap disks_;
704 MountPointMap mount_points_; 705 MountPointMap mount_points_;
705 706
706 DISALLOW_COPY_AND_ASSIGN(MountLibraryStubImpl); 707 DISALLOW_COPY_AND_ASSIGN(MountLibraryStubImpl);
707 }; 708 };
708 709
709 // static 710 // static
710 MountLibrary* MountLibrary::GetImpl(bool stub) { 711 MountLibrary* MountLibrary::GetImpl(bool stub) {
711 if (stub) 712 if (stub)
712 return new MountLibraryStubImpl(); 713 return new MountLibraryStubImpl();
713 else 714 else
714 return new MountLibraryImpl(); 715 return new MountLibraryImpl();
715 } 716 }
716 717
717 } // namespace chromeos 718 } // namespace chromeos
718 719
719 // Allows InvokeLater without adding refcounting. This class is a Singleton and 720 // Allows InvokeLater without adding refcounting. This class is a Singleton and
720 // won't be deleted until it's last InvokeLater is run. 721 // won't be deleted until it's last InvokeLater is run.
721 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::MountLibraryImpl); 722 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::MountLibraryImpl);
722 723
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698