| 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/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
| 11 #include "extensions/browser/api/idle/idle_api_constants.h" | 11 #include "extensions/browser/api/idle/idle_api_constants.h" |
| 12 #include "extensions/browser/event_router.h" | 12 #include "extensions/browser/event_router.h" |
| 13 #include "extensions/browser/extension_registry.h" | 13 #include "extensions/browser/extension_registry.h" |
| 14 #include "extensions/common/api/idle.h" | 14 #include "extensions/common/api/idle.h" |
| 15 #include "extensions/common/extension.h" | 15 #include "extensions/common/extension.h" |
| 16 | 16 |
| 17 namespace keys = extensions::idle_api_constants; | 17 namespace keys = extensions::idle_api_constants; |
| 18 namespace idle = extensions::core_api::idle; | 18 namespace idle = extensions::api::idle; |
| 19 | 19 |
| 20 namespace extensions { | 20 namespace extensions { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 const int kDefaultIdleThreshold = 60; | 24 const int kDefaultIdleThreshold = 60; |
| 25 const int kPollInterval = 1; | 25 const int kPollInterval = 1; |
| 26 | 26 |
| 27 class DefaultEventDelegate : public IdleManager::EventDelegate { | 27 class DefaultEventDelegate : public IdleManager::EventDelegate { |
| 28 public: | 28 public: |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 event_delegate_->OnStateChanged(it->first, new_state); | 253 event_delegate_->OnStateChanged(it->first, new_state); |
| 254 monitor.last_state = new_state; | 254 monitor.last_state = new_state; |
| 255 listener_count += monitor.listeners; | 255 listener_count += monitor.listeners; |
| 256 } | 256 } |
| 257 | 257 |
| 258 if (listener_count == 0) | 258 if (listener_count == 0) |
| 259 StopPolling(); | 259 StopPolling(); |
| 260 } | 260 } |
| 261 | 261 |
| 262 } // namespace extensions | 262 } // namespace extensions |
| OLD | NEW |