Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/extensions/api/power/power_api.h" | |
| 6 | |
| 7 #include "chrome/browser/extensions/api/power/power_api_constants.h" | |
| 8 #include "chrome/browser/extensions/api/power/power_api_manager.h" | |
| 9 #include "chrome/common/extensions/api/power.h" | |
| 10 | |
| 11 namespace extensions { | |
| 12 | |
| 13 bool PowerRequestKeepAwakeFunction::RunImpl() { | |
| 14 scoped_ptr<api::power::RequestKeepAwake::Params> params( | |
| 15 api::power::RequestKeepAwake::Params::Create(*args_)); | |
| 16 EXTENSION_FUNCTION_VALIDATE(params.get()); | |
| 17 | |
| 18 PowerApiManager::Level level = PowerApiManager::LEVEL_DISPLAY; | |
| 19 if (params && params->level && | |
| 20 *(params->level) == power_api_constants::kSystemLevelValue) | |
| 21 level = PowerApiManager::LEVEL_SYSTEM; | |
|
not at google - send to devlin
2013/03/19 21:16:39
enums get compiled down to real C++ enums, so you
Daniel Erat
2013/03/19 23:39:38
Done (well, not using a switch, but got rid of the
| |
| 22 | |
| 23 PowerApiManager::GetInstance()->AddRequest(extension_id(), level); | |
| 24 return true; | |
| 25 } | |
| 26 | |
| 27 bool PowerReleaseKeepAwakeFunction::RunImpl() { | |
| 28 PowerApiManager::GetInstance()->RemoveRequest(extension_id()); | |
| 29 return true; | |
| 30 } | |
| 31 | |
| 32 } // namespace extensions | |
| OLD | NEW |