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