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_RULES_REGISTRY_H__ | 5 #ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_H__ |
6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_H__ | 6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_H__ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "chrome/common/extensions/api/events.h" | |
19 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
20 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
21 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
| 21 #include "extensions/common/api/events.h" |
22 #include "extensions/common/one_shot_event.h" | 22 #include "extensions/common/one_shot_event.h" |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 class BrowserContext; | 25 class BrowserContext; |
26 } | 26 } |
27 | 27 |
28 namespace base { | 28 namespace base { |
29 class Value; | 29 class Value; |
30 } // namespace base | 30 } // namespace base |
31 | 31 |
32 namespace extensions { | 32 namespace extensions { |
33 | 33 |
34 class RulesCacheDelegate; | 34 class RulesCacheDelegate; |
35 | 35 |
36 // A base class for RulesRegistries that takes care of storing the | 36 // A base class for RulesRegistries that takes care of storing the |
37 // RulesRegistry::Rule objects. It contains all the methods that need to run on | 37 // RulesRegistry::Rule objects. It contains all the methods that need to run on |
38 // the registry thread; methods that need to run on the UI thread are separated | 38 // the registry thread; methods that need to run on the UI thread are separated |
39 // in the RulesCacheDelegate object. | 39 // in the RulesCacheDelegate object. |
40 class RulesRegistry : public base::RefCountedThreadSafe<RulesRegistry> { | 40 class RulesRegistry : public base::RefCountedThreadSafe<RulesRegistry> { |
41 public: | 41 public: |
42 typedef extensions::api::events::Rule Rule; | 42 typedef extensions::core_api::events::Rule Rule; |
43 struct WebViewKey { | 43 struct WebViewKey { |
44 int embedder_process_id; | 44 int embedder_process_id; |
45 int webview_instance_id; | 45 int webview_instance_id; |
46 WebViewKey(int embedder_process_id, int webview_instance_id) | 46 WebViewKey(int embedder_process_id, int webview_instance_id) |
47 : embedder_process_id(embedder_process_id), | 47 : embedder_process_id(embedder_process_id), |
48 webview_instance_id(webview_instance_id) {} | 48 webview_instance_id(webview_instance_id) {} |
49 bool operator<(const WebViewKey& other) const { | 49 bool operator<(const WebViewKey& other) const { |
50 return embedder_process_id < other.embedder_process_id || | 50 return embedder_process_id < other.embedder_process_id || |
51 ((embedder_process_id == other.embedder_process_id) && | 51 ((embedder_process_id == other.embedder_process_id) && |
52 (webview_instance_id < other.webview_instance_id)); | 52 (webview_instance_id < other.webview_instance_id)); |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 typedef std::string RuleIdentifier; | 286 typedef std::string RuleIdentifier; |
287 typedef std::map<ExtensionId, std::set<RuleIdentifier> > RuleIdentifiersMap; | 287 typedef std::map<ExtensionId, std::set<RuleIdentifier> > RuleIdentifiersMap; |
288 RuleIdentifiersMap used_rule_identifiers_; | 288 RuleIdentifiersMap used_rule_identifiers_; |
289 int last_generated_rule_identifier_id_; | 289 int last_generated_rule_identifier_id_; |
290 | 290 |
291 DISALLOW_COPY_AND_ASSIGN(RulesRegistry); | 291 DISALLOW_COPY_AND_ASSIGN(RulesRegistry); |
292 }; | 292 }; |
293 | 293 |
294 } // namespace extensions | 294 } // namespace extensions |
295 | 295 |
296 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_H__ | 296 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_H__ |
OLD | NEW |