Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / extensions / api / permissions / permissions_api.h
blobfa6431f27716069428aebe31cc46038917b93853
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "chrome/browser/extensions/chrome_extension_function.h"
12 #include "chrome/browser/extensions/extension_install_prompt.h"
13 #include "extensions/common/permissions/permission_set.h"
15 namespace extensions {
17 // chrome.permissions.contains
18 class PermissionsContainsFunction : public ChromeSyncExtensionFunction {
19 public:
20 DECLARE_EXTENSION_FUNCTION("permissions.contains", PERMISSIONS_CONTAINS)
22 protected:
23 ~PermissionsContainsFunction() override {}
25 // ExtensionFunction:
26 bool RunSync() override;
29 // chrome.permissions.getAll
30 class PermissionsGetAllFunction : public ChromeSyncExtensionFunction {
31 public:
32 DECLARE_EXTENSION_FUNCTION("permissions.getAll", PERMISSIONS_GETALL)
34 protected:
35 ~PermissionsGetAllFunction() override {}
37 // ExtensionFunction:
38 bool RunSync() override;
41 // chrome.permissions.remove
42 class PermissionsRemoveFunction : public ChromeSyncExtensionFunction {
43 public:
44 DECLARE_EXTENSION_FUNCTION("permissions.remove", PERMISSIONS_REMOVE)
46 protected:
47 ~PermissionsRemoveFunction() override {}
49 // ExtensionFunction:
50 bool RunSync() override;
53 // chrome.permissions.request
54 class PermissionsRequestFunction : public ChromeAsyncExtensionFunction,
55 public ExtensionInstallPrompt::Delegate {
56 public:
57 DECLARE_EXTENSION_FUNCTION("permissions.request", PERMISSIONS_REQUEST)
59 PermissionsRequestFunction();
61 // FOR TESTS ONLY to bypass the confirmation UI.
62 static void SetAutoConfirmForTests(bool should_proceed);
63 static void SetIgnoreUserGestureForTests(bool ignore);
65 // ExtensionInstallPrompt::Delegate:
66 void InstallUIProceed() override;
67 void InstallUIAbort(bool user_initiated) override;
69 protected:
70 ~PermissionsRequestFunction() override;
72 // ExtensionFunction:
73 bool RunAsync() override;
75 private:
76 scoped_ptr<ExtensionInstallPrompt> install_ui_;
77 scoped_refptr<extensions::PermissionSet> requested_permissions_;
80 } // namespace extensions
82 #endif // CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_