OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "extensions/browser/api/system_info/system_info_api.h" | 5 #include "extensions/browser/api/system_info/system_info_api.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 has_storage_monitor_observer_ = false; | 160 has_storage_monitor_observer_ = false; |
161 } | 161 } |
162 } | 162 } |
163 } | 163 } |
164 | 164 |
165 void SystemInfoEventRouter::OnRemovableStorageAttached( | 165 void SystemInfoEventRouter::OnRemovableStorageAttached( |
166 const storage_monitor::StorageInfo& info) { | 166 const storage_monitor::StorageInfo& info) { |
167 StorageUnitInfo unit; | 167 StorageUnitInfo unit; |
168 systeminfo::BuildStorageUnitInfo(info, &unit); | 168 systeminfo::BuildStorageUnitInfo(info, &unit); |
169 std::unique_ptr<base::ListValue> args(new base::ListValue); | 169 std::unique_ptr<base::ListValue> args(new base::ListValue); |
170 args->Append(unit.ToValue().release()); | 170 args->Append(unit.ToValue()); |
171 DispatchEvent(events::SYSTEM_STORAGE_ON_ATTACHED, | 171 DispatchEvent(events::SYSTEM_STORAGE_ON_ATTACHED, |
172 system_storage::OnAttached::kEventName, std::move(args)); | 172 system_storage::OnAttached::kEventName, std::move(args)); |
173 } | 173 } |
174 | 174 |
175 void SystemInfoEventRouter::OnRemovableStorageDetached( | 175 void SystemInfoEventRouter::OnRemovableStorageDetached( |
176 const storage_monitor::StorageInfo& info) { | 176 const storage_monitor::StorageInfo& info) { |
177 std::unique_ptr<base::ListValue> args(new base::ListValue); | 177 std::unique_ptr<base::ListValue> args(new base::ListValue); |
178 std::string transient_id = | 178 std::string transient_id = |
179 StorageMonitor::GetInstance()->GetTransientIdForDeviceId( | 179 StorageMonitor::GetInstance()->GetTransientIdForDeviceId( |
180 info.device_id()); | 180 info.device_id()); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 void SystemInfoAPI::OnListenerRemoved(const EventListenerInfo& details) { | 260 void SystemInfoAPI::OnListenerRemoved(const EventListenerInfo& details) { |
261 if (IsSystemStorageEvent(details.event_name)) { | 261 if (IsSystemStorageEvent(details.event_name)) { |
262 StorageMonitor::GetInstance()->EnsureInitialized( | 262 StorageMonitor::GetInstance()->EnsureInitialized( |
263 base::Bind(&RemoveEventListener, details.event_name)); | 263 base::Bind(&RemoveEventListener, details.event_name)); |
264 } else { | 264 } else { |
265 RemoveEventListener(details.event_name); | 265 RemoveEventListener(details.event_name); |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
269 } // namespace extensions | 269 } // namespace extensions |
OLD | NEW |