| OLD | NEW |
| 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/volume_manager.h" | 5 #include "chrome/browser/chromeos/file_manager/volume_manager.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 // Subscribe to Privet volume lister. | 388 // Subscribe to Privet volume lister. |
| 389 if (CommandLine::ForCurrentProcess()->HasSwitch( | 389 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 390 switches::kEnablePrivetStorage)) { | 390 switches::kEnablePrivetStorage)) { |
| 391 privet_volume_lister_.reset(new local_discovery::PrivetVolumeLister( | 391 privet_volume_lister_.reset(new local_discovery::PrivetVolumeLister( |
| 392 base::Bind(&VolumeManager::OnPrivetVolumesAvailable, | 392 base::Bind(&VolumeManager::OnPrivetVolumesAvailable, |
| 393 weak_ptr_factory_.GetWeakPtr()))); | 393 weak_ptr_factory_.GetWeakPtr()))); |
| 394 privet_volume_lister_->Start(); | 394 privet_volume_lister_->Start(); |
| 395 } | 395 } |
| 396 | 396 |
| 397 // Subscribe to storage monitor for MTP notifications. | 397 // Subscribe to storage monitor for MTP notifications. |
| 398 if (CommandLine::ForCurrentProcess()->HasSwitch( | 398 const bool disable_mtp = |
| 399 chromeos::switches::kEnableFileManagerMTP) && | 399 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 400 storage_monitor::StorageMonitor::GetInstance()) { | 400 chromeos::switches::kEnableFileManagerMTP) == "false"; |
| 401 if (!disable_mtp && storage_monitor::StorageMonitor::GetInstance()) { |
| 401 storage_monitor::StorageMonitor::GetInstance()->EnsureInitialized( | 402 storage_monitor::StorageMonitor::GetInstance()->EnsureInitialized( |
| 402 base::Bind(&VolumeManager::OnStorageMonitorInitialized, | 403 base::Bind(&VolumeManager::OnStorageMonitorInitialized, |
| 403 weak_ptr_factory_.GetWeakPtr())); | 404 weak_ptr_factory_.GetWeakPtr())); |
| 404 } | 405 } |
| 405 } | 406 } |
| 406 | 407 |
| 407 void VolumeManager::Shutdown() { | 408 void VolumeManager::Shutdown() { |
| 408 weak_ptr_factory_.InvalidateWeakPtrs(); | 409 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 409 | 410 |
| 410 pref_change_registrar_.RemoveAll(); | 411 pref_change_registrar_.RemoveAll(); |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 return; | 838 return; |
| 838 if (error_code == chromeos::MOUNT_ERROR_NONE) | 839 if (error_code == chromeos::MOUNT_ERROR_NONE) |
| 839 mounted_volumes_.erase(volume_info.volume_id); | 840 mounted_volumes_.erase(volume_info.volume_id); |
| 840 | 841 |
| 841 FOR_EACH_OBSERVER(VolumeManagerObserver, | 842 FOR_EACH_OBSERVER(VolumeManagerObserver, |
| 842 observers_, | 843 observers_, |
| 843 OnVolumeUnmounted(error_code, volume_info)); | 844 OnVolumeUnmounted(error_code, volume_info)); |
| 844 } | 845 } |
| 845 | 846 |
| 846 } // namespace file_manager | 847 } // namespace file_manager |
| OLD | NEW |