Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: chrome/browser/storage_monitor/storage_monitor.cc

Issue 16186002: Refine StorageMonitor storage device getter (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/utf_string_conversions.h" 8 #include "base/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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 void StorageMonitor::ReceiverImpl::MarkInitialized() { 44 void StorageMonitor::ReceiverImpl::MarkInitialized() {
45 notifications_->MarkInitialized(); 45 notifications_->MarkInitialized();
46 } 46 }
47 47
48 StorageMonitor* StorageMonitor::GetInstance() { 48 StorageMonitor* StorageMonitor::GetInstance() {
49 return g_storage_monitor; 49 return g_storage_monitor;
50 } 50 }
51 51
52 std::vector<StorageInfo> StorageMonitor::GetAttachedStorage() const { 52 std::vector<StorageInfo> StorageMonitor::GetAttachedRemovableStorages() const {
53 std::vector<StorageInfo> results; 53 std::vector<StorageInfo> results;
54 54
55 base::AutoLock lock(storage_lock_); 55 base::AutoLock lock(storage_lock_);
56 for (RemovableStorageMap::const_iterator it = storage_map_.begin(); 56 for (RemovableStorageMap::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 std::vector<StorageInfo> StorageMonitor::GetAllAvailableStorages() const {
65 // Returns empty vector as default implemenation.
Lei Zhang 2013/05/29 10:03:32 typo, add NOTIMPLEMENTED()
66 return std::vector<StorageInfo>();
67 }
68
64 void StorageMonitor::Initialize(base::Closure callback) { 69 void StorageMonitor::Initialize(base::Closure callback) {
65 if (initialized_) { 70 if (initialized_) {
66 if (!callback.is_null()) 71 if (!callback.is_null())
67 callback.Run(); 72 callback.Run();
68 return; 73 return;
69 } 74 }
70 75
71 if (!callback.is_null()) { 76 if (!callback.is_null()) {
72 on_initialize_callbacks_.push_back(callback); 77 on_initialize_callbacks_.push_back(callback);
73 } 78 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 info = it->second; 171 info = it->second;
167 storage_map_.erase(it); 172 storage_map_.erase(it);
168 } 173 }
169 174
170 DVLOG(1) << "RemovableStorageDetached for id " << id; 175 DVLOG(1) << "RemovableStorageDetached for id " << id;
171 observer_list_->Notify( 176 observer_list_->Notify(
172 &RemovableStorageObserver::OnRemovableStorageDetached, info); 177 &RemovableStorageObserver::OnRemovableStorageDetached, info);
173 } 178 }
174 179
175 } // namespace chrome 180 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698