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_COMMON_EXTENSIONS_EXTENSION_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <iosfwd> | 9 #include <iosfwd> |
10 #include <map> | 10 #include <map> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <utility> | 13 #include <utility> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/file_path.h" | 16 #include "base/file_path.h" |
17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
18 #include "base/hash_tables.h" | 18 #include "base/hash_tables.h" |
19 #include "base/memory/linked_ptr.h" | 19 #include "base/memory/linked_ptr.h" |
20 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
21 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
22 #include "base/synchronization/lock.h" | 22 #include "base/synchronization/lock.h" |
23 #include "chrome/common/extensions/command.h" | 23 #include "chrome/common/extensions/command.h" |
24 #include "chrome/common/extensions/extension_action.h" | 24 #include "chrome/common/extensions/extension_action.h" |
25 #include "chrome/common/extensions/extension_constants.h" | 25 #include "chrome/common/extensions/extension_constants.h" |
26 #include "chrome/common/extensions/extension_icon_set.h" | 26 #include "chrome/common/extensions/extension_icon_set.h" |
27 #include "chrome/common/extensions/permissions/api_permission.h" | 27 #include "chrome/common/extensions/permissions/api_permission.h" |
| 28 #include "chrome/common/extensions/permissions/api_permission_set.h" |
28 #include "chrome/common/extensions/permissions/permission_message.h" | 29 #include "chrome/common/extensions/permissions/permission_message.h" |
29 #include "chrome/common/extensions/user_script.h" | 30 #include "chrome/common/extensions/user_script.h" |
30 #include "chrome/common/extensions/url_pattern.h" | 31 #include "chrome/common/extensions/url_pattern.h" |
31 #include "chrome/common/extensions/url_pattern_set.h" | 32 #include "chrome/common/extensions/url_pattern_set.h" |
32 #include "googleurl/src/gurl.h" | 33 #include "googleurl/src/gurl.h" |
33 #include "ui/base/accelerators/accelerator.h" | 34 #include "ui/base/accelerators/accelerator.h" |
34 #include "ui/gfx/size.h" | 35 #include "ui/gfx/size.h" |
35 | 36 |
36 class ExtensionResource; | 37 class ExtensionResource; |
37 class FileBrowserHandler; | 38 class FileBrowserHandler; |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 // from |manifest_|. | 443 // from |manifest_|. |
443 bool ParsePermissions(const char* key, | 444 bool ParsePermissions(const char* key, |
444 string16* error, | 445 string16* error, |
445 APIPermissionSet* api_permissions, | 446 APIPermissionSet* api_permissions, |
446 URLPatternSet* host_permissions); | 447 URLPatternSet* host_permissions); |
447 | 448 |
448 bool HasAPIPermission(APIPermission::ID permission) const; | 449 bool HasAPIPermission(APIPermission::ID permission) const; |
449 bool HasAPIPermission(const std::string& function_name) const; | 450 bool HasAPIPermission(const std::string& function_name) const; |
450 bool HasAPIPermissionForTab(int tab_id, APIPermission::ID permission) const; | 451 bool HasAPIPermissionForTab(int tab_id, APIPermission::ID permission) const; |
451 | 452 |
| 453 bool CheckAPIPermissionWithDetail(APIPermission::ID permission, |
| 454 const APIPermissionDetail::CheckParam* param) const; |
| 455 |
452 const URLPatternSet& GetEffectiveHostPermissions() const; | 456 const URLPatternSet& GetEffectiveHostPermissions() const; |
453 | 457 |
454 // Returns true if the extension can silently increase its permission level. | 458 // Returns true if the extension can silently increase its permission level. |
455 // Users must approve permissions for unpacked and packed extensions in the | 459 // Users must approve permissions for unpacked and packed extensions in the |
456 // following situations: | 460 // following situations: |
457 // - when installing or upgrading packed extensions | 461 // - when installing or upgrading packed extensions |
458 // - when installing unpacked extensions that have NPAPI plugins | 462 // - when installing unpacked extensions that have NPAPI plugins |
459 // - when either type of extension requests optional permissions | 463 // - when either type of extension requests optional permissions |
460 bool CanSilentlyIncreasePermissions() const; | 464 bool CanSilentlyIncreasePermissions() const; |
461 | 465 |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 | 1195 |
1192 UpdatedExtensionPermissionsInfo( | 1196 UpdatedExtensionPermissionsInfo( |
1193 const Extension* extension, | 1197 const Extension* extension, |
1194 const PermissionSet* permissions, | 1198 const PermissionSet* permissions, |
1195 Reason reason); | 1199 Reason reason); |
1196 }; | 1200 }; |
1197 | 1201 |
1198 } // namespace extensions | 1202 } // namespace extensions |
1199 | 1203 |
1200 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 1204 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
OLD | NEW |