OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/storage_monitor/storage_monitor.h" | 5 #include "chrome/browser/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 "chrome/browser/storage_monitor/removable_storage_observer.h" | 9 #include "chrome/browser/storage_monitor/removable_storage_observer.h" |
10 #include "chrome/browser/storage_monitor/transient_device_ids.h" | 10 #include "chrome/browser/storage_monitor/transient_device_ids.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 base::AutoLock lock(storage_lock_); | 55 base::AutoLock lock(storage_lock_); |
56 for (StorageMap::const_iterator it = storage_map_.begin(); | 56 for (StorageMap::const_iterator it = storage_map_.begin(); |
57 it != storage_map_.end(); | 57 it != storage_map_.end(); |
58 ++it) { | 58 ++it) { |
59 results.push_back(it->second); | 59 results.push_back(it->second); |
60 } | 60 } |
61 return results; | 61 return results; |
62 } | 62 } |
63 | 63 |
64 void StorageMonitor::Initialize(base::Closure callback) { | 64 void StorageMonitor::EnsureInitialized(base::Closure callback) { |
65 DCHECK(thread_checker_.CalledOnValidThread()); | 65 DCHECK(thread_checker_.CalledOnValidThread()); |
66 if (initialized_) { | 66 if (initialized_) { |
67 if (!callback.is_null()) | 67 if (!callback.is_null()) |
68 callback.Run(); | 68 callback.Run(); |
69 return; | 69 return; |
70 } | 70 } |
71 | 71 |
72 if (!callback.is_null()) { | 72 if (!callback.is_null()) { |
73 on_initialize_callbacks_.push_back(callback); | 73 on_initialize_callbacks_.push_back(callback); |
74 } | 74 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } | 176 } |
177 | 177 |
178 DVLOG(1) << "RemovableStorageDetached for id " << id; | 178 DVLOG(1) << "RemovableStorageDetached for id " << id; |
179 if (StorageInfo::IsRemovableDevice(info.device_id())) { | 179 if (StorageInfo::IsRemovableDevice(info.device_id())) { |
180 observer_list_->Notify( | 180 observer_list_->Notify( |
181 &RemovableStorageObserver::OnRemovableStorageDetached, info); | 181 &RemovableStorageObserver::OnRemovableStorageDetached, info); |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 } // namespace chrome | 185 } // namespace chrome |
OLD | NEW |