OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_COMMON_FEATURES_FEATURE_H_ | 5 #ifndef EXTENSIONS_COMMON_FEATURES_FEATURE_H_ |
6 #define EXTENSIONS_COMMON_FEATURES_FEATURE_H_ | 6 #define EXTENSIONS_COMMON_FEATURES_FEATURE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
| 11 #include "base/strings/string_piece.h" |
11 #include "base/values.h" | 12 #include "base/values.h" |
12 #include "extensions/common/manifest.h" | 13 #include "extensions/common/manifest.h" |
13 | 14 |
14 class GURL; | 15 class GURL; |
15 | 16 |
16 namespace extensions { | 17 namespace extensions { |
17 | 18 |
18 class Extension; | 19 class Extension; |
19 | 20 |
20 // Represents a single feature accessible to an extension developer, such as a | 21 // Represents a single feature accessible to an extension developer, such as a |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 friend class Feature; | 96 friend class Feature; |
96 | 97 |
97 const AvailabilityResult result_; | 98 const AvailabilityResult result_; |
98 const std::string message_; | 99 const std::string message_; |
99 }; | 100 }; |
100 | 101 |
101 Feature(); | 102 Feature(); |
102 virtual ~Feature(); | 103 virtual ~Feature(); |
103 | 104 |
104 const std::string& name() const { return name_; } | 105 const std::string& name() const { return name_; } |
105 void set_name(const std::string& name) { name_ = name; } | 106 // Note that this arg is passed as a StringPiece to avoid a lot of bloat from |
| 107 // inlined std::string code. |
| 108 void set_name(base::StringPiece name); |
106 bool no_parent() const { return no_parent_; } | 109 bool no_parent() const { return no_parent_; } |
107 | 110 |
108 // Gets the platform the code is currently running on. | 111 // Gets the platform the code is currently running on. |
109 static Platform GetCurrentPlatform(); | 112 static Platform GetCurrentPlatform(); |
110 | 113 |
111 // Tests whether this is an internal API or not. | 114 // Tests whether this is an internal API or not. |
112 virtual bool IsInternal() const = 0; | 115 virtual bool IsInternal() const = 0; |
113 | 116 |
114 // Returns true if the feature is available to be parsed into a new extension | 117 // Returns true if the feature is available to be parsed into a new extension |
115 // manifest. | 118 // manifest. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 protected: | 163 protected: |
161 std::string name_; | 164 std::string name_; |
162 bool no_parent_; | 165 bool no_parent_; |
163 // TODO(devlin): Remove this once we set the feature channel for tests. | 166 // TODO(devlin): Remove this once we set the feature channel for tests. |
164 bool check_channel_; | 167 bool check_channel_; |
165 }; | 168 }; |
166 | 169 |
167 } // namespace extensions | 170 } // namespace extensions |
168 | 171 |
169 #endif // EXTENSIONS_COMMON_FEATURES_FEATURE_H_ | 172 #endif // EXTENSIONS_COMMON_FEATURES_FEATURE_H_ |
OLD | NEW |