blob: 8834587e0ff74ac105b8405db6fa855c39c130c9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
// Copyright (c) 2012 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.
#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 "chrome/common/extensions/permissions/permission_set.h"
class ExtensionService;
namespace extensions {
// chrome.permissions.contains
class PermissionsContainsFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("permissions.contains", PERMISSIONS_CONTAINS)
protected:
virtual ~PermissionsContainsFunction() {}
// ExtensionFunction:
virtual bool RunImpl() OVERRIDE;
};
// chrome.permissions.getAll
class PermissionsGetAllFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("permissions.getAll", PERMISSIONS_GETALL)
protected:
virtual ~PermissionsGetAllFunction() {}
// ExtensionFunction:
virtual bool RunImpl() OVERRIDE;
};
// chrome.permissions.remove
class PermissionsRemoveFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("permissions.remove", PERMISSIONS_REMOVE)
protected:
virtual ~PermissionsRemoveFunction() {}
// ExtensionFunction:
virtual bool RunImpl() OVERRIDE;
};
// chrome.permissions.request
class PermissionsRequestFunction : public ChromeAsyncExtensionFunction,
public ExtensionInstallPrompt::Delegate {
public:
DECLARE_EXTENSION_FUNCTION("permissions.request", PERMISSIONS_REQUEST)
PermissionsRequestFunction();
// FOR TESTS ONLY to bypass the confirmation UI.
static void SetAutoConfirmForTests(bool should_proceed);
static void SetIgnoreUserGestureForTests(bool ignore);
// ExtensionInstallPrompt::Delegate:
virtual void InstallUIProceed() OVERRIDE;
virtual void InstallUIAbort(bool user_initiated) OVERRIDE;
protected:
virtual ~PermissionsRequestFunction();
// ExtensionFunction:
virtual bool RunImpl() OVERRIDE;
private:
scoped_ptr<ExtensionInstallPrompt> install_ui_;
scoped_refptr<extensions::PermissionSet> requested_permissions_;
};
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_
|