| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_INTERNAL_H_ | 4 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_INTERNAL_H_ |
| 5 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_INTERNAL_H_ | 5 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_INTERNAL_H_ |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/browser/extensions/extension_management.h" | 11 #include "chrome/browser/extensions/extension_management.h" |
| 12 #include "extensions/common/manifest.h" | 12 #include "extensions/common/manifest.h" |
| 13 #include "extensions/common/permissions/api_permission_set.h" | 13 #include "extensions/common/permissions/api_permission_set.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class DictionaryValue; | 16 class DictionaryValue; |
| 17 class Version; |
| 17 } // namespace base | 18 } // namespace base |
| 18 | 19 |
| 19 namespace extensions { | 20 namespace extensions { |
| 20 | 21 |
| 21 class URLPatternSet; | 22 class URLPatternSet; |
| 22 | 23 |
| 23 namespace internal { | 24 namespace internal { |
| 24 | 25 |
| 25 // Class to hold extension management settings for one or a group of | 26 // Class to hold extension management settings for one or a group of |
| 26 // extensions. Settings can be applied to an individual extension identified | 27 // extensions. Settings can be applied to an individual extension identified |
| (...skipping 13 matching lines...) Expand all Loading... |
| 40 // Parses the default settings. | 41 // Parses the default settings. |
| 41 SCOPE_DEFAULT = 0, | 42 SCOPE_DEFAULT = 0, |
| 42 // Parses the settings for extensions with specified update URL in its | 43 // Parses the settings for extensions with specified update URL in its |
| 43 // manifest. | 44 // manifest. |
| 44 SCOPE_UPDATE_URL, | 45 SCOPE_UPDATE_URL, |
| 45 // Parses the settings for an extension with specified extension ID. | 46 // Parses the settings for an extension with specified extension ID. |
| 46 SCOPE_INDIVIDUAL, | 47 SCOPE_INDIVIDUAL, |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 IndividualSettings(); | 50 IndividualSettings(); |
| 51 explicit IndividualSettings(const IndividualSettings* default_settings); |
| 50 ~IndividualSettings(); | 52 ~IndividualSettings(); |
| 51 | 53 |
| 52 void Reset(); | 54 void Reset(); |
| 53 | 55 |
| 54 // Parses the individual settings. |dict| is a sub-dictionary in extension | 56 // Parses the individual settings. |dict| is a sub-dictionary in extension |
| 55 // management preference and |scope| represents the applicable range of the | 57 // management preference and |scope| represents the applicable range of the |
| 56 // settings, a single extension, a group of extensions or default settings. | 58 // settings, a single extension, a group of extensions or default settings. |
| 57 // Note that in case of parsing errors, |this| will NOT be left untouched. | 59 // Note that in case of parsing errors, |this| will NOT be left untouched. |
| 58 // This method is required to be called for SCOPE_DEFAULT first, then | 60 // This method is required to be called for SCOPE_DEFAULT first, then |
| 59 // for SCOPE_INDIVIDUAL and SCOPE_UPDATE_URL. | 61 // for SCOPE_INDIVIDUAL and SCOPE_UPDATE_URL. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 79 // permission which has been blacklisted, this extension will not be allowed | 81 // permission which has been blacklisted, this extension will not be allowed |
| 80 // to load. And if it contains a blocked permission as optional requirement, | 82 // to load. And if it contains a blocked permission as optional requirement, |
| 81 // it will be allowed to load (of course, with permission granted from user if | 83 // it will be allowed to load (of course, with permission granted from user if |
| 82 // necessary), but conflicting permissions will be dropped. This setting will | 84 // necessary), but conflicting permissions will be dropped. This setting will |
| 83 // merge from the default settings, and unspecified settings will take value | 85 // merge from the default settings, and unspecified settings will take value |
| 84 // from default settings. | 86 // from default settings. |
| 85 // In case this setting is specified in both per-extensions and per-update-url | 87 // In case this setting is specified in both per-extensions and per-update-url |
| 86 // settings, both settings will be enforced. | 88 // settings, both settings will be enforced. |
| 87 APIPermissionSet blocked_permissions; | 89 APIPermissionSet blocked_permissions; |
| 88 | 90 |
| 91 // Minimum version required for an extensions, applies to per-extension |
| 92 // settings only. Extension (with specified extension ID) with version older |
| 93 // than the specified minimum version will be disabled. |
| 94 scoped_ptr<base::Version> minimum_version; |
| 95 |
| 89 private: | 96 private: |
| 90 DISALLOW_ASSIGN(IndividualSettings); | 97 DISALLOW_COPY_AND_ASSIGN(IndividualSettings); |
| 91 }; | 98 }; |
| 92 | 99 |
| 93 // Global extension management settings, applicable to all extensions. | 100 // Global extension management settings, applicable to all extensions. |
| 94 struct GlobalSettings { | 101 struct GlobalSettings { |
| 95 GlobalSettings(); | 102 GlobalSettings(); |
| 96 ~GlobalSettings(); | 103 ~GlobalSettings(); |
| 97 | 104 |
| 98 void Reset(); | 105 void Reset(); |
| 99 | 106 |
| 100 // Settings specifying which URLs are allowed to install extensions, will be | 107 // Settings specifying which URLs are allowed to install extensions, will be |
| 101 // enforced only if |has_restricted_install_sources| is set to true. | 108 // enforced only if |has_restricted_install_sources| is set to true. |
| 102 URLPatternSet install_sources; | 109 URLPatternSet install_sources; |
| 103 bool has_restricted_install_sources; | 110 bool has_restricted_install_sources; |
| 104 | 111 |
| 105 // Settings specifying all allowed app/extension types, will be enforced | 112 // Settings specifying all allowed app/extension types, will be enforced |
| 106 // only of |has_restricted_allowed_types| is set to true. | 113 // only of |has_restricted_allowed_types| is set to true. |
| 107 std::vector<Manifest::Type> allowed_types; | 114 std::vector<Manifest::Type> allowed_types; |
| 108 bool has_restricted_allowed_types; | 115 bool has_restricted_allowed_types; |
| 109 | 116 |
| 110 private: | 117 private: |
| 111 DISALLOW_COPY_AND_ASSIGN(GlobalSettings); | 118 DISALLOW_COPY_AND_ASSIGN(GlobalSettings); |
| 112 }; | 119 }; |
| 113 | 120 |
| 114 } // namespace internal | 121 } // namespace internal |
| 115 | 122 |
| 116 } // namespace extensions | 123 } // namespace extensions |
| 117 | 124 |
| 118 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_INTERNAL_H_ | 125 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_INTERNAL_H_ |
| OLD | NEW |