OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "chrome/browser/extensions/extension_function.h" | 11 #include "chrome/browser/extensions/extension_function.h" |
12 #include "chrome/browser/extensions/extension_install_prompt.h" | 12 #include "chrome/browser/extensions/extension_install_prompt.h" |
13 #include "chrome/common/extensions/permissions/permission_set.h" | 13 #include "chrome/common/extensions/permissions/permission_set.h" |
14 | 14 |
15 class ExtensionService; | 15 class ExtensionService; |
16 | 16 |
17 // chrome.permissions.contains | 17 // chrome.permissions.contains |
18 class PermissionsContainsFunction : public SyncExtensionFunction { | 18 class ContainsPermissionsFunction : public SyncExtensionFunction { |
19 public: | 19 public: |
20 DECLARE_EXTENSION_FUNCTION_NAME("permissions.contains") | 20 DECLARE_EXTENSION_FUNCTION_NAME("permissions.contains") |
21 | 21 |
22 protected: | 22 protected: |
23 virtual ~PermissionsContainsFunction() {} | 23 virtual ~ContainsPermissionsFunction() {} |
24 | 24 |
25 // ExtensionFunction: | 25 // ExtensionFunction: |
26 virtual bool RunImpl() OVERRIDE; | 26 virtual bool RunImpl() OVERRIDE; |
27 }; | 27 }; |
28 | 28 |
29 // chrome.permissions.getAll | 29 // chrome.permissions.getAll |
30 class PermissionsGetAllFunction : public SyncExtensionFunction { | 30 class GetAllPermissionsFunction : public SyncExtensionFunction { |
31 public: | 31 public: |
32 DECLARE_EXTENSION_FUNCTION_NAME("permissions.getAll") | 32 DECLARE_EXTENSION_FUNCTION_NAME("permissions.getAll") |
33 | 33 |
34 protected: | 34 protected: |
35 virtual ~PermissionsGetAllFunction() {} | 35 virtual ~GetAllPermissionsFunction() {} |
36 | 36 |
37 // ExtensionFunction: | 37 // ExtensionFunction: |
38 virtual bool RunImpl() OVERRIDE; | 38 virtual bool RunImpl() OVERRIDE; |
39 }; | 39 }; |
40 | 40 |
41 // chrome.permissions.remove | 41 // chrome.permissions.remove |
42 class PermissionsRemoveFunction : public SyncExtensionFunction { | 42 class RemovePermissionsFunction : public SyncExtensionFunction { |
43 public: | 43 public: |
44 DECLARE_EXTENSION_FUNCTION_NAME("permissions.remove") | 44 DECLARE_EXTENSION_FUNCTION_NAME("permissions.remove") |
45 | 45 |
46 protected: | 46 protected: |
47 virtual ~PermissionsRemoveFunction() {} | 47 virtual ~RemovePermissionsFunction() {} |
48 | 48 |
49 // ExtensionFunction: | 49 // ExtensionFunction: |
50 virtual bool RunImpl() OVERRIDE; | 50 virtual bool RunImpl() OVERRIDE; |
51 }; | 51 }; |
52 | 52 |
53 // chrome.permissions.request | 53 // chrome.permissions.request |
54 class PermissionsRequestFunction : public AsyncExtensionFunction, | 54 class RequestPermissionsFunction : public AsyncExtensionFunction, |
55 public ExtensionInstallPrompt::Delegate { | 55 public ExtensionInstallPrompt::Delegate { |
56 public: | 56 public: |
57 DECLARE_EXTENSION_FUNCTION_NAME("permissions.request") | 57 DECLARE_EXTENSION_FUNCTION_NAME("permissions.request") |
58 | 58 |
59 PermissionsRequestFunction(); | 59 RequestPermissionsFunction(); |
60 | 60 |
61 // FOR TESTS ONLY to bypass the confirmation UI. | 61 // FOR TESTS ONLY to bypass the confirmation UI. |
62 static void SetAutoConfirmForTests(bool should_proceed); | 62 static void SetAutoConfirmForTests(bool should_proceed); |
63 static void SetIgnoreUserGestureForTests(bool ignore); | 63 static void SetIgnoreUserGestureForTests(bool ignore); |
64 | 64 |
65 // ExtensionInstallPrompt::Delegate: | 65 // ExtensionInstallPrompt::Delegate: |
66 virtual void InstallUIProceed() OVERRIDE; | 66 virtual void InstallUIProceed() OVERRIDE; |
67 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; | 67 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; |
68 | 68 |
69 protected: | 69 protected: |
70 virtual ~PermissionsRequestFunction(); | 70 virtual ~RequestPermissionsFunction(); |
71 | 71 |
72 // ExtensionFunction: | 72 // ExtensionFunction: |
73 virtual bool RunImpl() OVERRIDE; | 73 virtual bool RunImpl() OVERRIDE; |
74 | 74 |
75 private: | 75 private: |
76 scoped_ptr<ExtensionInstallPrompt> install_ui_; | 76 scoped_ptr<ExtensionInstallPrompt> install_ui_; |
77 scoped_refptr<extensions::PermissionSet> requested_permissions_; | 77 scoped_refptr<extensions::PermissionSet> requested_permissions_; |
78 }; | 78 }; |
79 | 79 |
80 #endif // CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_ | 80 #endif // CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_ |
OLD | NEW |