| OLD | NEW |
| 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 | 8 |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 // MountLibrary overrides. | 84 // MountLibrary overrides. |
| 85 virtual void AddObserver(Observer* observer) OVERRIDE { | 85 virtual void AddObserver(Observer* observer) OVERRIDE { |
| 86 observers_.AddObserver(observer); | 86 observers_.AddObserver(observer); |
| 87 } | 87 } |
| 88 | 88 |
| 89 virtual void RemoveObserver(Observer* observer) OVERRIDE { | 89 virtual void RemoveObserver(Observer* observer) OVERRIDE { |
| 90 observers_.RemoveObserver(observer); | 90 observers_.RemoveObserver(observer); |
| 91 } | 91 } |
| 92 | 92 |
| 93 virtual void MountPath(const char* device_path) OVERRIDE { | 93 virtual std::string MountTypeToString(MountType type) const OVERRIDE { |
| 94 switch (type) { |
| 95 case MOUNT_TYPE_DEVICE: |
| 96 return "device"; |
| 97 case MOUNT_TYPE_ARCHIVE: |
| 98 return "file"; |
| 99 case MOUNT_TYPE_NETWORK_STORAGE: |
| 100 return "network"; |
| 101 case MOUNT_TYPE_INVALID: |
| 102 return "invalid"; |
| 103 default: |
| 104 NOTREACHED(); |
| 105 } |
| 106 return ""; |
| 107 } |
| 108 |
| 109 virtual MountType MountTypeFromString(const std::string& type_str) const |
| 110 OVERRIDE { |
| 111 if (type_str == "device") { |
| 112 return MOUNT_TYPE_DEVICE; |
| 113 } else if (type_str == "network") { |
| 114 return MOUNT_TYPE_NETWORK_STORAGE; |
| 115 } else if (type_str == "file") { |
| 116 return MOUNT_TYPE_ARCHIVE; |
| 117 } else { |
| 118 return MOUNT_TYPE_INVALID; |
| 119 } |
| 120 } |
| 121 |
| 122 virtual void MountPath(const char* source_path, |
| 123 MountType type, |
| 124 const MountPathOptions& options) OVERRIDE { |
| 94 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 125 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 95 if (!CrosLibrary::Get()->EnsureLoaded()) { | 126 if (!CrosLibrary::Get()->EnsureLoaded()) { |
| 96 OnMountRemovableDevice(device_path, | 127 OnMountCompleted(MOUNT_ERROR_LIBRARY_NOT_LOADED, |
| 97 NULL, | 128 source_path, |
| 98 MOUNT_METHOD_ERROR_LOCAL, | 129 type, |
| 99 kLibraryNotLoaded); | 130 NULL); |
| 100 return; | 131 return; |
| 101 } | 132 } |
| 102 MountRemovableDevice(device_path, | 133 MountSourcePath(source_path, type, options, &MountCompletedHandler, this); |
| 103 &MountLibraryImpl::MountRemovableDeviceCallback, | |
| 104 this); | |
| 105 } | 134 } |
| 106 | 135 |
| 107 virtual void UnmountPath(const char* device_path) OVERRIDE { | 136 virtual void UnmountPath(const char* path) OVERRIDE { |
| 108 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 137 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 109 if (!CrosLibrary::Get()->EnsureLoaded()) { | 138 if (!CrosLibrary::Get()->EnsureLoaded()) { |
| 110 OnUnmountRemovableDevice(device_path, | 139 OnUnmountPath(path, |
| 111 MOUNT_METHOD_ERROR_LOCAL, | 140 MOUNT_METHOD_ERROR_LOCAL, |
| 112 kLibraryNotLoaded); | 141 kLibraryNotLoaded); |
| 113 return; | 142 return; |
| 114 } | 143 } |
| 115 UnmountRemovableDevice(device_path, | 144 UnmountMountPoint(path, &MountLibraryImpl::UnmountMountPointCallback, this); |
| 116 &MountLibraryImpl::UnmountRemovableDeviceCallback, | |
| 117 this); | |
| 118 } | 145 } |
| 119 | 146 |
| 120 virtual void UnmountDeviceRecursive(const char* device_path, | 147 virtual void UnmountDeviceRecursive(const char* device_path, |
| 121 UnmountDeviceRecursiveCallbackType callback, void* user_data) | 148 UnmountDeviceRecursiveCallbackType callback, void* user_data) |
| 122 OVERRIDE { | 149 OVERRIDE { |
| 123 bool success = true; | 150 bool success = true; |
| 124 const char* error_message = NULL; | 151 const char* error_message = NULL; |
| 125 std::vector<const char*> devices_to_unmount; | 152 std::vector<const char*> devices_to_unmount; |
| 126 | 153 |
| 127 if (!CrosLibrary::Get()->EnsureLoaded()) { | 154 if (!CrosLibrary::Get()->EnsureLoaded()) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 144 } | 171 } |
| 145 } | 172 } |
| 146 | 173 |
| 147 if (success) { | 174 if (success) { |
| 148 // We will send the same callback data object to all Unmount calls and use | 175 // We will send the same callback data object to all Unmount calls and use |
| 149 // it to syncronize callbacks. | 176 // it to syncronize callbacks. |
| 150 UnmountDeviceRecursiveCallbackData* | 177 UnmountDeviceRecursiveCallbackData* |
| 151 cb_data = new UnmountDeviceRecursiveCallbackData(this, user_data, | 178 cb_data = new UnmountDeviceRecursiveCallbackData(this, user_data, |
| 152 callback, devices_to_unmount.size()); | 179 callback, devices_to_unmount.size()); |
| 153 for (std::vector<const char*>::iterator it = devices_to_unmount.begin(); | 180 for (std::vector<const char*>::iterator it = devices_to_unmount.begin(); |
| 154 it != devices_to_unmount.end(); | 181 it != devices_to_unmount.end(); |
| 155 ++it) { | 182 ++it) { |
| 156 UnmountRemovableDevice(*it, | 183 UnmountMountPoint( |
| 184 *it, |
| 157 &MountLibraryImpl::UnmountDeviceRecursiveCallback, | 185 &MountLibraryImpl::UnmountDeviceRecursiveCallback, |
| 158 cb_data); | 186 cb_data); |
| 159 } | 187 } |
| 160 } else { | 188 } else { |
| 161 LOG(WARNING) << "Unmount recursive request failed for device " | 189 LOG(WARNING) << "Unmount recursive request failed for device " |
| 162 << device_path << ", with error: " << error_message; | 190 << device_path << ", with error: " << error_message; |
| 163 callback(user_data, false); | 191 callback(user_data, false); |
| 164 } | 192 } |
| 165 } | 193 } |
| 166 | 194 |
| 167 virtual void RequestMountInfoRefresh() OVERRIDE { | 195 virtual void RequestMountInfoRefresh() OVERRIDE { |
| 168 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 196 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 169 if (!CrosLibrary::Get()->EnsureLoaded()) { | 197 if (!CrosLibrary::Get()->EnsureLoaded()) { |
| 170 OnRequestMountInfo(NULL, | 198 OnRequestMountInfo(NULL, |
| 171 0, | 199 0, |
| 172 MOUNT_METHOD_ERROR_LOCAL, | 200 MOUNT_METHOD_ERROR_LOCAL, |
| 173 kLibraryNotLoaded); | 201 kLibraryNotLoaded); |
| 174 return; | 202 return; |
| 175 } | 203 } |
| 176 RequestMountInfo(&MountLibraryImpl::RequestMountInfoCallback, | 204 RequestMountInfo(&MountLibraryImpl::RequestMountInfoCallback, |
| 177 this); | 205 this); |
| 178 } | 206 } |
| 179 | 207 |
| 180 const DiskMap& disks() const OVERRIDE { return disks_; } | 208 const DiskMap& disks() const OVERRIDE { return disks_; } |
| 209 const MountPointMap& mount_points() const OVERRIDE { return mount_points_; } |
| 181 | 210 |
| 182 private: | 211 private: |
| 183 // Callback for MountRemovableDevice method. | 212 // Callback for MountComplete signal and MountSourcePath method. |
| 184 static void MountRemovableDeviceCallback(void* object, | 213 static void MountCompletedHandler(void* object, |
| 185 const char* device_path, | 214 MountError error_code, |
| 186 const char* mount_path, | 215 const char* source_path, |
| 187 MountMethodErrorType error, | 216 MountType type, |
| 188 const char* error_message) { | 217 const char* mount_path) { |
| 189 DCHECK(object); | 218 DCHECK(object); |
| 190 MountLibraryImpl* self = static_cast<MountLibraryImpl*>(object); | 219 MountLibraryImpl* self = static_cast<MountLibraryImpl*>(object); |
| 191 self->OnMountRemovableDevice(device_path, | 220 self->OnMountCompleted(static_cast<MountError>(error_code), |
| 192 mount_path, | 221 source_path, |
| 193 error, | 222 static_cast<MountType>(type), |
| 194 error_message); | 223 mount_path); |
| 195 } | 224 } |
| 196 | 225 |
| 197 // Callback for UnmountRemovableDevice method. | 226 // Callback for UnmountRemovableDevice method. |
| 198 static void UnmountRemovableDeviceCallback(void* object, | 227 static void UnmountMountPointCallback(void* object, |
| 199 const char* device_path, | 228 const char* device_path, |
| 200 const char* mount_path, | 229 MountMethodErrorType error, |
| 201 MountMethodErrorType error, | 230 const char* error_message) { |
| 202 const char* error_message) { | |
| 203 DCHECK(object); | 231 DCHECK(object); |
| 204 MountLibraryImpl* self = static_cast<MountLibraryImpl*>(object); | 232 MountLibraryImpl* self = static_cast<MountLibraryImpl*>(object); |
| 205 self->OnUnmountRemovableDevice(device_path, | 233 self->OnUnmountPath(device_path, error, error_message); |
| 206 error, | |
| 207 error_message); | |
| 208 } | 234 } |
| 209 | 235 |
| 210 // Callback for UnmountDeviceRecursive. | 236 // Callback for UnmountDeviceRecursive. |
| 211 static void UnmountDeviceRecursiveCallback(void* object, | 237 static void UnmountDeviceRecursiveCallback(void* object, |
| 212 const char* device_path, | 238 const char* device_path, |
| 213 const char* mount_path, | |
| 214 MountMethodErrorType error, | 239 MountMethodErrorType error, |
| 215 const char* error_message) { | 240 const char* error_message) { |
| 216 DCHECK(object); | 241 DCHECK(object); |
| 217 UnmountDeviceRecursiveCallbackData* cb_data = | 242 UnmountDeviceRecursiveCallbackData* cb_data = |
| 218 static_cast<UnmountDeviceRecursiveCallbackData*>(object); | 243 static_cast<UnmountDeviceRecursiveCallbackData*>(object); |
| 219 | 244 |
| 220 // Do standard processing for Unmount event. | 245 // Do standard processing for Unmount event. |
| 221 cb_data->object->OnUnmountRemovableDevice(device_path, | 246 cb_data->object->OnUnmountPath(device_path, |
| 222 error, | 247 error, |
| 223 error_message); | 248 error_message); |
| 224 if (error == MOUNT_METHOD_ERROR_LOCAL) { | 249 if (error == MOUNT_METHOD_ERROR_LOCAL) { |
| 225 cb_data->success = false; | 250 cb_data->success = false; |
| 226 } else if (error == MOUNT_METHOD_ERROR_NONE) { | 251 } else if (error == MOUNT_METHOD_ERROR_NONE) { |
| 227 LOG(WARNING) << device_path << " unmounted."; | 252 LOG(WARNING) << device_path << " unmounted."; |
| 228 } | 253 } |
| 229 | 254 |
| 230 // This is safe as long as all callbacks are called on the same thread as | 255 // This is safe as long as all callbacks are called on the same thread as |
| 231 // UnmountDeviceRecursive. | 256 // UnmountDeviceRecursive. |
| 232 cb_data->pending_callbacks_count--; | 257 cb_data->pending_callbacks_count--; |
| 233 | 258 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 // This method will receive events that are caused by drive status changes. | 293 // This method will receive events that are caused by drive status changes. |
| 269 static void MonitorMountEventsHandler(void* object, | 294 static void MonitorMountEventsHandler(void* object, |
| 270 MountEventType evt, | 295 MountEventType evt, |
| 271 const char* device_path) { | 296 const char* device_path) { |
| 272 DCHECK(object); | 297 DCHECK(object); |
| 273 MountLibraryImpl* self = static_cast<MountLibraryImpl*>(object); | 298 MountLibraryImpl* self = static_cast<MountLibraryImpl*>(object); |
| 274 self->OnMountEvent(evt, device_path); | 299 self->OnMountEvent(evt, device_path); |
| 275 } | 300 } |
| 276 | 301 |
| 277 | 302 |
| 278 void OnMountRemovableDevice(const char* device_path, | 303 void OnMountCompleted(MountError error_code, |
| 279 const char* mount_path, | 304 const char* source_path, |
| 280 MountMethodErrorType error, | 305 MountType type, |
| 281 const char* error_message) { | 306 const char* mount_path) { |
| 282 DCHECK(device_path); | 307 DCHECK(source_path); |
| 283 | 308 |
| 284 if (error == MOUNT_METHOD_ERROR_NONE && device_path && mount_path) { | 309 FireMountCompleted(MOUNTING, error_code, source_path, type, mount_path); |
| 285 std::string path(device_path); | 310 |
| 311 if (error_code == MOUNT_ERROR_NONE && |
| 312 mount_points_.find(source_path) == mount_points_.end()) { |
| 313 mount_points_.insert(MountPointMap::value_type(source_path, |
| 314 MountPointInfo(source_path, mount_path, type))); |
| 315 } |
| 316 |
| 317 if (error_code == MOUNT_ERROR_NONE && type == MOUNT_TYPE_DEVICE && |
| 318 source_path && mount_path) { |
| 319 std::string path(source_path); |
| 286 DiskMap::iterator iter = disks_.find(path); | 320 DiskMap::iterator iter = disks_.find(path); |
| 287 if (iter == disks_.end()) { | 321 if (iter == disks_.end()) { |
| 288 // disk might have been removed by now? | 322 // disk might have been removed by now? |
| 289 return; | 323 return; |
| 290 } | 324 } |
| 291 Disk* disk = iter->second; | 325 Disk* disk = iter->second; |
| 292 DCHECK(disk); | 326 DCHECK(disk); |
| 293 disk->set_mount_path(mount_path); | 327 disk->set_mount_path(mount_path); |
| 294 FireDiskStatusUpdate(MOUNT_DISK_MOUNTED, disk); | 328 FireDiskStatusUpdate(MOUNT_DISK_MOUNTED, disk); |
| 295 } else { | |
| 296 LOG(WARNING) << "Mount request failed for device " | |
| 297 << device_path << ", with error: " | |
| 298 << (error_message ? error_message : "Unknown"); | |
| 299 } | 329 } |
| 300 } | 330 } |
| 301 | 331 |
| 302 void OnUnmountRemovableDevice(const char* device_path, | 332 void OnUnmountPath(const char* source_path, |
| 303 MountMethodErrorType error, | 333 MountMethodErrorType error, |
| 304 const char* error_message) { | 334 const char* error_message) { |
| 305 DCHECK(device_path); | 335 DCHECK(source_path); |
| 306 if (error == MOUNT_METHOD_ERROR_NONE && device_path) { | 336 |
| 307 std::string path(device_path); | 337 if (error == MOUNT_METHOD_ERROR_NONE && source_path) { |
| 338 MountPointMap::iterator mount_points_it = mount_points_.find(source_path); |
| 339 if (mount_points_it == mount_points_.end()) |
| 340 return; |
| 341 // TODO(tbarzic): Add separate, PathUnmounted event to Observer. |
| 342 FireMountCompleted(UNMOUNTING, |
| 343 MOUNT_ERROR_NONE, |
| 344 mount_points_it->second.source_path.c_str(), |
| 345 mount_points_it->second.mount_type, |
| 346 mount_points_it->second.mount_path.c_str()); |
| 347 mount_points_.erase(mount_points_it); |
| 348 |
| 349 std::string path(source_path); |
| 308 DiskMap::iterator iter = disks_.find(path); | 350 DiskMap::iterator iter = disks_.find(path); |
| 309 if (iter == disks_.end()) { | 351 if (iter == disks_.end()) { |
| 310 // disk might have been removed by now? | 352 // disk might have been removed by now? |
| 311 return; | 353 return; |
| 312 } | 354 } |
| 313 Disk* disk = iter->second; | 355 Disk* disk = iter->second; |
| 314 DCHECK(disk); | 356 DCHECK(disk); |
| 315 disk->clear_mount_path(); | 357 disk->clear_mount_path(); |
| 316 FireDiskStatusUpdate(MOUNT_DISK_UNMOUNTED, disk); | 358 FireDiskStatusUpdate(MOUNT_DISK_UNMOUNTED, disk); |
| 317 } else { | 359 } else { |
| 318 LOG(WARNING) << "Unmount request failed for device " | 360 LOG(WARNING) << "Unmount request failed for device " |
| 319 << device_path << ", with error: " | 361 << source_path << ", with error: " |
| 320 << (error_message ? error_message : "Unknown"); | 362 << (error_message ? error_message : "Unknown"); |
| 321 } | 363 } |
| 322 } | 364 } |
| 323 | 365 |
| 324 void OnGetDiskProperties(const char* device_path, | 366 void OnGetDiskProperties(const char* device_path, |
| 325 const DiskInfo* disk1, | 367 const DiskInfo* disk1, |
| 326 MountMethodErrorType error, | 368 MountMethodErrorType error, |
| 327 const char* error_message) { | 369 const char* error_message) { |
| 328 DCHECK(device_path); | 370 DCHECK(device_path); |
| 329 if (error == MOUNT_METHOD_ERROR_NONE && device_path) { | 371 if (error == MOUNT_METHOD_ERROR_NONE && device_path) { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 break; | 511 break; |
| 470 } | 512 } |
| 471 case DEVICE_REMOVED: { | 513 case DEVICE_REMOVED: { |
| 472 type = MOUNT_DEVICE_REMOVED; | 514 type = MOUNT_DEVICE_REMOVED; |
| 473 break; | 515 break; |
| 474 } | 516 } |
| 475 case DEVICE_SCANNED: { | 517 case DEVICE_SCANNED: { |
| 476 type = MOUNT_DEVICE_SCANNED; | 518 type = MOUNT_DEVICE_SCANNED; |
| 477 break; | 519 break; |
| 478 } | 520 } |
| 479 default: | 521 default: { |
| 480 return; | 522 return; |
| 523 } |
| 481 } | 524 } |
| 482 FireDeviceStatusUpdate(type, std::string(device_path)); | 525 FireDeviceStatusUpdate(type, std::string(device_path)); |
| 483 } | 526 } |
| 484 | 527 |
| 485 void Init() { | 528 void Init() { |
| 486 // Getting the monitor status so that the daemon starts up. | 529 // Getting the monitor status so that the daemon starts up. |
| 487 mount_status_connection_ = MonitorMountEvents( | 530 mount_status_connection_ = MonitorAllMountEvents( |
| 488 &MonitorMountEventsHandler, this); | 531 &MonitorMountEventsHandler, &MountCompletedHandler, this); |
| 489 } | 532 } |
| 490 | 533 |
| 491 void FireDiskStatusUpdate(MountLibraryEventType evt, | 534 void FireDiskStatusUpdate(MountLibraryEventType evt, |
| 492 const Disk* disk) { | 535 const Disk* disk) { |
| 493 // Make sure we run on UI thread. | 536 // Make sure we run on UI thread. |
| 494 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 537 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 495 FOR_EACH_OBSERVER( | 538 FOR_EACH_OBSERVER( |
| 496 Observer, observers_, DiskChanged(evt, disk)); | 539 Observer, observers_, DiskChanged(evt, disk)); |
| 497 } | 540 } |
| 498 | 541 |
| 499 void FireDeviceStatusUpdate(MountLibraryEventType evt, | 542 void FireDeviceStatusUpdate(MountLibraryEventType evt, |
| 500 const std::string& device_path) { | 543 const std::string& device_path) { |
| 501 // Make sure we run on UI thread. | 544 // Make sure we run on UI thread. |
| 502 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 545 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 503 FOR_EACH_OBSERVER( | 546 FOR_EACH_OBSERVER( |
| 504 Observer, observers_, DeviceChanged(evt, device_path)); | 547 Observer, observers_, DeviceChanged(evt, device_path)); |
| 505 } | 548 } |
| 506 | 549 |
| 550 void FireMountCompleted(MountEvent event_type, |
| 551 MountError error_code, |
| 552 const char* source_path, |
| 553 MountType mount_type, |
| 554 const char* mount_path) { |
| 555 // Make sure we run on UI thread. |
| 556 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 557 FOR_EACH_OBSERVER( |
| 558 Observer, observers_, MountCompleted(event_type, |
| 559 error_code, |
| 560 source_path, |
| 561 mount_type, |
| 562 mount_path)); |
| 563 } |
| 564 |
| 507 // Mount event change observers. | 565 // Mount event change observers. |
| 508 ObserverList<Observer> observers_; | 566 ObserverList<Observer> observers_; |
| 509 | 567 |
| 510 // A reference to the mount api, to allow callbacks when the mount | 568 // A reference to the mount api, to allow callbacks when the mount |
| 511 // status changes. | 569 // status changes. |
| 512 MountEventConnection mount_status_connection_; | 570 MountEventConnection mount_status_connection_; |
| 513 | 571 |
| 514 // The list of disks found. | 572 // The list of disks found. |
| 515 MountLibrary::DiskMap disks_; | 573 MountLibrary::DiskMap disks_; |
| 516 | 574 |
| 575 MountLibrary::MountPointMap mount_points_; |
| 576 |
| 517 DISALLOW_COPY_AND_ASSIGN(MountLibraryImpl); | 577 DISALLOW_COPY_AND_ASSIGN(MountLibraryImpl); |
| 518 }; | 578 }; |
| 519 | 579 |
| 520 class MountLibraryStubImpl : public MountLibrary { | 580 class MountLibraryStubImpl : public MountLibrary { |
| 521 public: | 581 public: |
| 522 MountLibraryStubImpl() {} | 582 MountLibraryStubImpl() {} |
| 523 virtual ~MountLibraryStubImpl() {} | 583 virtual ~MountLibraryStubImpl() {} |
| 524 | 584 |
| 525 // MountLibrary overrides. | 585 // MountLibrary overrides. |
| 526 virtual void AddObserver(Observer* observer) OVERRIDE {} | 586 virtual void AddObserver(Observer* observer) OVERRIDE {} |
| 527 virtual void RemoveObserver(Observer* observer) OVERRIDE {} | 587 virtual void RemoveObserver(Observer* observer) OVERRIDE {} |
| 528 virtual const DiskMap& disks() const OVERRIDE { return disks_; } | 588 virtual const DiskMap& disks() const OVERRIDE { return disks_; } |
| 589 virtual const MountPointMap& mount_points() const OVERRIDE { |
| 590 return mount_points_; |
| 591 } |
| 592 virtual std::string MountTypeToString(MountType type) const OVERRIDE { |
| 593 return ""; |
| 594 } |
| 595 virtual MountType MountTypeFromString(const std::string& type_str) const |
| 596 OVERRIDE { |
| 597 return MOUNT_TYPE_INVALID; |
| 598 } |
| 529 virtual void RequestMountInfoRefresh() OVERRIDE {} | 599 virtual void RequestMountInfoRefresh() OVERRIDE {} |
| 530 virtual void MountPath(const char* device_path) OVERRIDE {} | 600 virtual void MountPath(const char* source_path, MountType type, |
| 531 virtual void UnmountPath(const char* device_path) OVERRIDE {} | 601 const MountPathOptions& options) OVERRIDE {} |
| 602 virtual void UnmountPath(const char* path) OVERRIDE {} |
| 532 virtual void UnmountDeviceRecursive(const char* device_path, | 603 virtual void UnmountDeviceRecursive(const char* device_path, |
| 533 UnmountDeviceRecursiveCallbackType callback, void* user_data) | 604 UnmountDeviceRecursiveCallbackType callback, void* user_data) |
| 534 OVERRIDE {} | 605 OVERRIDE {} |
| 535 | 606 |
| 536 private: | 607 private: |
| 537 // The list of disks found. | 608 // The list of disks found. |
| 538 DiskMap disks_; | 609 DiskMap disks_; |
| 610 MountPointMap mount_points_; |
| 539 | 611 |
| 540 DISALLOW_COPY_AND_ASSIGN(MountLibraryStubImpl); | 612 DISALLOW_COPY_AND_ASSIGN(MountLibraryStubImpl); |
| 541 }; | 613 }; |
| 542 | 614 |
| 543 // static | 615 // static |
| 544 MountLibrary* MountLibrary::GetImpl(bool stub) { | 616 MountLibrary* MountLibrary::GetImpl(bool stub) { |
| 545 if (stub) | 617 if (stub) |
| 546 return new MountLibraryStubImpl(); | 618 return new MountLibraryStubImpl(); |
| 547 else | 619 else |
| 548 return new MountLibraryImpl(); | 620 return new MountLibraryImpl(); |
| 549 } | 621 } |
| 550 | 622 |
| 551 } // namespace chromeos | 623 } // namespace chromeos |
| 552 | 624 |
| 553 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 625 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
| 554 // won't be deleted until it's last InvokeLater is run. | 626 // won't be deleted until it's last InvokeLater is run. |
| 555 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::MountLibraryImpl); | 627 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::MountLibraryImpl); |
| 556 | 628 |
| OLD | NEW |