| 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_PERMISSIONS_UPDATER_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_PERMISSIONS_UPDATER_H__ |
| 6 #define CHROME_BROWSER_EXTENSIONS_PERMISSIONS_UPDATER_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_PERMISSIONS_UPDATER_H__ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 void AddPermissions(const Extension* extension, | 35 void AddPermissions(const Extension* extension, |
| 36 const PermissionSet* permissions); | 36 const PermissionSet* permissions); |
| 37 | 37 |
| 38 // Removes the set of |permissions| from the |extension|'s active permission | 38 // Removes the set of |permissions| from the |extension|'s active permission |
| 39 // set and sends the relevant messages and notifications. | 39 // set and sends the relevant messages and notifications. |
| 40 void RemovePermissions(const Extension* extension, | 40 void RemovePermissions(const Extension* extension, |
| 41 const PermissionSet* permissions); | 41 const PermissionSet* permissions); |
| 42 | 42 |
| 43 // Adds all permissions in the |extension|'s active permissions to its | 43 // Adds all permissions in the |extension|'s active permissions to its |
| 44 // granted permission set. | 44 // granted permission set. |
| 45 void GrantActivePermissions(const Extension* extension); | 45 void GrantActivePermissions(const Extension* extension, |
| 46 bool record_oauth2_grant); |
| 46 | 47 |
| 47 // Sets the |extension|'s active permissions to |permissions|. | 48 // Sets the |extension|'s active permissions to |permissions|. |
| 48 void UpdateActivePermissions(const Extension* extension, | 49 void UpdateActivePermissions(const Extension* extension, |
| 49 const PermissionSet* permissions); | 50 const PermissionSet* permissions); |
| 50 | 51 |
| 51 private: | 52 private: |
| 52 enum EventType { | 53 enum EventType { |
| 53 ADDED, | 54 ADDED, |
| 54 REMOVED, | 55 REMOVED, |
| 55 }; | 56 }; |
| 56 | 57 |
| 58 // Records the oauth2 grant for the scopes specified in |permissions|. |
| 59 void RecordOAuth2Grant(const Extension* extension); |
| 60 |
| 57 // Dispatches specified event to the extension. | 61 // Dispatches specified event to the extension. |
| 58 void DispatchEvent(const std::string& extension_id, | 62 void DispatchEvent(const std::string& extension_id, |
| 59 const char* event_name, | 63 const char* event_name, |
| 60 const PermissionSet* changed_permissions); | 64 const PermissionSet* changed_permissions); |
| 61 | 65 |
| 62 // Issues the relevant events, messages and notifications when the | 66 // Issues the relevant events, messages and notifications when the |
| 63 // |extension|'s permissions have |changed| (|changed| is the delta). | 67 // |extension|'s permissions have |changed| (|changed| is the delta). |
| 64 // Specifically, this sends the EXTENSION_PERMISSIONS_UPDATED notification, | 68 // Specifically, this sends the EXTENSION_PERMISSIONS_UPDATED notification, |
| 65 // the ExtensionMsg_UpdatePermissions IPC message, and fires the | 69 // the ExtensionMsg_UpdatePermissions IPC message, and fires the |
| 66 // onAdded/onRemoved events in the extension. | 70 // onAdded/onRemoved events in the extension. |
| 67 void NotifyPermissionsUpdated(EventType event_type, | 71 void NotifyPermissionsUpdated(EventType event_type, |
| 68 const Extension* extension, | 72 const Extension* extension, |
| 69 const PermissionSet* changed); | 73 const PermissionSet* changed); |
| 70 | 74 |
| 71 // Gets the ExtensionPrefs for the associated profile. | 75 // Gets the ExtensionPrefs for the associated profile. |
| 72 ExtensionPrefs* GetExtensionPrefs(); | 76 ExtensionPrefs* GetExtensionPrefs(); |
| 73 | 77 |
| 74 Profile* profile_; | 78 Profile* profile_; |
| 75 }; | 79 }; |
| 76 | 80 |
| 77 } // namespace extensions | 81 } // namespace extensions |
| 78 | 82 |
| 79 #endif // CHROME_BROWSER_EXTENSIONS_PERMISSIONS_UPDATER_H__ | 83 #endif // CHROME_BROWSER_EXTENSIONS_PERMISSIONS_UPDATER_H__ |
| OLD | NEW |