| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_EXTENSION_PERMISSIONS_API_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PERMISSIONS_API_H__ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PERMISSIONS_API_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PERMISSIONS_API_H__ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/extensions/extension_function.h" | 9 #include "chrome/browser/extensions/extension_function.h" |
| 10 #include "chrome/browser/extensions/extension_install_ui.h" | 10 #include "chrome/browser/extensions/extension_install_ui.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 enum EventType { | 41 enum EventType { |
| 42 ADDED, | 42 ADDED, |
| 43 REMOVED, | 43 REMOVED, |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 // Dispatches specified event to the extension. | 46 // Dispatches specified event to the extension. |
| 47 void DispatchEvent(const std::string& extension_id, | 47 void DispatchEvent(const std::string& extension_id, |
| 48 const char* event_name, | 48 const char* event_name, |
| 49 const ExtensionPermissionSet* changed_permissions); | 49 const ExtensionPermissionSet* changed_permissions); |
| 50 | 50 |
| 51 // Issues the relevant events, messages and notifications when the permissions | 51 // Issues the relevant events, messages and notifications when the |
| 52 // have changed for the |extension| (|changed| is the permission delta, while | 52 // |extension|'s permissions have |changed| (|changed| is the delta). |
| 53 // |active| is the new permission set). Specifically, this sends the | 53 // Specifically, this sends the EXTENSION_PERMISSIONS_UPDATED notification, |
| 54 // EXTENSION_PERMISSIONS_UPDATED notification, the | 54 // the ExtensionMsg_UpdatePermissions IPC message, and fires the |
| 55 // ExtensionMsg_UpdatePermissions IPC message, and fires the onAdded/onRemoved | 55 // onAdded/onRemoved events in the extension. |
| 56 // events in the extension. | 56 void NotifyPermissionsUpdated(EventType event_type, |
| 57 void NotifyPermissionsUpdated(const Extension* extension, | 57 const Extension* extension, |
| 58 const ExtensionPermissionSet* active, | 58 const ExtensionPermissionSet* changed); |
| 59 const ExtensionPermissionSet* changed, | |
| 60 EventType event_type); | |
| 61 | 59 |
| 62 ExtensionService* extension_service_; | 60 ExtensionService* extension_service_; |
| 63 }; | 61 }; |
| 64 | 62 |
| 65 | 63 |
| 66 // chrome.permissions.contains | 64 // chrome.permissions.contains |
| 67 class ContainsPermissionsFunction : public SyncExtensionFunction { | 65 class ContainsPermissionsFunction : public SyncExtensionFunction { |
| 68 virtual ~ContainsPermissionsFunction() {} | 66 virtual ~ContainsPermissionsFunction() {} |
| 69 virtual bool RunImpl() OVERRIDE; | 67 virtual bool RunImpl() OVERRIDE; |
| 70 DECLARE_EXTENSION_FUNCTION_NAME("experimental.permissions.contains") | 68 DECLARE_EXTENSION_FUNCTION_NAME("experimental.permissions.contains") |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 virtual bool RunImpl() OVERRIDE; | 100 virtual bool RunImpl() OVERRIDE; |
| 103 | 101 |
| 104 private: | 102 private: |
| 105 scoped_ptr<ExtensionInstallUI> install_ui_; | 103 scoped_ptr<ExtensionInstallUI> install_ui_; |
| 106 scoped_refptr<ExtensionPermissionSet> requested_permissions_; | 104 scoped_refptr<ExtensionPermissionSet> requested_permissions_; |
| 107 const Extension* extension_; | 105 const Extension* extension_; |
| 108 DECLARE_EXTENSION_FUNCTION_NAME("experimental.permissions.request") | 106 DECLARE_EXTENSION_FUNCTION_NAME("experimental.permissions.request") |
| 109 }; | 107 }; |
| 110 | 108 |
| 111 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PERMISSIONS_API_H__ | 109 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PERMISSIONS_API_H__ |
| OLD | NEW |