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 <tuple> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
15 #include "base/scoped_observer.h" | 16 #include "base/scoped_observer.h" |
16 #include "extensions/browser/api/declarative/rules_registry.h" | 17 #include "extensions/browser/api/declarative/rules_registry.h" |
17 #include "extensions/browser/browser_context_keyed_api_factory.h" | 18 #include "extensions/browser/browser_context_keyed_api_factory.h" |
18 #include "extensions/browser/extension_registry_observer.h" | 19 #include "extensions/browser/extension_registry_observer.h" |
19 | 20 |
(...skipping 16 matching lines...) Expand all Loading... |
36 public: | 37 public: |
37 static const int kDefaultRulesRegistryID; | 38 static const int kDefaultRulesRegistryID; |
38 static const int kInvalidRulesRegistryID; | 39 static const int kInvalidRulesRegistryID; |
39 | 40 |
40 struct RulesRegistryKey { | 41 struct RulesRegistryKey { |
41 std::string event_name; | 42 std::string event_name; |
42 int rules_registry_id; | 43 int rules_registry_id; |
43 RulesRegistryKey(const std::string& event_name, int rules_registry_id) | 44 RulesRegistryKey(const std::string& event_name, int rules_registry_id) |
44 : event_name(event_name), rules_registry_id(rules_registry_id) {} | 45 : event_name(event_name), rules_registry_id(rules_registry_id) {} |
45 bool operator<(const RulesRegistryKey& other) const { | 46 bool operator<(const RulesRegistryKey& other) const { |
46 return (event_name < other.event_name) || | 47 return std::tie(event_name, rules_registry_id) < |
47 ((event_name == other.event_name) && | 48 std::tie(other.event_name, other.rules_registry_id); |
48 (rules_registry_id < other.rules_registry_id)); | |
49 } | 49 } |
50 }; | 50 }; |
51 | 51 |
52 explicit RulesRegistryService(content::BrowserContext* context); | 52 explicit RulesRegistryService(content::BrowserContext* context); |
53 ~RulesRegistryService() override; | 53 ~RulesRegistryService() override; |
54 | 54 |
55 // Unregisters refptrs to concrete RulesRegistries at other objects that were | 55 // Unregisters refptrs to concrete RulesRegistries at other objects that were |
56 // created by us so that the RulesRegistries can be released. | 56 // created by us so that the RulesRegistries can be released. |
57 void Shutdown() override; | 57 void Shutdown() override; |
58 | 58 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 extension_registry_observer_; | 144 extension_registry_observer_; |
145 | 145 |
146 content::BrowserContext* browser_context_; | 146 content::BrowserContext* browser_context_; |
147 | 147 |
148 DISALLOW_COPY_AND_ASSIGN(RulesRegistryService); | 148 DISALLOW_COPY_AND_ASSIGN(RulesRegistryService); |
149 }; | 149 }; |
150 | 150 |
151 } // namespace extensions | 151 } // namespace extensions |
152 | 152 |
153 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ | 153 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ |
OLD | NEW |