| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/storage_monitor/storage_monitor_chromeos.h" | 5 #include "components/storage_monitor/storage_monitor_chromeos.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "components/storage_monitor/media_storage_util.h" | 15 #include "components/storage_monitor/media_storage_util.h" |
| 16 #include "components/storage_monitor/media_transfer_protocol_device_observer_lin
ux.h" | 16 #include "components/storage_monitor/media_transfer_protocol_device_observer_chr
omeos.h" |
| 17 #include "components/storage_monitor/removable_device_constants.h" | 17 #include "components/storage_monitor/removable_device_constants.h" |
| 18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 19 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" | 19 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" |
| 20 | 20 |
| 21 using chromeos::disks::DiskMountManager; | 21 using chromeos::disks::DiskMountManager; |
| 22 | 22 |
| 23 namespace storage_monitor { | 23 namespace storage_monitor { |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 DiskMountManager::GetInstance()->AddObserver(this); | 104 DiskMountManager::GetInstance()->AddObserver(this); |
| 105 CheckExistingMountPoints(); | 105 CheckExistingMountPoints(); |
| 106 | 106 |
| 107 if (!media_transfer_protocol_manager_) { | 107 if (!media_transfer_protocol_manager_) { |
| 108 media_transfer_protocol_manager_.reset( | 108 media_transfer_protocol_manager_.reset( |
| 109 device::MediaTransferProtocolManager::Initialize( | 109 device::MediaTransferProtocolManager::Initialize( |
| 110 scoped_refptr<base::SingleThreadTaskRunner>())); | 110 scoped_refptr<base::SingleThreadTaskRunner>())); |
| 111 } | 111 } |
| 112 | 112 |
| 113 media_transfer_protocol_device_observer_.reset( | 113 media_transfer_protocol_device_observer_.reset( |
| 114 new MediaTransferProtocolDeviceObserverLinux( | 114 new MediaTransferProtocolDeviceObserverChromeOS( |
| 115 receiver(), media_transfer_protocol_manager_.get())); | 115 receiver(), media_transfer_protocol_manager_.get())); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void StorageMonitorCros::CheckExistingMountPoints() { | 118 void StorageMonitorCros::CheckExistingMountPoints() { |
| 119 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 119 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 120 const DiskMountManager::MountPointMap& mount_point_map = | 120 const DiskMountManager::MountPointMap& mount_point_map = |
| 121 DiskMountManager::GetInstance()->mount_points(); | 121 DiskMountManager::GetInstance()->mount_points(); |
| 122 for (DiskMountManager::MountPointMap::const_iterator it = | 122 for (DiskMountManager::MountPointMap::const_iterator it = |
| 123 mount_point_map.begin(); it != mount_point_map.end(); ++it) { | 123 mount_point_map.begin(); it != mount_point_map.end(); ++it) { |
| 124 BrowserThread::PostTaskAndReplyWithResult( | 124 BrowserThread::PostTaskAndReplyWithResult( |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 mount_map_.insert(std::make_pair(mount_info.mount_path, info)); | 298 mount_map_.insert(std::make_pair(mount_info.mount_path, info)); |
| 299 | 299 |
| 300 receiver()->ProcessAttach(info); | 300 receiver()->ProcessAttach(info); |
| 301 } | 301 } |
| 302 | 302 |
| 303 StorageMonitor* StorageMonitor::CreateInternal() { | 303 StorageMonitor* StorageMonitor::CreateInternal() { |
| 304 return new StorageMonitorCros(); | 304 return new StorageMonitorCros(); |
| 305 } | 305 } |
| 306 | 306 |
| 307 } // namespace storage_monitor | 307 } // namespace storage_monitor |
| OLD | NEW |