chromium/extensions/browser/api/power/power_api.h

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef EXTENSIONS_BROWSER_API_POWER_POWER_API_H_
#define EXTENSIONS_BROWSER_API_POWER_POWER_API_H_

#include <map>
#include <memory>
#include <string>

#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "build/chromeos_buildflags.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/extension_function.h"
#include "extensions/browser/extension_registry_observer.h"
#include "extensions/common/api/power.h"
#include "extensions/common/extension_id.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/device/public/mojom/wake_lock.mojom.h"

namespace content {
class BrowserContext;
}

namespace extensions {

// Implementation of the chrome.power.requestKeepAwake API.
class PowerRequestKeepAwakeFunction : public ExtensionFunction {};

// Implementation of the chrome.power.releaseKeepAwake API.
class PowerReleaseKeepAwakeFunction : public ExtensionFunction {};

#if BUILDFLAG(IS_CHROMEOS)
// Implementation of the chrome.power.reportActivity API.
class PowerReportActivityFunction : public ExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("power.reportActivity", POWER_REPORTACTIVITY)

 protected:
  ~PowerReportActivityFunction() override = default;

  // ExtensionFunction:
  ResponseAction Run() override;
};
#endif  // BUILDFLAG(IS_CHROMEOS)

// Handles calls made via the chrome.power API. There is a separate instance of
// this class for each profile, as requests are tracked by extension ID, but a
// regular and incognito profile will share the same instance.
class PowerAPI : public BrowserContextKeyedAPI,
                 public extensions::ExtensionRegistryObserver {};

}  // namespace extensions

#endif  // EXTENSIONS_BROWSER_API_POWER_POWER_API_H_