Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: chrome/browser/extensions/api/declarative/rules_registry_with_cache.cc

Issue 11316307: Revert 170319 - Removed dead code from chrome/browser/extensions/api/declarative (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/api/declarative/rules_registry_with_cache.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_with_cache.h" 5 #include "chrome/browser/extensions/api/declarative/rules_registry_with_cache.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 9
10 namespace { 10 namespace {
11 11
12 const char kSuccess[] = ""; 12 const char kSuccess[] = "";
13 const char kDuplicateRuleId[] = "Duplicate rule ID: %s"; 13 const char kDuplicateRuleId[] = "Duplicate rule ID: %s";
14 14
15 } // namespace 15 } // namespace
16 16
17 namespace extensions { 17 namespace extensions {
18 18
19 RulesRegistryWithCache::RulesRegistryWithCache(Delegate* delegate) 19 RulesRegistryWithCache::RulesRegistryWithCache(Delegate* delegate)
20 : delegate_(delegate) { 20 : delegate_(delegate) {
21 } 21 }
22 22
23 void RulesRegistryWithCache::AddReadyCallback(const base::Closure& callback) {
24 ready_callbacks_.push_back(callback);
25 }
26
23 void RulesRegistryWithCache::OnReady() { 27 void RulesRegistryWithCache::OnReady() {
24 for (size_t i = 0; i < ready_callbacks_.size(); ++i) 28 for (size_t i = 0; i < ready_callbacks_.size(); ++i)
25 ready_callbacks_[i].Run(); 29 ready_callbacks_[i].Run();
26 ready_callbacks_.clear(); 30 ready_callbacks_.clear();
27 } 31 }
28 32
29 std::string RulesRegistryWithCache::AddRules( 33 std::string RulesRegistryWithCache::AddRules(
30 const std::string& extension_id, 34 const std::string& extension_id,
31 const std::vector<linked_ptr<Rule> >& rules) { 35 const std::vector<linked_ptr<Rule> >& rules) {
32 DCHECK(content::BrowserThread::CurrentlyOn(GetOwnerThread())); 36 DCHECK(content::BrowserThread::CurrentlyOn(GetOwnerThread()));
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 const std::string& extension_id) { 146 const std::string& extension_id) {
143 DCHECK(content::BrowserThread::CurrentlyOn(GetOwnerThread())); 147 DCHECK(content::BrowserThread::CurrentlyOn(GetOwnerThread()));
144 148
145 if (delegate_.get()) 149 if (delegate_.get())
146 delegate_->OnRulesChanged(this, extension_id); 150 delegate_->OnRulesChanged(this, extension_id);
147 } 151 }
148 152
149 RulesRegistryWithCache::~RulesRegistryWithCache() {} 153 RulesRegistryWithCache::~RulesRegistryWithCache() {}
150 154
151 } // namespace extensions 155 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/declarative/rules_registry_with_cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698