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/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/storage_monitor/removable_storage_observer.h" | 10 #include "chrome/browser/storage_monitor/removable_storage_observer.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 on_initialize_callbacks_.push_back(callback); | 73 on_initialize_callbacks_.push_back(callback); |
74 } | 74 } |
75 | 75 |
76 if (initializing_) | 76 if (initializing_) |
77 return; | 77 return; |
78 | 78 |
79 initializing_ = true; | 79 initializing_ = true; |
80 Init(); | 80 Init(); |
81 } | 81 } |
82 | 82 |
83 bool StorageMonitor::IsInitialized() { | 83 bool StorageMonitor::IsInitialized() const { |
84 return initialized_; | 84 return initialized_; |
85 } | 85 } |
86 | 86 |
87 void StorageMonitor::AddObserver(RemovableStorageObserver* obs) { | 87 void StorageMonitor::AddObserver(RemovableStorageObserver* obs) { |
88 observer_list_->AddObserver(obs); | 88 observer_list_->AddObserver(obs); |
89 } | 89 } |
90 | 90 |
91 void StorageMonitor::RemoveObserver( | 91 void StorageMonitor::RemoveObserver( |
92 RemovableStorageObserver* obs) { | 92 RemovableStorageObserver* obs) { |
93 observer_list_->RemoveObserver(obs); | 93 observer_list_->RemoveObserver(obs); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 info = it->second; | 165 info = it->second; |
166 storage_map_.erase(it); | 166 storage_map_.erase(it); |
167 } | 167 } |
168 | 168 |
169 DVLOG(1) << "StorageDetached for id " << id; | 169 DVLOG(1) << "StorageDetached for id " << id; |
170 if (StorageInfo::IsRemovableDevice(info.device_id())) { | 170 if (StorageInfo::IsRemovableDevice(info.device_id())) { |
171 observer_list_->Notify( | 171 observer_list_->Notify( |
172 &RemovableStorageObserver::OnRemovableStorageDetached, info); | 172 &RemovableStorageObserver::OnRemovableStorageDetached, info); |
173 } | 173 } |
174 } | 174 } |
OLD | NEW |