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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 virtual void OnExtensionUnloaded(const std::string& extension_id) OVERRIDE; | 44 virtual void OnExtensionUnloaded(const std::string& extension_id) OVERRIDE; |
45 virtual content::BrowserThread::ID GetOwnerThread() const OVERRIDE; | 45 virtual content::BrowserThread::ID GetOwnerThread() const OVERRIDE; |
46 | 46 |
47 private: | 47 private: |
48 // Returns whether any existing rule is registered with identifier |rule_id| | 48 // Returns whether any existing rule is registered with identifier |rule_id| |
49 // for extension |extension_id|. | 49 // for extension |extension_id|. |
50 bool IsUniqueId(const std::string& extension_id, | 50 bool IsUniqueId(const std::string& extension_id, |
51 const std::string& rule_id) const; | 51 const std::string& rule_id) const; |
52 | 52 |
53 // Creates an ID that is unique within the scope of|extension_id|. | 53 // Creates an ID that is unique within the scope of|extension_id|. |
54 std::string GenerateUniqueId(std::string extension_id); | 54 std::string GenerateUniqueId(const std::string& extension_id); |
55 | 55 |
56 // Verifies that all |rules| have unique IDs or initializes them with | 56 // Verifies that all |rules| have unique IDs or initializes them with |
57 // unique IDs if they don't have one. In case of duplicate IDs, this function | 57 // unique IDs if they don't have one. In case of duplicate IDs, this function |
58 // returns a non-empty error message. | 58 // returns a non-empty error message. |
59 std::string CheckAndFillInOptionalRules( | 59 std::string CheckAndFillInOptionalRules( |
60 const std::string& extension_id, | 60 const std::string& extension_id, |
61 const std::vector<linked_ptr<RulesRegistry::Rule> >& rules); | 61 const std::vector<linked_ptr<RulesRegistry::Rule> >& rules); |
62 | 62 |
63 // Initializes the priority fields in case they have not been set. | 63 // Initializes the priority fields in case they have not been set. |
64 void FillInOptionalPriorities( | 64 void FillInOptionalPriorities( |
(...skipping 10 matching lines...) Expand all Loading... |
75 scoped_refptr<RulesRegistry> delegate_; | 75 scoped_refptr<RulesRegistry> delegate_; |
76 | 76 |
77 typedef std::map<std::string, std::set<std::string> > RuleIdentifiersMap; | 77 typedef std::map<std::string, std::set<std::string> > RuleIdentifiersMap; |
78 RuleIdentifiersMap used_rule_identifiers_; | 78 RuleIdentifiersMap used_rule_identifiers_; |
79 int last_generated_rule_identifier_id_; | 79 int last_generated_rule_identifier_id_; |
80 }; | 80 }; |
81 | 81 |
82 } // namespace extensions | 82 } // namespace extensions |
83 | 83 |
84 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_INITIALIZING_RULES_REGISTRY
_H__ | 84 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_INITIALIZING_RULES_REGISTRY
_H__ |
OLD | NEW |