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_H__ | 5 #ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_H__ |
6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_H__ | 6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_H__ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 #include <set> | 12 #include <set> |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/callback_forward.h" | 16 #include "base/callback_forward.h" |
17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/memory/linked_ptr.h" | 19 #include "base/memory/linked_ptr.h" |
20 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
22 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
23 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
24 #include "extensions/common/api/events.h" | 24 #include "extensions/common/api/events.h" |
| 25 #include "extensions/common/extension_id.h" |
25 #include "extensions/common/one_shot_event.h" | 26 #include "extensions/common/one_shot_event.h" |
26 | 27 |
27 namespace content { | 28 namespace content { |
28 class BrowserContext; | 29 class BrowserContext; |
29 } | 30 } |
30 | 31 |
31 namespace base { | 32 namespace base { |
32 class Value; | 33 class Value; |
33 } // namespace base | 34 } // namespace base |
34 | 35 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 virtual std::string RemoveRulesImpl( | 150 virtual std::string RemoveRulesImpl( |
150 const std::string& extension_id, | 151 const std::string& extension_id, |
151 const std::vector<std::string>& rule_identifiers) = 0; | 152 const std::vector<std::string>& rule_identifiers) = 0; |
152 virtual std::string RemoveAllRulesImpl( | 153 virtual std::string RemoveAllRulesImpl( |
153 const std::string& extension_id) = 0; | 154 const std::string& extension_id) = 0; |
154 | 155 |
155 private: | 156 private: |
156 friend class base::RefCountedThreadSafe<RulesRegistry>; | 157 friend class base::RefCountedThreadSafe<RulesRegistry>; |
157 friend class RulesCacheDelegate; | 158 friend class RulesCacheDelegate; |
158 | 159 |
159 typedef std::string ExtensionId; | |
160 typedef std::string RuleId; | 160 typedef std::string RuleId; |
161 typedef std::pair<ExtensionId, RuleId> RulesDictionaryKey; | 161 typedef std::pair<ExtensionId, RuleId> RulesDictionaryKey; |
162 typedef std::map<RulesDictionaryKey, linked_ptr<api::events::Rule>> | 162 typedef std::map<RulesDictionaryKey, linked_ptr<api::events::Rule>> |
163 RulesDictionary; | 163 RulesDictionary; |
164 enum ProcessChangedRulesState { | 164 enum ProcessChangedRulesState { |
165 // ProcessChangedRules can never be called, |cache_delegate_| is NULL. | 165 // ProcessChangedRules can never be called, |cache_delegate_| is NULL. |
166 NEVER_PROCESS, | 166 NEVER_PROCESS, |
167 // A task to call ProcessChangedRules is scheduled for future execution. | 167 // A task to call ProcessChangedRules is scheduled for future execution. |
168 SCHEDULED_FOR_PROCESSING, | 168 SCHEDULED_FOR_PROCESSING, |
169 // No task to call ProcessChangedRules is scheduled yet, but it is possible | 169 // No task to call ProcessChangedRules is scheduled yet, but it is possible |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 base::WeakPtr<RulesCacheDelegate> cache_delegate_; | 295 base::WeakPtr<RulesCacheDelegate> cache_delegate_; |
296 | 296 |
297 base::WeakPtrFactory<RulesRegistry> weak_ptr_factory_; | 297 base::WeakPtrFactory<RulesRegistry> weak_ptr_factory_; |
298 | 298 |
299 DISALLOW_COPY_AND_ASSIGN(RulesRegistry); | 299 DISALLOW_COPY_AND_ASSIGN(RulesRegistry); |
300 }; | 300 }; |
301 | 301 |
302 } // namespace extensions | 302 } // namespace extensions |
303 | 303 |
304 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_H__ | 304 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_H__ |
OLD | NEW |