| 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_FEATURE_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_FEATURE_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_FEATURE_H_ | 6 #define CHROME_COMMON_EXTENSIONS_FEATURE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/common/extensions/extension.h" | 14 #include "chrome/common/extensions/extension.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 // Represents a single feature accessible to an extension developer, such as a | 18 // Represents a single feature accessible to an extension developer, such as a |
| 19 // top-level manifest key, a permission, or a programmatic API. A feature can | 19 // top-level manifest key, a permission, or a programmatic API. A feature can |
| 20 // express requirements for where it can be accessed, and supports testing | 20 // express requirements for where it can be accessed, and supports testing |
| 21 // support for those requirements. | 21 // support for those requirements. |
| 22 class Feature { | 22 class Feature { |
| 23 public: | 23 public: |
| 24 // The JavaScript contexts the feature is supported in. | 24 // The JavaScript contexts the feature is supported in. |
| 25 // TODO(kalman): s/PRIVILEGED/BLESSED_EXTENSION/ |
| 25 enum Context { | 26 enum Context { |
| 26 UNSPECIFIED_CONTEXT, | 27 UNSPECIFIED_CONTEXT, |
| 27 PRIVILEGED_CONTEXT, // A context in a privileged extension process. | 28 |
| 28 UNPRIVILEGED_CONTEXT, // A context in a normal, unprivileged renderer. | 29 // A context in a privileged extension process. |
| 29 CONTENT_SCRIPT_CONTEXT // A context from a content script. | 30 PRIVILEGED_CONTEXT, |
| 31 |
| 32 // A context in a normal, unprivileged renderer. |
| 33 UNPRIVILEGED_CONTEXT, |
| 34 |
| 35 // A context from a content script. |
| 36 CONTENT_SCRIPT_CONTEXT, |
| 37 |
| 38 // A normal web page. This should have an associated URL matching pattern. |
| 39 WEB_PAGE_CONTEXT, |
| 30 }; | 40 }; |
| 31 | 41 |
| 32 // The location required of extensions the feature is supported in. | 42 // The location required of extensions the feature is supported in. |
| 33 enum Location { | 43 enum Location { |
| 34 UNSPECIFIED_LOCATION, | 44 UNSPECIFIED_LOCATION, |
| 35 COMPONENT_LOCATION | 45 COMPONENT_LOCATION |
| 36 }; | 46 }; |
| 37 | 47 |
| 38 // The platforms the feature is supported in. | 48 // The platforms the feature is supported in. |
| 39 enum Platform { | 49 enum Platform { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 Platform platform_; // we only care about chromeos/not-chromeos now | 144 Platform platform_; // we only care about chromeos/not-chromeos now |
| 135 int min_manifest_version_; | 145 int min_manifest_version_; |
| 136 int max_manifest_version_; | 146 int max_manifest_version_; |
| 137 | 147 |
| 138 DISALLOW_COPY_AND_ASSIGN(Feature); | 148 DISALLOW_COPY_AND_ASSIGN(Feature); |
| 139 }; | 149 }; |
| 140 | 150 |
| 141 } // namespace extensions | 151 } // namespace extensions |
| 142 | 152 |
| 143 #endif // CHROME_COMMON_EXTENSIONS_FEATURE_H_ | 153 #endif // CHROME_COMMON_EXTENSIONS_FEATURE_H_ |
| OLD | NEW |