Enable Enterprise enrollment on desktop builds.
[chromium-blink-merge.git] / chrome / browser / extensions / api / permissions / permissions_api.h
blob43de8afd96ef1128ac878860dbf1c6fafd1fe795
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 class ExtensionService;
17 namespace extensions {
19 // chrome.permissions.contains
20 class PermissionsContainsFunction : public ChromeSyncExtensionFunction {
21 public:
22 DECLARE_EXTENSION_FUNCTION("permissions.contains", PERMISSIONS_CONTAINS)
24 protected:
25 virtual ~PermissionsContainsFunction() {}
27 // ExtensionFunction:
28 virtual bool RunSync() OVERRIDE;
31 // chrome.permissions.getAll
32 class PermissionsGetAllFunction : public ChromeSyncExtensionFunction {
33 public:
34 DECLARE_EXTENSION_FUNCTION("permissions.getAll", PERMISSIONS_GETALL)
36 protected:
37 virtual ~PermissionsGetAllFunction() {}
39 // ExtensionFunction:
40 virtual bool RunSync() OVERRIDE;
43 // chrome.permissions.remove
44 class PermissionsRemoveFunction : public ChromeSyncExtensionFunction {
45 public:
46 DECLARE_EXTENSION_FUNCTION("permissions.remove", PERMISSIONS_REMOVE)
48 protected:
49 virtual ~PermissionsRemoveFunction() {}
51 // ExtensionFunction:
52 virtual bool RunSync() OVERRIDE;
55 // chrome.permissions.request
56 class PermissionsRequestFunction : public ChromeAsyncExtensionFunction,
57 public ExtensionInstallPrompt::Delegate {
58 public:
59 DECLARE_EXTENSION_FUNCTION("permissions.request", PERMISSIONS_REQUEST)
61 PermissionsRequestFunction();
63 // FOR TESTS ONLY to bypass the confirmation UI.
64 static void SetAutoConfirmForTests(bool should_proceed);
65 static void SetIgnoreUserGestureForTests(bool ignore);
67 // ExtensionInstallPrompt::Delegate:
68 virtual void InstallUIProceed() OVERRIDE;
69 virtual void InstallUIAbort(bool user_initiated) OVERRIDE;
71 protected:
72 virtual ~PermissionsRequestFunction();
74 // ExtensionFunction:
75 virtual bool RunImpl() OVERRIDE;
77 private:
78 scoped_ptr<ExtensionInstallPrompt> install_ui_;
79 scoped_refptr<extensions::PermissionSet> requested_permissions_;
82 } // namespace extensions
84 #endif // CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_