root/chrome/browser/extensions/api/power/power_api.cc

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. RunImpl
  2. RunImpl

// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/extensions/api/power/power_api.h"

#include "chrome/browser/extensions/api/power/power_api_manager.h"
#include "chrome/common/extensions/api/power.h"

namespace extensions {

bool PowerRequestKeepAwakeFunction::RunImpl() {
  scoped_ptr<api::power::RequestKeepAwake::Params> params(
      api::power::RequestKeepAwake::Params::Create(*args_));
  EXTENSION_FUNCTION_VALIDATE(params);
  EXTENSION_FUNCTION_VALIDATE(params->level != api::power::LEVEL_NONE);
  PowerApiManager::GetInstance()->AddRequest(extension_id(), params->level);
  return true;
}

bool PowerReleaseKeepAwakeFunction::RunImpl() {
  PowerApiManager::GetInstance()->RemoveRequest(extension_id());
  return true;
}

}  // namespace extensions

/* [<][>][^][v][top][bottom][index][help] */