OLD | NEW |
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 "extensions/browser/api/idle/idle_manager.h" | 5 #include "extensions/browser/api/idle/idle_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 event_delegate_->RegisterObserver(this); | 136 event_delegate_->RegisterObserver(this); |
137 } | 137 } |
138 | 138 |
139 void IdleManager::Shutdown() { | 139 void IdleManager::Shutdown() { |
140 DCHECK(thread_checker_.CalledOnValidThread()); | 140 DCHECK(thread_checker_.CalledOnValidThread()); |
141 event_delegate_->UnregisterObserver(this); | 141 event_delegate_->UnregisterObserver(this); |
142 } | 142 } |
143 | 143 |
144 void IdleManager::OnExtensionUnloaded(content::BrowserContext* browser_context, | 144 void IdleManager::OnExtensionUnloaded(content::BrowserContext* browser_context, |
145 const Extension* extension, | 145 const Extension* extension, |
146 UnloadedExtensionInfo::Reason reason) { | 146 UnloadedExtensionReason reason) { |
147 DCHECK(thread_checker_.CalledOnValidThread()); | 147 DCHECK(thread_checker_.CalledOnValidThread()); |
148 monitors_.erase(extension->id()); | 148 monitors_.erase(extension->id()); |
149 } | 149 } |
150 | 150 |
151 void IdleManager::OnListenerAdded(const EventListenerInfo& details) { | 151 void IdleManager::OnListenerAdded(const EventListenerInfo& details) { |
152 DCHECK(thread_checker_.CalledOnValidThread()); | 152 DCHECK(thread_checker_.CalledOnValidThread()); |
153 | 153 |
154 ++GetMonitor(details.extension_id)->listeners; | 154 ++GetMonitor(details.extension_id)->listeners; |
155 StartPolling(); | 155 StartPolling(); |
156 } | 156 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 event_delegate_->OnStateChanged(it->first, new_state); | 256 event_delegate_->OnStateChanged(it->first, new_state); |
257 monitor.last_state = new_state; | 257 monitor.last_state = new_state; |
258 listener_count += monitor.listeners; | 258 listener_count += monitor.listeners; |
259 } | 259 } |
260 | 260 |
261 if (listener_count == 0) | 261 if (listener_count == 0) |
262 StopPolling(); | 262 StopPolling(); |
263 } | 263 } |
264 | 264 |
265 } // namespace extensions | 265 } // namespace extensions |
OLD | NEW |