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

Side by Side Diff: extensions/common/extension_set.cc

Issue 2236443003: extensions: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't add braces Created 4 years, 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/common/extension_set.h" 5 #include "extensions/common/extension_set.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "extensions/common/constants.h" 10 #include "extensions/common/constants.h"
(...skipping 26 matching lines...) Expand all
37 37
38 bool ExtensionSet::is_empty() const { 38 bool ExtensionSet::is_empty() const {
39 return extensions_.empty(); 39 return extensions_.empty();
40 } 40 }
41 41
42 bool ExtensionSet::Contains(const std::string& extension_id) const { 42 bool ExtensionSet::Contains(const std::string& extension_id) const {
43 return extensions_.find(extension_id) != extensions_.end(); 43 return extensions_.find(extension_id) != extensions_.end();
44 } 44 }
45 45
46 bool ExtensionSet::Insert(const scoped_refptr<const Extension>& extension) { 46 bool ExtensionSet::Insert(const scoped_refptr<const Extension>& extension) {
47 bool was_present = ContainsKey(extensions_, extension->id()); 47 bool was_present = base::ContainsKey(extensions_, extension->id());
48 extensions_[extension->id()] = extension; 48 extensions_[extension->id()] = extension;
49 if (!was_present && !modification_callback_.is_null()) 49 if (!was_present && !modification_callback_.is_null())
50 modification_callback_.Run(GetIDs()); 50 modification_callback_.Run(GetIDs());
51 return !was_present; 51 return !was_present;
52 } 52 }
53 53
54 bool ExtensionSet::InsertAll(const ExtensionSet& extensions) { 54 bool ExtensionSet::InsertAll(const ExtensionSet& extensions) {
55 size_t before = size(); 55 size_t before = size();
56 for (ExtensionSet::const_iterator iter = extensions.begin(); 56 for (ExtensionSet::const_iterator iter = extensions.begin();
57 iter != extensions.end(); ++iter) { 57 iter != extensions.end(); ++iter) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 it != extensions_.end(); ++it) { 146 it != extensions_.end(); ++it) {
147 if (it->second->location() == Manifest::COMPONENT && 147 if (it->second->location() == Manifest::COMPONENT &&
148 it->second->web_extent().MatchesURL(url)) 148 it->second->web_extent().MatchesURL(url))
149 return true; 149 return true;
150 } 150 }
151 151
152 return false; 152 return false;
153 } 153 }
154 154
155 } // namespace extensions 155 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/quota_service_unittest.cc ('k') | extensions/common/features/base_feature_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698