| 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/api/idle/idle_api.h" | 5 #include "chrome/browser/extensions/api/idle/idle_api.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "chrome/browser/extensions/api/idle/idle_api_constants.h" | 9 #include "chrome/browser/extensions/api/idle/idle_api_constants.h" |
| 10 #include "chrome/browser/extensions/api/idle/idle_manager.h" | 10 #include "chrome/browser/extensions/api/idle/idle_manager.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 // Don't send the response, it'll be sent by our callback | 41 // Don't send the response, it'll be sent by our callback |
| 42 return true; | 42 return true; |
| 43 } | 43 } |
| 44 | 44 |
| 45 void IdleQueryStateFunction::IdleStateCallback(IdleState state) { | 45 void IdleQueryStateFunction::IdleStateCallback(IdleState state) { |
| 46 SetResult(IdleManager::CreateIdleValue(state)); | 46 SetResult(IdleManager::CreateIdleValue(state)); |
| 47 SendResponse(true); | 47 SendResponse(true); |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool IdleSetDetectionIntervalFunction::RunImpl() { | 50 bool IdleSetDetectionIntervalFunction::RunSync() { |
| 51 int threshold; | 51 int threshold; |
| 52 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &threshold)); | 52 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &threshold)); |
| 53 threshold = ClampThreshold(threshold); | 53 threshold = ClampThreshold(threshold); |
| 54 | 54 |
| 55 IdleManagerFactory::GetForProfile(GetProfile()) | 55 IdleManagerFactory::GetForProfile(GetProfile()) |
| 56 ->SetThreshold(extension_id(), threshold); | 56 ->SetThreshold(extension_id(), threshold); |
| 57 | 57 |
| 58 return true; | 58 return true; |
| 59 } | 59 } |
| 60 | 60 |
| 61 } // namespace extensions | 61 } // namespace extensions |
| OLD | NEW |