Chromium Code Reviews| 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 "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "chrome/browser/extensions/extension_function.h" | 10 #include "chrome/browser/extensions/extension_function.h" |
| 11 #include "chrome/browser/extensions/extension_install_ui.h" | 11 #include "chrome/browser/extensions/extension_install_ui.h" |
| 12 #include "chrome/common/extensions/extension_permission_set.h" | 12 #include "chrome/common/extensions/extension_permission_set.h" |
| 13 #include "chrome/common/chrome_notification_types.h" | |
| 14 #include "content/browser/renderer_host/render_process_host.h" | |
| 15 | 13 |
| 16 namespace base { | 14 namespace base { |
| 17 class DictionaryValue; | 15 class DictionaryValue; |
| 18 } | 16 } |
| 19 class Extension; | 17 class Extension; |
| 20 class ExtensionPermissionSet; | 18 class ExtensionPermissionSet; |
| 21 class ExtensionService; | 19 class ExtensionService; |
| 22 class Profile; | 20 class Profile; |
| 23 | 21 |
| 24 class ExtensionPermissionsManager { | 22 class ExtensionPermissionsUpdater { |
|
Aaron Boodman
2011/11/14 19:26:05
In general, it's not great to have more than one t
jstritar
2011/12/12 22:28:03
Done.
| |
| 25 public: | 23 public: |
| 26 explicit ExtensionPermissionsManager(ExtensionService* extension_service); | 24 explicit ExtensionPermissionsUpdater(ExtensionService* extension_service); |
| 27 ~ExtensionPermissionsManager(); | 25 ~ExtensionPermissionsUpdater(); |
| 28 | 26 |
| 29 // Adds the set of |permissions| to the |extension|'s active permission set | 27 // Adds the set of |permissions| to the |extension|'s active permission set |
| 30 // and sends the relevant messages and notifications. This method assumes the | 28 // and sends the relevant messages and notifications. This method assumes the |
| 31 // user has already been prompted, if necessary, for the extra permissions. | 29 // user has already been prompted, if necessary, for the extra permissions. |
| 32 void AddPermissions(const Extension* extension, | 30 void AddPermissions(const Extension* extension, |
| 33 const ExtensionPermissionSet* permissions); | 31 const ExtensionPermissionSet* permissions); |
| 34 | 32 |
| 35 // Removes the set of |permissions| from the |extension|'s active permission | 33 // Removes the set of |permissions| from the |extension|'s active permission |
| 36 // set and sends the relevant messages and notifications. | 34 // set and sends the relevant messages and notifications. |
| 37 void RemovePermissions(const Extension* extension, | 35 void RemovePermissions(const Extension* extension, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 virtual void InstallUIProceed() OVERRIDE; | 94 virtual void InstallUIProceed() OVERRIDE; |
| 97 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; | 95 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; |
| 98 | 96 |
| 99 protected: | 97 protected: |
| 100 virtual ~RequestPermissionsFunction(); | 98 virtual ~RequestPermissionsFunction(); |
| 101 virtual bool RunImpl() OVERRIDE; | 99 virtual bool RunImpl() OVERRIDE; |
| 102 | 100 |
| 103 private: | 101 private: |
| 104 scoped_ptr<ExtensionInstallUI> install_ui_; | 102 scoped_ptr<ExtensionInstallUI> install_ui_; |
| 105 scoped_refptr<ExtensionPermissionSet> requested_permissions_; | 103 scoped_refptr<ExtensionPermissionSet> requested_permissions_; |
| 106 const Extension* extension_; | |
| 107 DECLARE_EXTENSION_FUNCTION_NAME("permissions.request") | 104 DECLARE_EXTENSION_FUNCTION_NAME("permissions.request") |
| 108 }; | 105 }; |
| 109 | 106 |
| 110 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PERMISSIONS_API_H__ | 107 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PERMISSIONS_API_H__ |
| OLD | NEW |