diff options
author | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-06 00:18:55 +0000 |
---|---|---|
committer | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-06 00:18:55 +0000 |
commit | 12340436549231cd58aaa5af504c3bf8d0c3e904 (patch) | |
tree | 015e5232da9fd266a6410bf91b45a6378d431ddf /chrome/common/extensions/extension_set.h | |
parent | 5ffbf69700a16a7a1c2086cb931589975b370e76 (diff) | |
download | chromium_src-12340436549231cd58aaa5af504c3bf8d0c3e904.zip chromium_src-12340436549231cd58aaa5af504c3bf8d0c3e904.tar.gz chromium_src-12340436549231cd58aaa5af504c3bf8d0c3e904.tar.bz2 |
Revert 113047 - Make ExtensionService use ExtensionSet.
It broke ExtensionManagementApiBrowserTest.LaunchApp.
Make ExtensionSet iterate like a set instead of a map.
BUG=104091
TEST=existing tests
Review URL: http://codereview.chromium.org/8733004
TBR=yoz@chromium.org
Review URL: http://codereview.chromium.org/8789018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113071 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/extension_set.h')
-rw-r--r-- | chrome/common/extensions/extension_set.h | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/chrome/common/extensions/extension_set.h b/chrome/common/extensions/extension_set.h index 3407557..5ca0344 100644 --- a/chrome/common/extensions/extension_set.h +++ b/chrome/common/extensions/extension_set.h @@ -6,9 +6,9 @@ #define CHROME_COMMON_EXTENSIONS_EXTENSION_SET_H_ #pragma once -#include <iterator> #include <map> #include <string> +#include <vector> #include "base/gtest_prod_util.h" #include "base/memory/ref_counted.h" @@ -44,39 +44,17 @@ class ExtensionSet { public: typedef std::pair<FilePath, std::string> ExtensionPathAndDefaultLocale; typedef std::map<std::string, scoped_refptr<const Extension> > ExtensionMap; - - // Iteration over the values of the map (given that it's an ExtensionSet, - // it should iterate like a set iterator). - class const_iterator : - public std::iterator<std::input_iterator_tag, - scoped_refptr<const Extension> > { - public: - const_iterator() {} - explicit const_iterator(ExtensionMap::const_iterator it) : - it_(it) {} - const_iterator& operator++() { - ++it_; - return *this; - } - const scoped_refptr<const Extension> operator*() { - return it_->second; - } - bool operator!=(const const_iterator& other) { return it_ != other.it_; } - bool operator==(const const_iterator& other) { return it_ == other.it_; } - - private: - ExtensionMap::const_iterator it_; - }; + typedef ExtensionMap::const_iterator const_iterator; ExtensionSet(); ~ExtensionSet(); + // Gets the number of extensions contained. size_t size() const; - bool is_empty() const; // Iteration support. - const_iterator begin() const { return const_iterator(extensions_.begin()); } - const_iterator end() const { return const_iterator(extensions_.end()); } + const_iterator begin() const { return extensions_.begin(); } + const_iterator end() const { return extensions_.end(); } // Returns true if the set contains the specified extension. bool Contains(const std::string& id) const; @@ -88,12 +66,9 @@ class ExtensionSet { // Removes the specified extension. void Remove(const std::string& id); - // Removes all extensions. - void Clear(); - // Returns the extension ID, or empty if none. This includes web URLs that // are part of an extension's web extent. - std::string GetIDByURL(const ExtensionURLInfo& info) const; + std::string GetIdByURL(const ExtensionURLInfo& info) const; // Returns the Extension, or NULL if none. This includes web URLs that are // part of an extension's web extent. |