Chromium Code Reviews| Index: chrome/browser/system_monitor/removable_storage_notifications.cc |
| diff --git a/chrome/browser/system_monitor/removable_storage_notifications.cc b/chrome/browser/system_monitor/removable_storage_notifications.cc |
| index 11d5fff73bea23521c37352aba4b9ec10a99ffe9..b968f8fbe025a925895d0d1544890adc304fb533 100644 |
| --- a/chrome/browser/system_monitor/removable_storage_notifications.cc |
| +++ b/chrome/browser/system_monitor/removable_storage_notifications.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/stl_util.h" |
| #include "base/utf_string_conversions.h" |
| #include "chrome/browser/system_monitor/removable_storage_observer.h" |
| +#include "chrome/browser/system_monitor/transient_device_ids.h" |
| namespace chrome { |
| @@ -59,9 +60,40 @@ void RemovableStorageNotifications::ReceiverImpl::ProcessDetach( |
| notifications_->ProcessDetach(id); |
| } |
| +RemovableStorageNotifications* RemovableStorageNotifications::GetInstance() { |
| + return g_removable_storage_notifications; |
|
Greg Billock
2013/02/08 17:54:53
Why move these above the constructor?
vandebo (ex-Chrome)
2013/02/09 00:49:16
Definition order should match declaration order.
|
| +} |
| + |
| +std::vector<RemovableStorageNotifications::StorageInfo> |
| +RemovableStorageNotifications::GetAttachedStorage() const { |
| + std::vector<StorageInfo> results; |
| + |
| + base::AutoLock lock(storage_lock_); |
| + for (RemovableStorageMap::const_iterator it = storage_map_.begin(); |
| + it != storage_map_.end(); |
| + ++it) { |
| + results.push_back(it->second); |
| + } |
| + return results; |
| +} |
| + |
| +void RemovableStorageNotifications::AddObserver(RemovableStorageObserver* obs) { |
| + observer_list_->AddObserver(obs); |
| +} |
| + |
| +void RemovableStorageNotifications::RemoveObserver( |
| + RemovableStorageObserver* obs) { |
| + observer_list_->RemoveObserver(obs); |
| +} |
| + |
| +TransientDeviceIds* |
| +RemovableStorageNotifications::transient_device_ids() const { |
| + return transient_device_ids_.get(); |
| +} |
| + |
| RemovableStorageNotifications::RemovableStorageNotifications() |
| - : observer_list_( |
| - new ObserverListThreadSafe<RemovableStorageObserver>()) { |
| + : observer_list_(new ObserverListThreadSafe<RemovableStorageObserver>()), |
| + transient_device_ids_(new TransientDeviceIds) { |
| receiver_.reset(new ReceiverImpl(this)); |
| DCHECK(!g_removable_storage_notifications); |
| @@ -112,30 +144,4 @@ void RemovableStorageNotifications::ProcessDetach(const std::string& id) { |
| &RemovableStorageObserver::OnRemovableStorageDetached, info); |
| } |
| -std::vector<RemovableStorageNotifications::StorageInfo> |
| -RemovableStorageNotifications::GetAttachedStorage() const { |
| - std::vector<StorageInfo> results; |
| - |
| - base::AutoLock lock(storage_lock_); |
| - for (RemovableStorageMap::const_iterator it = storage_map_.begin(); |
| - it != storage_map_.end(); |
| - ++it) { |
| - results.push_back(it->second); |
| - } |
| - return results; |
| -} |
| - |
| -void RemovableStorageNotifications::AddObserver(RemovableStorageObserver* obs) { |
| - observer_list_->AddObserver(obs); |
| -} |
| - |
| -void RemovableStorageNotifications::RemoveObserver( |
| - RemovableStorageObserver* obs) { |
| - observer_list_->RemoveObserver(obs); |
| -} |
| - |
| -RemovableStorageNotifications* RemovableStorageNotifications::GetInstance() { |
| - return g_removable_storage_notifications; |
| -} |
| - |
| } // namespace chrome |