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.h" | 5 #include "components/storage_monitor/storage_monitor.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "components/storage_monitor/removable_storage_observer.h" | 9 #include "components/storage_monitor/removable_storage_observer.h" |
10 #include "components/storage_monitor/transient_device_ids.h" | 10 #include "components/storage_monitor/transient_device_ids.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 void StorageMonitor::Destroy() { | 59 void StorageMonitor::Destroy() { |
60 delete g_storage_monitor; | 60 delete g_storage_monitor; |
61 g_storage_monitor = NULL; | 61 g_storage_monitor = NULL; |
62 } | 62 } |
63 | 63 |
64 StorageMonitor* StorageMonitor::GetInstance() { | 64 StorageMonitor* StorageMonitor::GetInstance() { |
65 return g_storage_monitor; | 65 return g_storage_monitor; |
66 } | 66 } |
67 | 67 |
68 void StorageMonitor::SetStorageMonitorForTesting( | 68 void StorageMonitor::SetStorageMonitorForTesting( |
69 scoped_ptr<StorageMonitor> storage_monitor) { | 69 std::unique_ptr<StorageMonitor> storage_monitor) { |
70 delete g_storage_monitor; | 70 delete g_storage_monitor; |
71 g_storage_monitor = storage_monitor.release(); | 71 g_storage_monitor = storage_monitor.release(); |
72 } | 72 } |
73 | 73 |
74 std::vector<StorageInfo> StorageMonitor::GetAllAvailableStorages() const { | 74 std::vector<StorageInfo> StorageMonitor::GetAllAvailableStorages() const { |
75 std::vector<StorageInfo> results; | 75 std::vector<StorageInfo> results; |
76 | 76 |
77 base::AutoLock lock(storage_lock_); | 77 base::AutoLock lock(storage_lock_); |
78 for (StorageMap::const_iterator it = storage_map_.begin(); | 78 for (StorageMap::const_iterator it = storage_map_.begin(); |
79 it != storage_map_.end(); | 79 it != storage_map_.end(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } | 189 } |
190 | 190 |
191 DVLOG(1) << "StorageDetached for id " << id; | 191 DVLOG(1) << "StorageDetached for id " << id; |
192 if (StorageInfo::IsRemovableDevice(info.device_id())) { | 192 if (StorageInfo::IsRemovableDevice(info.device_id())) { |
193 observer_list_->Notify( | 193 observer_list_->Notify( |
194 FROM_HERE, &RemovableStorageObserver::OnRemovableStorageDetached, info); | 194 FROM_HERE, &RemovableStorageObserver::OnRemovableStorageDetached, info); |
195 } | 195 } |
196 } | 196 } |
197 | 197 |
198 } // namespace storage_monitor | 198 } // namespace storage_monitor |
OLD | NEW |