OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_API_DECLARATIVE_DECLARATIVE_MANIFEST_DATA_H_ | 5 #ifndef EXTENSIONS_COMMON_API_DECLARATIVE_DECLARATIVE_MANIFEST_DATA_H_ |
6 #define EXTENSIONS_COMMON_API_DECLARATIVE_DECLARATIVE_MANIFEST_DATA_H_ | 6 #define EXTENSIONS_COMMON_API_DECLARATIVE_DECLARATIVE_MANIFEST_DATA_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "extensions/common/api/events.h" | 12 #include "extensions/common/api/events.h" |
13 #include "extensions/common/extension.h" | 13 #include "extensions/common/extension.h" |
14 #include "extensions/common/manifest_handler.h" | 14 #include "extensions/common/manifest_handler.h" |
15 | 15 |
16 namespace extensions { | 16 namespace extensions { |
17 | 17 |
18 // The parsed form of the "event_rules" manifest entry. | 18 // The parsed form of the "event_rules" manifest entry. |
19 class DeclarativeManifestData : public Extension::ManifestData { | 19 class DeclarativeManifestData : public Extension::ManifestData { |
20 public: | 20 public: |
21 typedef extensions::core_api::events::Rule Rule; | 21 typedef extensions::api::events::Rule Rule; |
22 | 22 |
23 DeclarativeManifestData(); | 23 DeclarativeManifestData(); |
24 ~DeclarativeManifestData() override; | 24 ~DeclarativeManifestData() override; |
25 | 25 |
26 // Gets the DeclarativeManifestData for |extension|, or NULL if none was | 26 // Gets the DeclarativeManifestData for |extension|, or NULL if none was |
27 // specified. | 27 // specified. |
28 static DeclarativeManifestData* Get(const Extension* extension); | 28 static DeclarativeManifestData* Get(const Extension* extension); |
29 | 29 |
30 // Tries to construct the info based on |value|, as it would have appeared in | 30 // Tries to construct the info based on |value|, as it would have appeared in |
31 // the manifest. Sets |error| and returns an empty scoped_ptr on failure. | 31 // the manifest. Sets |error| and returns an empty scoped_ptr on failure. |
32 static scoped_ptr<DeclarativeManifestData> FromValue(const base::Value& value, | 32 static scoped_ptr<DeclarativeManifestData> FromValue(const base::Value& value, |
33 base::string16* error); | 33 base::string16* error); |
34 | 34 |
35 std::vector<linked_ptr<DeclarativeManifestData::Rule>>& RulesForEvent( | 35 std::vector<linked_ptr<DeclarativeManifestData::Rule>>& RulesForEvent( |
36 const std::string& event); | 36 const std::string& event); |
37 | 37 |
38 private: | 38 private: |
39 std::map<std::string, std::vector<linked_ptr<Rule>>> event_rules_map_; | 39 std::map<std::string, std::vector<linked_ptr<Rule>>> event_rules_map_; |
40 DISALLOW_COPY_AND_ASSIGN(DeclarativeManifestData); | 40 DISALLOW_COPY_AND_ASSIGN(DeclarativeManifestData); |
41 }; | 41 }; |
42 | 42 |
43 } // namespace extensions | 43 } // namespace extensions |
44 | 44 |
45 #endif // EXTENSIONS_COMMON_API_DECLARATIVE_DECLARATIVE_MANIFEST_DATA_H_ | 45 #endif // EXTENSIONS_COMMON_API_DECLARATIVE_DECLARATIVE_MANIFEST_DATA_H_ |
OLD | NEW |