| 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 "chrome/browser/extensions/api/declarative/rules_registry.h" | 5 #include "chrome/browser/extensions/api/declarative/rules_registry.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 | 68 |
| 69 namespace extensions { | 69 namespace extensions { |
| 70 | 70 |
| 71 // RulesRegistry | 71 // RulesRegistry |
| 72 | 72 |
| 73 RulesRegistry::RulesRegistry( | 73 RulesRegistry::RulesRegistry( |
| 74 Profile* profile, | 74 Profile* profile, |
| 75 const std::string& event_name, | 75 const std::string& event_name, |
| 76 content::BrowserThread::ID owner_thread, | 76 content::BrowserThread::ID owner_thread, |
| 77 RulesCacheDelegate* cache_delegate) | 77 RulesCacheDelegate* cache_delegate, |
| 78 const WebViewKey& webview_key) |
| 78 : profile_(profile), | 79 : profile_(profile), |
| 79 owner_thread_(owner_thread), | 80 owner_thread_(owner_thread), |
| 80 event_name_(event_name), | 81 event_name_(event_name), |
| 82 webview_key_(webview_key), |
| 81 weak_ptr_factory_(profile ? this : NULL), | 83 weak_ptr_factory_(profile ? this : NULL), |
| 82 process_changed_rules_requested_(profile ? NOT_SCHEDULED_FOR_PROCESSING | 84 process_changed_rules_requested_(profile ? NOT_SCHEDULED_FOR_PROCESSING |
| 83 : NEVER_PROCESS), | 85 : NEVER_PROCESS), |
| 84 last_generated_rule_identifier_id_(0) { | 86 last_generated_rule_identifier_id_(0) { |
| 85 if (cache_delegate) { | 87 if (cache_delegate) { |
| 86 cache_delegate_ = cache_delegate->GetWeakPtr(); | 88 cache_delegate_ = cache_delegate->GetWeakPtr(); |
| 87 cache_delegate->Init(this); | 89 cache_delegate->Init(this); |
| 88 } else { | 90 } else { |
| 89 content::BrowserThread::PostTask( | 91 content::BrowserThread::PostTask( |
| 90 owner_thread, | 92 owner_thread, |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 for (i = identifiers.begin(); i != identifiers.end(); ++i) | 340 for (i = identifiers.begin(); i != identifiers.end(); ++i) |
| 339 used_rule_identifiers_[extension_id].erase(*i); | 341 used_rule_identifiers_[extension_id].erase(*i); |
| 340 } | 342 } |
| 341 | 343 |
| 342 void RulesRegistry::RemoveAllUsedRuleIdentifiers( | 344 void RulesRegistry::RemoveAllUsedRuleIdentifiers( |
| 343 const std::string& extension_id) { | 345 const std::string& extension_id) { |
| 344 used_rule_identifiers_.erase(extension_id); | 346 used_rule_identifiers_.erase(extension_id); |
| 345 } | 347 } |
| 346 | 348 |
| 347 } // namespace extensions | 349 } // namespace extensions |
| OLD | NEW |