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

Unified Diff: components/content_settings/core/browser/content_settings_utils.h

Issue 1318083005: Remove HostContentSettingsMap::ContentTypeHasCompoundValue function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-num-types-enum-3
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: components/content_settings/core/browser/content_settings_utils.h
diff --git a/components/content_settings/core/browser/content_settings_utils.h b/components/content_settings/core/browser/content_settings_utils.h
index 37d590e03b319eaf76885acc037385e4a91d1b66..2efa0ed4f9e8184afc12678dc10abad414dd400c 100644
--- a/components/content_settings/core/browser/content_settings_utils.h
+++ b/components/content_settings/core/browser/content_settings_utils.h
@@ -28,6 +28,27 @@ class RuleIterator;
typedef std::pair<ContentSettingsPattern, ContentSettingsPattern> PatternPair;
+// Helper class to iterate over only the values in a map.
+template <typename IteratorType, typename ReferenceType>
+class MapValueIterator {
+ public:
+ explicit MapValueIterator(IteratorType iterator) : iterator_(iterator) {}
+
+ bool operator!=(const MapValueIterator& other) const {
+ return iterator_ != other.iterator_;
+ }
+
+ MapValueIterator& operator++() {
+ ++iterator_;
+ return *this;
+ }
+
+ ReferenceType operator*() { return iterator_->second; }
+
+ private:
+ IteratorType iterator_;
+};
+
// These constants are copied from extensions/common/extension_constants.h and
// content/public/common/url_constants.h to avoid complicated dependencies.
// TODO(vabr): Get these constants through the ContentSettingsClient.

Powered by Google App Engine
This is Rietveld 408576698