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 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_SET_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_SET_H_ |
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_SET_H_ | 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_SET_H_ |
7 | 7 |
8 #include <iterator> | 8 #include <iterator> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 typedef std::pair<FilePath, std::string> ExtensionPathAndDefaultLocale; | 44 typedef std::pair<FilePath, std::string> ExtensionPathAndDefaultLocale; |
45 typedef std::map<std::string, scoped_refptr<const extensions::Extension> > | 45 typedef std::map<std::string, scoped_refptr<const extensions::Extension> > |
46 ExtensionMap; | 46 ExtensionMap; |
47 | 47 |
48 // Iteration over the values of the map (given that it's an ExtensionSet, | 48 // Iteration over the values of the map (given that it's an ExtensionSet, |
49 // it should iterate like a set iterator). | 49 // it should iterate like a set iterator). |
50 class const_iterator : | 50 class const_iterator : |
51 public std::iterator<std::input_iterator_tag, | 51 public std::iterator<std::input_iterator_tag, |
52 scoped_refptr<const extensions::Extension> > { | 52 scoped_refptr<const extensions::Extension> > { |
53 public: | 53 public: |
54 const_iterator() {} | 54 const_iterator(); |
55 explicit const_iterator(ExtensionMap::const_iterator it) : | 55 const_iterator(const const_iterator& other); |
56 it_(it) {} | 56 explicit const_iterator(ExtensionMap::const_iterator it); |
57 const_iterator& operator++() { | 57 const_iterator& operator++() { |
58 ++it_; | 58 ++it_; |
59 return *this; | 59 return *this; |
60 } | 60 } |
61 const scoped_refptr<const extensions::Extension> operator*() { | 61 const scoped_refptr<const extensions::Extension> operator*() { |
62 return it_->second; | 62 return it_->second; |
63 } | 63 } |
64 bool operator!=(const const_iterator& other) { return it_ != other.it_; } | 64 bool operator!=(const const_iterator& other) { return it_ != other.it_; } |
65 bool operator==(const const_iterator& other) { return it_ == other.it_; } | 65 bool operator==(const const_iterator& other) { return it_ == other.it_; } |
66 | 66 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 134 |
135 private: | 135 private: |
136 FRIEND_TEST_ALL_PREFIXES(ExtensionSetTest, ExtensionSet); | 136 FRIEND_TEST_ALL_PREFIXES(ExtensionSetTest, ExtensionSet); |
137 | 137 |
138 ExtensionMap extensions_; | 138 ExtensionMap extensions_; |
139 | 139 |
140 DISALLOW_COPY_AND_ASSIGN(ExtensionSet); | 140 DISALLOW_COPY_AND_ASSIGN(ExtensionSet); |
141 }; | 141 }; |
142 | 142 |
143 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_SET_H_ | 143 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_SET_H_ |
OLD | NEW |