| 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 "chrome/browser/extensions/extension_idle_api.h" | 5 #include "chrome/browser/extensions/api/idle/idle_api.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/json/json_writer.h" | 13 #include "base/json/json_writer.h" |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "chrome/browser/extensions/extension_event_router.h" | 17 #include "chrome/browser/extensions/extension_event_router.h" |
| 18 #include "chrome/browser/extensions/extension_host.h" | 18 #include "chrome/browser/extensions/extension_host.h" |
| 19 #include "chrome/browser/extensions/extension_idle_api_constants.h" | 19 #include "chrome/browser/extensions/api/idle/idle_api_constants.h" |
| 20 #include "chrome/browser/extensions/extension_service.h" | 20 #include "chrome/browser/extensions/extension_service.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/common/extensions/extension.h" | 22 #include "chrome/common/extensions/extension.h" |
| 23 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
| 24 | 24 |
| 25 namespace keys = extension_idle_api_constants; | 25 namespace keys = idle_api_constants; |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 const int kIdlePollInterval = 1; // Number of seconds between status checks | 29 const int kIdlePollInterval = 1; // Number of seconds between status checks |
| 30 // when polling for active. | 30 // when polling for active. |
| 31 const int kThrottleInterval = 1; // Number of seconds to throttle idle checks | 31 const int kThrottleInterval = 1; // Number of seconds to throttle idle checks |
| 32 // for. Return the previously checked idle | 32 // for. Return the previously checked idle |
| 33 // state if the next check is faster than this | 33 // state if the next check is faster than this |
| 34 const int kMinThreshold = 15; // In seconds. Set >1 sec for security concerns. | 34 const int kMinThreshold = 15; // In seconds. Set >1 sec for security concerns. |
| 35 const int kMaxThreshold = 4*60*60; // Four hours, in seconds. Not set | 35 const int kMaxThreshold = 4*60*60; // Four hours, in seconds. Not set |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } | 262 } |
| 263 } | 263 } |
| 264 | 264 |
| 265 int ExtensionIdleCache::get_min_threshold() { | 265 int ExtensionIdleCache::get_min_threshold() { |
| 266 return kMinThreshold; | 266 return kMinThreshold; |
| 267 } | 267 } |
| 268 | 268 |
| 269 double ExtensionIdleCache::get_throttle_interval() { | 269 double ExtensionIdleCache::get_throttle_interval() { |
| 270 return static_cast<double>(kThrottleInterval); | 270 return static_cast<double>(kThrottleInterval); |
| 271 } | 271 } |
| OLD | NEW |