| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "components/storage_monitor/removable_storage_observer.h" | 15 #include "components/storage_monitor/removable_storage_observer.h" |
| 16 #include "components/storage_monitor/storage_info.h" | 16 #include "components/storage_monitor/storage_info.h" |
| 17 #include "components/storage_monitor/storage_monitor.h" | 17 #include "components/storage_monitor/storage_monitor.h" |
| 18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 19 #include "extensions/browser/api/system_display/display_info_provider.h" | 19 #include "extensions/browser/api/system_display/display_info_provider.h" |
| 20 #include "extensions/browser/api/system_storage/storage_info_provider.h" | 20 #include "extensions/browser/api/system_storage/storage_info_provider.h" |
| 21 #include "extensions/browser/extensions_browser_client.h" | 21 #include "extensions/browser/extensions_browser_client.h" |
| 22 #include "extensions/common/api/system_display.h" | 22 #include "extensions/common/api/system_display.h" |
| 23 #include "extensions/common/api/system_storage.h" | 23 #include "extensions/common/api/system_storage.h" |
| 24 #include "ui/gfx/display_observer.h" | 24 #include "ui/gfx/display_observer.h" |
| 25 #include "ui/gfx/screen.h" | 25 #include "ui/gfx/screen.h" |
| 26 | 26 |
| 27 namespace extensions { | 27 namespace extensions { |
| 28 | 28 |
| 29 using core_api::system_storage::StorageUnitInfo; | 29 using api::system_storage::StorageUnitInfo; |
| 30 using content::BrowserThread; | 30 using content::BrowserThread; |
| 31 using storage_monitor::StorageMonitor; | 31 using storage_monitor::StorageMonitor; |
| 32 | 32 |
| 33 namespace system_display = core_api::system_display; | 33 namespace system_display = api::system_display; |
| 34 namespace system_storage = core_api::system_storage; | 34 namespace system_storage = api::system_storage; |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 bool IsDisplayChangedEvent(const std::string& event_name) { | 38 bool IsDisplayChangedEvent(const std::string& event_name) { |
| 39 return event_name == system_display::OnDisplayChanged::kEventName; | 39 return event_name == system_display::OnDisplayChanged::kEventName; |
| 40 } | 40 } |
| 41 | 41 |
| 42 bool IsSystemStorageEvent(const std::string& event_name) { | 42 bool IsSystemStorageEvent(const std::string& event_name) { |
| 43 return (event_name == system_storage::OnAttached::kEventName || | 43 return (event_name == system_storage::OnAttached::kEventName || |
| 44 event_name == system_storage::OnDetached::kEventName); | 44 event_name == system_storage::OnDetached::kEventName); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 void SystemInfoAPI::OnListenerRemoved(const EventListenerInfo& details) { | 254 void SystemInfoAPI::OnListenerRemoved(const EventListenerInfo& details) { |
| 255 if (IsSystemStorageEvent(details.event_name)) { | 255 if (IsSystemStorageEvent(details.event_name)) { |
| 256 StorageMonitor::GetInstance()->EnsureInitialized( | 256 StorageMonitor::GetInstance()->EnsureInitialized( |
| 257 base::Bind(&RemoveEventListener, details.event_name)); | 257 base::Bind(&RemoveEventListener, details.event_name)); |
| 258 } else { | 258 } else { |
| 259 RemoveEventListener(details.event_name); | 259 RemoveEventListener(details.event_name); |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 | 262 |
| 263 } // namespace extensions | 263 } // namespace extensions |
| OLD | NEW |