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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 void AddEventListener(const std::string& event_name) { | 217 void AddEventListener(const std::string& event_name) { |
218 SystemInfoEventRouter::GetInstance()->AddEventListener(event_name); | 218 SystemInfoEventRouter::GetInstance()->AddEventListener(event_name); |
219 } | 219 } |
220 | 220 |
221 void RemoveEventListener(const std::string& event_name) { | 221 void RemoveEventListener(const std::string& event_name) { |
222 SystemInfoEventRouter::GetInstance()->RemoveEventListener(event_name); | 222 SystemInfoEventRouter::GetInstance()->RemoveEventListener(event_name); |
223 } | 223 } |
224 | 224 |
225 } // namespace | 225 } // namespace |
226 | 226 |
227 static base::LazyInstance<BrowserContextKeyedAPIFactory<SystemInfoAPI> > | 227 static base::LazyInstance< |
228 g_factory = LAZY_INSTANCE_INITIALIZER; | 228 BrowserContextKeyedAPIFactory<SystemInfoAPI>>::DestructorAtExit g_factory = |
| 229 LAZY_INSTANCE_INITIALIZER; |
229 | 230 |
230 // static | 231 // static |
231 BrowserContextKeyedAPIFactory<SystemInfoAPI>* | 232 BrowserContextKeyedAPIFactory<SystemInfoAPI>* |
232 SystemInfoAPI::GetFactoryInstance() { | 233 SystemInfoAPI::GetFactoryInstance() { |
233 return g_factory.Pointer(); | 234 return g_factory.Pointer(); |
234 } | 235 } |
235 | 236 |
236 SystemInfoAPI::SystemInfoAPI(content::BrowserContext* context) | 237 SystemInfoAPI::SystemInfoAPI(content::BrowserContext* context) |
237 : browser_context_(context) { | 238 : browser_context_(context) { |
238 EventRouter* router = EventRouter::Get(browser_context_); | 239 EventRouter* router = EventRouter::Get(browser_context_); |
(...skipping 21 matching lines...) Expand all Loading... |
260 void SystemInfoAPI::OnListenerRemoved(const EventListenerInfo& details) { | 261 void SystemInfoAPI::OnListenerRemoved(const EventListenerInfo& details) { |
261 if (IsSystemStorageEvent(details.event_name)) { | 262 if (IsSystemStorageEvent(details.event_name)) { |
262 StorageMonitor::GetInstance()->EnsureInitialized( | 263 StorageMonitor::GetInstance()->EnsureInitialized( |
263 base::Bind(&RemoveEventListener, details.event_name)); | 264 base::Bind(&RemoveEventListener, details.event_name)); |
264 } else { | 265 } else { |
265 RemoveEventListener(details.event_name); | 266 RemoveEventListener(details.event_name); |
266 } | 267 } |
267 } | 268 } |
268 | 269 |
269 } // namespace extensions | 270 } // namespace extensions |
OLD | NEW |