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 #include "extensions/browser/api/declarative/rules_registry.h" | 5 #include "extensions/browser/api/declarative/rules_registry.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 return base::StringPrintf("_%d_", identifier); | 62 return base::StringPrintf("_%d_", identifier); |
63 } | 63 } |
64 | 64 |
65 } // namespace | 65 } // namespace |
66 | 66 |
67 | 67 |
68 namespace extensions { | 68 namespace extensions { |
69 | 69 |
70 // RulesRegistry | 70 // RulesRegistry |
71 | 71 |
72 RulesRegistry::RulesRegistry(content::BrowserContext* browser_context, | 72 RulesRegistry::RulesRegistry(content::BrowserContext *browser_context, |
not at google - send to devlin
2014/11/20 15:30:30
Please don't arbitrarily change style like this. B
MRV
2014/11/21 11:12:39
@Kalman, while uploading patch using "git cl uploa
| |
73 const std::string& event_name, | 73 const std::string &event_name, |
74 content::BrowserThread::ID owner_thread, | 74 content::BrowserThread::ID owner_thread, |
75 RulesCacheDelegate* cache_delegate, | 75 RulesCacheDelegate *cache_delegate, |
76 const WebViewKey& webview_key) | 76 const WebViewKey &webview_key) |
77 : browser_context_(browser_context), | 77 : browser_context_(browser_context), owner_thread_(owner_thread), |
78 owner_thread_(owner_thread), | 78 event_name_(event_name), webview_key_(webview_key), |
79 event_name_(event_name), | 79 ready_(/*signaled=*/!cache_delegate), // Immediately ready if no cache |
80 webview_key_(webview_key), | 80 // delegate to wait for. |
81 ready_(/*signaled=*/!cache_delegate), // Immediately ready if no cache | 81 last_generated_rule_identifier_id_(0), |
82 // delegate to wait for. | 82 weak_ptr_factory_(browser_context_ ? this : NULL) { |
83 weak_ptr_factory_(browser_context_ ? this : NULL), | |
84 last_generated_rule_identifier_id_(0) { | |
85 if (cache_delegate) { | 83 if (cache_delegate) { |
86 cache_delegate_ = cache_delegate->GetWeakPtr(); | 84 cache_delegate_ = cache_delegate->GetWeakPtr(); |
87 cache_delegate->Init(this); | 85 cache_delegate->Init(this); |
88 } | 86 } |
89 } | 87 } |
90 | 88 |
91 std::string RulesRegistry::AddRulesNoFill( | 89 std::string RulesRegistry::AddRulesNoFill( |
92 const std::string& extension_id, | 90 const std::string& extension_id, |
93 const std::vector<linked_ptr<Rule> >& rules) { | 91 const std::vector<linked_ptr<Rule> >& rules) { |
94 DCHECK_CURRENTLY_ON(owner_thread()); | 92 DCHECK_CURRENTLY_ON(owner_thread()); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
368 for (i = identifiers.begin(); i != identifiers.end(); ++i) | 366 for (i = identifiers.begin(); i != identifiers.end(); ++i) |
369 used_rule_identifiers_[extension_id].erase(*i); | 367 used_rule_identifiers_[extension_id].erase(*i); |
370 } | 368 } |
371 | 369 |
372 void RulesRegistry::RemoveAllUsedRuleIdentifiers( | 370 void RulesRegistry::RemoveAllUsedRuleIdentifiers( |
373 const std::string& extension_id) { | 371 const std::string& extension_id) { |
374 used_rule_identifiers_.erase(extension_id); | 372 used_rule_identifiers_.erase(extension_id); |
375 } | 373 } |
376 | 374 |
377 } // namespace extensions | 375 } // namespace extensions |
OLD | NEW |