#ifndef CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_
#include <string>
#include "base/compiler_specific.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "extensions/common/permissions/permission_set.h"
class ExtensionService;
namespace extensions {
class PermissionsContainsFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("permissions.contains", PERMISSIONS_CONTAINS)
protected:
virtual ~PermissionsContainsFunction() {}
virtual bool RunImpl() OVERRIDE;
};
class PermissionsGetAllFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("permissions.getAll", PERMISSIONS_GETALL)
protected:
virtual ~PermissionsGetAllFunction() {}
virtual bool RunImpl() OVERRIDE;
};
class PermissionsRemoveFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("permissions.remove", PERMISSIONS_REMOVE)
protected:
virtual ~PermissionsRemoveFunction() {}
virtual bool RunImpl() OVERRIDE;
};
class PermissionsRequestFunction : public ChromeAsyncExtensionFunction,
public ExtensionInstallPrompt::Delegate {
public:
DECLARE_EXTENSION_FUNCTION("permissions.request", PERMISSIONS_REQUEST)
PermissionsRequestFunction();
static void SetAutoConfirmForTests(bool should_proceed);
static void SetIgnoreUserGestureForTests(bool ignore);
virtual void InstallUIProceed() OVERRIDE;
virtual void InstallUIAbort(bool user_initiated) OVERRIDE;
protected:
virtual ~PermissionsRequestFunction();
virtual bool RunImpl() OVERRIDE;
private:
scoped_ptr<ExtensionInstallPrompt> install_ui_;
scoped_refptr<extensions::PermissionSet> requested_permissions_;
};
}
#endif