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 CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_H__ |
6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_H__ |
7 | 7 |
8 #include "chrome/browser/extensions/api/declarative/rules_registry.h" | 8 #include "chrome/browser/extensions/api/declarative/rules_registry.h" |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 // the UI thread) is created, a pointer to it is passed to |*ui_part|. | 58 // the UI thread) is created, a pointer to it is passed to |*ui_part|. |
59 // In tests, |profile| and |ui_part| can be NULL (at the same time). In that | 59 // In tests, |profile| and |ui_part| can be NULL (at the same time). In that |
60 // case the storage functionality disabled (no RulesCacheDelegate object | 60 // case the storage functionality disabled (no RulesCacheDelegate object |
61 // created). | 61 // created). |
62 RulesRegistry(Profile* profile, | 62 RulesRegistry(Profile* profile, |
63 const std::string& event_name, | 63 const std::string& event_name, |
64 content::BrowserThread::ID owner_thread, | 64 content::BrowserThread::ID owner_thread, |
65 RulesCacheDelegate* cache_delegate, | 65 RulesCacheDelegate* cache_delegate, |
66 const WebViewKey& webview_key); | 66 const WebViewKey& webview_key); |
67 | 67 |
68 const OneShotEvent& ready() const { | 68 // If |ready()| returns NULL, the registry does not wait for the |
69 return ready_; | 69 // |cache_delegate_| to initialize and can be considered ready. |
70 const OneShotEvent* ready() const { | |
71 return (cache_delegate_) ? &ready_ : NULL; | |
Fady Samuel
2013/12/12 17:54:39
What about making ready_ a scoped_ptr<OneShotEvent
vabr (Chromium)
2013/12/13 16:03:33
Done.
| |
70 } | 72 } |
71 | 73 |
72 // RulesRegistry implementation: | 74 // RulesRegistry implementation: |
73 | 75 |
74 // Registers |rules|, owned by |extension_id| to this RulesRegistry. | 76 // Registers |rules|, owned by |extension_id| to this RulesRegistry. |
75 // If a concrete RuleRegistry does not support some of the rules, | 77 // If a concrete RuleRegistry does not support some of the rules, |
76 // it may ignore them. | 78 // it may ignore them. |
77 // | 79 // |
78 // |rules| is a list of Rule instances following the definition of the | 80 // |rules| is a list of Rule instances following the definition of the |
79 // declarative extension APIs. It is guaranteed that each rule in |rules| has | 81 // declarative extension APIs. It is guaranteed that each rule in |rules| has |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 typedef std::map<ExtensionId, std::set<RuleIdentifier> > RuleIdentifiersMap; | 283 typedef std::map<ExtensionId, std::set<RuleIdentifier> > RuleIdentifiersMap; |
282 RuleIdentifiersMap used_rule_identifiers_; | 284 RuleIdentifiersMap used_rule_identifiers_; |
283 int last_generated_rule_identifier_id_; | 285 int last_generated_rule_identifier_id_; |
284 | 286 |
285 DISALLOW_COPY_AND_ASSIGN(RulesRegistry); | 287 DISALLOW_COPY_AND_ASSIGN(RulesRegistry); |
286 }; | 288 }; |
287 | 289 |
288 } // namespace extensions | 290 } // namespace extensions |
289 | 291 |
290 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_H__ | 292 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_H__ |
OLD | NEW |