| 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 "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/extensions/chrome_extension_function.h" | 12 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 13 #include "chrome/browser/extensions/extension_install_prompt.h" | 13 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 14 #include "extensions/common/permissions/permission_set.h" | 14 #include "extensions/common/permissions/permission_set.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 // chrome.permissions.contains | 18 // chrome.permissions.contains |
| 19 class PermissionsContainsFunction : public ChromeSyncExtensionFunction { | 19 class PermissionsContainsFunction : public UIThreadExtensionFunction { |
| 20 public: | 20 public: |
| 21 DECLARE_EXTENSION_FUNCTION("permissions.contains", PERMISSIONS_CONTAINS) | 21 DECLARE_EXTENSION_FUNCTION("permissions.contains", PERMISSIONS_CONTAINS) |
| 22 | 22 |
| 23 protected: | 23 protected: |
| 24 ~PermissionsContainsFunction() override {} | 24 ~PermissionsContainsFunction() override {} |
| 25 | 25 |
| 26 // ExtensionFunction: | 26 // ExtensionFunction: |
| 27 bool RunSync() override; | 27 ResponseAction Run() override; |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 // chrome.permissions.getAll | 30 // chrome.permissions.getAll |
| 31 class PermissionsGetAllFunction : public ChromeSyncExtensionFunction { | 31 class PermissionsGetAllFunction : public UIThreadExtensionFunction { |
| 32 public: | 32 public: |
| 33 DECLARE_EXTENSION_FUNCTION("permissions.getAll", PERMISSIONS_GETALL) | 33 DECLARE_EXTENSION_FUNCTION("permissions.getAll", PERMISSIONS_GETALL) |
| 34 | 34 |
| 35 protected: | 35 protected: |
| 36 ~PermissionsGetAllFunction() override {} | 36 ~PermissionsGetAllFunction() override {} |
| 37 | 37 |
| 38 // ExtensionFunction: | 38 // ExtensionFunction: |
| 39 bool RunSync() override; | 39 ResponseAction Run() override; |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 // chrome.permissions.remove | 42 // chrome.permissions.remove |
| 43 class PermissionsRemoveFunction : public ChromeSyncExtensionFunction { | 43 class PermissionsRemoveFunction : public UIThreadExtensionFunction { |
| 44 public: | 44 public: |
| 45 DECLARE_EXTENSION_FUNCTION("permissions.remove", PERMISSIONS_REMOVE) | 45 DECLARE_EXTENSION_FUNCTION("permissions.remove", PERMISSIONS_REMOVE) |
| 46 | 46 |
| 47 protected: | 47 protected: |
| 48 ~PermissionsRemoveFunction() override {} | 48 ~PermissionsRemoveFunction() override {} |
| 49 | 49 |
| 50 // ExtensionFunction: | 50 // ExtensionFunction: |
| 51 bool RunSync() override; | 51 ResponseAction Run() override; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 // chrome.permissions.request | 54 // chrome.permissions.request |
| 55 class PermissionsRequestFunction : public ChromeAsyncExtensionFunction { | 55 class PermissionsRequestFunction : public ChromeAsyncExtensionFunction { |
| 56 public: | 56 public: |
| 57 DECLARE_EXTENSION_FUNCTION("permissions.request", PERMISSIONS_REQUEST) | 57 DECLARE_EXTENSION_FUNCTION("permissions.request", PERMISSIONS_REQUEST) |
| 58 | 58 |
| 59 PermissionsRequestFunction(); | 59 PermissionsRequestFunction(); |
| 60 | 60 |
| 61 // FOR TESTS ONLY to bypass the confirmation UI. | 61 // FOR TESTS ONLY to bypass the confirmation UI. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 73 | 73 |
| 74 std::unique_ptr<ExtensionInstallPrompt> install_ui_; | 74 std::unique_ptr<ExtensionInstallPrompt> install_ui_; |
| 75 std::unique_ptr<const PermissionSet> requested_permissions_; | 75 std::unique_ptr<const PermissionSet> requested_permissions_; |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(PermissionsRequestFunction); | 77 DISALLOW_COPY_AND_ASSIGN(PermissionsRequestFunction); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 } // namespace extensions | 80 } // namespace extensions |
| 81 | 81 |
| 82 #endif // CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_ | 82 #endif // CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_ |
| OLD | NEW |