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

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

Issue 12767006: [Cleanup] Remove StringPrintf from global namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, once more Created 7 years, 9 months 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
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 {
(...skipping 23 matching lines...) Expand all
34 const std::string& extension_id, 34 const std::string& extension_id,
35 const std::vector<linked_ptr<Rule> >& rules) { 35 const std::vector<linked_ptr<Rule> >& rules) {
36 DCHECK(content::BrowserThread::CurrentlyOn(GetOwnerThread())); 36 DCHECK(content::BrowserThread::CurrentlyOn(GetOwnerThread()));
37 37
38 // Verify that all rule IDs are new. 38 // Verify that all rule IDs are new.
39 for (std::vector<linked_ptr<Rule> >::const_iterator i = 39 for (std::vector<linked_ptr<Rule> >::const_iterator i =
40 rules.begin(); i != rules.end(); ++i) { 40 rules.begin(); i != rules.end(); ++i) {
41 const RuleId& rule_id = *((*i)->id); 41 const RuleId& rule_id = *((*i)->id);
42 RulesDictionaryKey key(extension_id, rule_id); 42 RulesDictionaryKey key(extension_id, rule_id);
43 if (rules_.find(key) != rules_.end()) 43 if (rules_.find(key) != rules_.end())
44 return StringPrintf(kDuplicateRuleId, rule_id.c_str()); 44 return base::StringPrintf(kDuplicateRuleId, rule_id.c_str());
45 } 45 }
46 46
47 std::string error = AddRulesImpl(extension_id, rules); 47 std::string error = AddRulesImpl(extension_id, rules);
48 48
49 if (!error.empty()) 49 if (!error.empty())
50 return error; 50 return error;
51 51
52 // Commit all rules into |rules_| on success. 52 // Commit all rules into |rules_| on success.
53 for (std::vector<linked_ptr<Rule> >::const_iterator i = 53 for (std::vector<linked_ptr<Rule> >::const_iterator i =
54 rules.begin(); i != rules.end(); ++i) { 54 rules.begin(); i != rules.end(); ++i) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 const std::string& extension_id) { 146 const std::string& extension_id) {
147 DCHECK(content::BrowserThread::CurrentlyOn(GetOwnerThread())); 147 DCHECK(content::BrowserThread::CurrentlyOn(GetOwnerThread()));
148 148
149 if (delegate_.get()) 149 if (delegate_.get())
150 delegate_->OnRulesChanged(this, extension_id); 150 delegate_->OnRulesChanged(this, extension_id);
151 } 151 }
152 152
153 RulesRegistryWithCache::~RulesRegistryWithCache() {} 153 RulesRegistryWithCache::~RulesRegistryWithCache() {}
154 154
155 } // namespace extensions 155 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698