| 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_IDLE_IDLE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_IDLE_IDLE_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_IDLE_IDLE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_IDLE_IDLE_API_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/extensions/chrome_extension_function.h" | 8 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 9 #include "chrome/browser/idle.h" | 9 #include "chrome/browser/idle.h" |
| 10 | 10 |
| 11 namespace extensions { | 11 namespace extensions { |
| 12 | 12 |
| 13 // Implementation of the chrome.idle.queryState API. | 13 // Implementation of the chrome.idle.queryState API. |
| 14 class IdleQueryStateFunction : public ChromeAsyncExtensionFunction { | 14 class IdleQueryStateFunction : public ChromeAsyncExtensionFunction { |
| 15 public: | 15 public: |
| 16 DECLARE_EXTENSION_FUNCTION("idle.queryState", IDLE_QUERYSTATE) | 16 DECLARE_EXTENSION_FUNCTION("idle.queryState", IDLE_QUERYSTATE) |
| 17 | 17 |
| 18 protected: | 18 protected: |
| 19 virtual ~IdleQueryStateFunction() {} | 19 virtual ~IdleQueryStateFunction() {} |
| 20 | 20 |
| 21 // ExtensionFunction: | 21 // ExtensionFunction: |
| 22 virtual bool RunImpl() OVERRIDE; | 22 virtual bool RunSync() OVERRIDE; |
| 23 | 23 |
| 24 private: | 24 private: |
| 25 void IdleStateCallback(IdleState state); | 25 void IdleStateCallback(IdleState state); |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 // Implementation of the chrome.idle.setDetectionInterval API. | 28 // Implementation of the chrome.idle.setDetectionInterval API. |
| 29 class IdleSetDetectionIntervalFunction : public ChromeSyncExtensionFunction { | 29 class IdleSetDetectionIntervalFunction : public ChromeSyncExtensionFunction { |
| 30 public: | 30 public: |
| 31 DECLARE_EXTENSION_FUNCTION("idle.setDetectionInterval", | 31 DECLARE_EXTENSION_FUNCTION("idle.setDetectionInterval", |
| 32 IDLE_SETDETECTIONINTERVAL) | 32 IDLE_SETDETECTIONINTERVAL) |
| 33 | 33 |
| 34 protected: | 34 protected: |
| 35 virtual ~IdleSetDetectionIntervalFunction() {} | 35 virtual ~IdleSetDetectionIntervalFunction() {} |
| 36 | 36 |
| 37 // ExtensionFunction: | 37 // ExtensionFunction: |
| 38 virtual bool RunImpl() OVERRIDE; | 38 virtual bool RunSync() OVERRIDE; |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 } // namespace extensions | 41 } // namespace extensions |
| 42 | 42 |
| 43 #endif // CHROME_BROWSER_EXTENSIONS_API_IDLE_IDLE_API_H_ | 43 #endif // CHROME_BROWSER_EXTENSIONS_API_IDLE_IDLE_API_H_ |
| OLD | NEW |