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_BROWSER_EXTENSIONS_API_DECLARATIVE_INITIALIZING_RULES_REGISTRY_H_
_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_INITIALIZING_RULES_REGISTRY_H_
_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_INITIALIZING_RULES_REGISTRY_H_
_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_INITIALIZING_RULES_REGISTRY_H_
_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/extensions/api/declarative/rules_registry.h" | 9 #include "chrome/browser/extensions/api/declarative/rules_registry.h" |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 std::vector<base::DictionaryValue*>* out) OVERRIDE; | 41 std::vector<base::DictionaryValue*>* out) OVERRIDE; |
42 virtual void OnExtensionUnloaded(const std::string& extension_id) OVERRIDE; | 42 virtual void OnExtensionUnloaded(const std::string& extension_id) OVERRIDE; |
43 | 43 |
44 private: | 44 private: |
45 // Returns whether any existing rule is registered with identifier |rule_id| | 45 // Returns whether any existing rule is registered with identifier |rule_id| |
46 // for extension |extension_id|. | 46 // for extension |extension_id|. |
47 bool IsUniqueId(const std::string& extension_id, | 47 bool IsUniqueId(const std::string& extension_id, |
48 const std::string& rule_id) const; | 48 const std::string& rule_id) const; |
49 | 49 |
50 // Creates an ID that is unique within the scope of|extension_id|. | 50 // Creates an ID that is unique within the scope of|extension_id|. |
51 std::string GenerateUniqueId(std::string extension_id); | 51 std::string GenerateUniqueId(const std::string& extension_id); |
52 | 52 |
53 // Verifies that all |rules| have unique IDs or initializes them with | 53 // Verifies that all |rules| have unique IDs or initializes them with |
54 // unique IDs if they don't have one. In case of duplicate IDs, this function | 54 // unique IDs if they don't have one. In case of duplicate IDs, this function |
55 // returns a non-empty error message. | 55 // returns a non-empty error message. |
56 std::string CheckAndFillInOptionalRules( | 56 std::string CheckAndFillInOptionalRules( |
57 const std::string& extension_id, | 57 const std::string& extension_id, |
58 const std::vector<base::DictionaryValue*>& rules); | 58 const std::vector<base::DictionaryValue*>& rules); |
59 | 59 |
60 // Initializes the priority fields in case they have not been set. | 60 // Initializes the priority fields in case they have not been set. |
61 void FillInOptionalPriorities( | 61 void FillInOptionalPriorities( |
(...skipping 10 matching lines...) Expand all Loading... |
72 scoped_ptr<RulesRegistry> delegate_; | 72 scoped_ptr<RulesRegistry> delegate_; |
73 | 73 |
74 typedef std::map<std::string, std::set<std::string> > RuleIdentifiersMap; | 74 typedef std::map<std::string, std::set<std::string> > RuleIdentifiersMap; |
75 RuleIdentifiersMap used_rule_identifiers_; | 75 RuleIdentifiersMap used_rule_identifiers_; |
76 int last_generated_rule_identifier_id_; | 76 int last_generated_rule_identifier_id_; |
77 }; | 77 }; |
78 | 78 |
79 } // namespace extensions | 79 } // namespace extensions |
80 | 80 |
81 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_INITIALIZING_RULES_REGISTRY
_H__ | 81 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_INITIALIZING_RULES_REGISTRY
_H__ |
OLD | NEW |