| 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" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 SystemInfoEventRouter(); | 54 SystemInfoEventRouter(); |
| 55 virtual ~SystemInfoEventRouter(); | 55 virtual ~SystemInfoEventRouter(); |
| 56 | 56 |
| 57 // Add/remove event listener for the |event_name| event. | 57 // Add/remove event listener for the |event_name| event. |
| 58 void AddEventListener(const std::string& event_name); | 58 void AddEventListener(const std::string& event_name); |
| 59 void RemoveEventListener(const std::string& event_name); | 59 void RemoveEventListener(const std::string& event_name); |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 // gfx::DisplayObserver: | 62 // gfx::DisplayObserver: |
| 63 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE; | 63 virtual void OnDisplayAdded(const gfx::Display& new_display) override; |
| 64 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE; | 64 virtual void OnDisplayRemoved(const gfx::Display& old_display) override; |
| 65 virtual void OnDisplayMetricsChanged(const gfx::Display& display, | 65 virtual void OnDisplayMetricsChanged(const gfx::Display& display, |
| 66 uint32_t metrics) OVERRIDE; | 66 uint32_t metrics) override; |
| 67 | 67 |
| 68 // RemovableStorageObserver implementation. | 68 // RemovableStorageObserver implementation. |
| 69 virtual void OnRemovableStorageAttached( | 69 virtual void OnRemovableStorageAttached( |
| 70 const storage_monitor::StorageInfo& info) OVERRIDE; | 70 const storage_monitor::StorageInfo& info) override; |
| 71 virtual void OnRemovableStorageDetached( | 71 virtual void OnRemovableStorageDetached( |
| 72 const storage_monitor::StorageInfo& info) OVERRIDE; | 72 const storage_monitor::StorageInfo& info) override; |
| 73 | 73 |
| 74 // Called from any thread to dispatch the systemInfo event to all extension | 74 // Called from any thread to dispatch the systemInfo event to all extension |
| 75 // processes cross multiple profiles. | 75 // processes cross multiple profiles. |
| 76 void DispatchEvent(const std::string& event_name, | 76 void DispatchEvent(const std::string& event_name, |
| 77 scoped_ptr<base::ListValue> args); | 77 scoped_ptr<base::ListValue> args); |
| 78 | 78 |
| 79 // Called to dispatch the systemInfo.display.onDisplayChanged event. | 79 // Called to dispatch the systemInfo.display.onDisplayChanged event. |
| 80 void OnDisplayChanged(); | 80 void OnDisplayChanged(); |
| 81 | 81 |
| 82 // Used to record the event names being watched. | 82 // Used to record the event names being watched. |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 void SystemInfoAPI::OnListenerRemoved(const EventListenerInfo& details) { | 248 void SystemInfoAPI::OnListenerRemoved(const EventListenerInfo& details) { |
| 249 if (IsSystemStorageEvent(details.event_name)) { | 249 if (IsSystemStorageEvent(details.event_name)) { |
| 250 StorageMonitor::GetInstance()->EnsureInitialized( | 250 StorageMonitor::GetInstance()->EnsureInitialized( |
| 251 base::Bind(&RemoveEventListener, details.event_name)); | 251 base::Bind(&RemoveEventListener, details.event_name)); |
| 252 } else { | 252 } else { |
| 253 RemoveEventListener(details.event_name); | 253 RemoveEventListener(details.event_name); |
| 254 } | 254 } |
| 255 } | 255 } |
| 256 | 256 |
| 257 } // namespace extensions | 257 } // namespace extensions |
| OLD | NEW |