| 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 COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_UTILS_H_ | 5 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_UTILS_H_ |
| 6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_UTILS_H_ | 6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_UTILS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class GURL; | 21 class GURL; |
| 22 class HostContentSettingsMap; | 22 class HostContentSettingsMap; |
| 23 | 23 |
| 24 namespace content_settings { | 24 namespace content_settings { |
| 25 | 25 |
| 26 class ProviderInterface; | 26 class ProviderInterface; |
| 27 class RuleIterator; | 27 class RuleIterator; |
| 28 | 28 |
| 29 typedef std::pair<ContentSettingsPattern, ContentSettingsPattern> PatternPair; | 29 typedef std::pair<ContentSettingsPattern, ContentSettingsPattern> PatternPair; |
| 30 | 30 |
| 31 // Helper class to iterate over only the values in a map. |
| 32 template <typename IteratorType, typename ReferenceType> |
| 33 class MapValueIterator { |
| 34 public: |
| 35 explicit MapValueIterator(IteratorType iterator) : iterator_(iterator) {} |
| 36 |
| 37 bool operator!=(const MapValueIterator& other) const { |
| 38 return iterator_ != other.iterator_; |
| 39 } |
| 40 |
| 41 MapValueIterator& operator++() { |
| 42 ++iterator_; |
| 43 return *this; |
| 44 } |
| 45 |
| 46 ReferenceType operator*() { return iterator_->second; } |
| 47 |
| 48 private: |
| 49 IteratorType iterator_; |
| 50 }; |
| 51 |
| 31 // These constants are copied from extensions/common/extension_constants.h and | 52 // These constants are copied from extensions/common/extension_constants.h and |
| 32 // content/public/common/url_constants.h to avoid complicated dependencies. | 53 // content/public/common/url_constants.h to avoid complicated dependencies. |
| 33 // TODO(vabr): Get these constants through the ContentSettingsClient. | 54 // TODO(vabr): Get these constants through the ContentSettingsClient. |
| 34 const char kChromeDevToolsScheme[] = "chrome-devtools"; | 55 const char kChromeDevToolsScheme[] = "chrome-devtools"; |
| 35 const char kChromeUIScheme[] = "chrome"; | 56 const char kChromeUIScheme[] = "chrome"; |
| 36 | 57 |
| 37 #if defined(ENABLE_EXTENSIONS) | 58 #if defined(ENABLE_EXTENSIONS) |
| 38 const char kExtensionScheme[] = "chrome-extension"; | 59 const char kExtensionScheme[] = "chrome-extension"; |
| 39 #endif | 60 #endif |
| 40 | 61 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 ContentSettingsPattern* secondary_pattern); | 101 ContentSettingsPattern* secondary_pattern); |
| 81 | 102 |
| 82 // Populates |rules| with content setting rules for content types that are | 103 // Populates |rules| with content setting rules for content types that are |
| 83 // handled by the renderer. | 104 // handled by the renderer. |
| 84 void GetRendererContentSettingRules(const HostContentSettingsMap* map, | 105 void GetRendererContentSettingRules(const HostContentSettingsMap* map, |
| 85 RendererContentSettingRules* rules); | 106 RendererContentSettingRules* rules); |
| 86 | 107 |
| 87 } // namespace content_settings | 108 } // namespace content_settings |
| 88 | 109 |
| 89 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_UTILS_H_ | 110 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_UTILS_H_ |
| OLD | NEW |