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 EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ | 5 #ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ |
6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ | 6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 22 matching lines...) Expand all Loading... |
33 // This class lives on the UI thread. | 33 // This class lives on the UI thread. |
34 class RulesRegistryService : public BrowserContextKeyedAPI, | 34 class RulesRegistryService : public BrowserContextKeyedAPI, |
35 public ExtensionRegistryObserver { | 35 public ExtensionRegistryObserver { |
36 public: | 36 public: |
37 static const int kDefaultRulesRegistryID; | 37 static const int kDefaultRulesRegistryID; |
38 static const int kInvalidRulesRegistryID; | 38 static const int kInvalidRulesRegistryID; |
39 | 39 |
40 struct RulesRegistryKey { | 40 struct RulesRegistryKey { |
41 std::string event_name; | 41 std::string event_name; |
42 int rules_registry_id; | 42 int rules_registry_id; |
43 RulesRegistryKey(const std::string event_name, int rules_registry_id) | 43 RulesRegistryKey(const std::string& event_name, int rules_registry_id) |
44 : event_name(event_name), | 44 : event_name(event_name), rules_registry_id(rules_registry_id) {} |
45 rules_registry_id(rules_registry_id) {} | |
46 bool operator<(const RulesRegistryKey& other) const { | 45 bool operator<(const RulesRegistryKey& other) const { |
47 return (event_name < other.event_name) || | 46 return (event_name < other.event_name) || |
48 ((event_name == other.event_name) && | 47 ((event_name == other.event_name) && |
49 (rules_registry_id < other.rules_registry_id)); | 48 (rules_registry_id < other.rules_registry_id)); |
50 } | 49 } |
51 }; | 50 }; |
52 | 51 |
53 explicit RulesRegistryService(content::BrowserContext* context); | 52 explicit RulesRegistryService(content::BrowserContext* context); |
54 ~RulesRegistryService() override; | 53 ~RulesRegistryService() override; |
55 | 54 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 extension_registry_observer_; | 144 extension_registry_observer_; |
146 | 145 |
147 content::BrowserContext* browser_context_; | 146 content::BrowserContext* browser_context_; |
148 | 147 |
149 DISALLOW_COPY_AND_ASSIGN(RulesRegistryService); | 148 DISALLOW_COPY_AND_ASSIGN(RulesRegistryService); |
150 }; | 149 }; |
151 | 150 |
152 } // namespace extensions | 151 } // namespace extensions |
153 | 152 |
154 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ | 153 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ |
OLD | NEW |