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 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_ptr.h" |
12 #include "components/content_settings/core/common/content_settings.h" | 13 #include "components/content_settings/core/common/content_settings.h" |
13 #include "components/content_settings/core/common/content_settings_pattern.h" | 14 #include "components/content_settings/core/common/content_settings_pattern.h" |
14 #include "components/content_settings/core/common/content_settings_types.h" | 15 #include "components/content_settings/core/common/content_settings_types.h" |
15 | 16 |
16 namespace base { | 17 namespace base { |
17 class Value; | 18 class Value; |
18 } | 19 } |
19 | 20 |
20 class GURL; | 21 class GURL; |
21 class HostContentSettingsMap; | 22 class HostContentSettingsMap; |
(...skipping 30 matching lines...) Expand all Loading... |
52 const ContentSettingsPattern& top_level_frame_pattern); | 53 const ContentSettingsPattern& top_level_frame_pattern); |
53 | 54 |
54 // Caller takes the ownership of the returned |base::Value*|. | 55 // Caller takes the ownership of the returned |base::Value*|. |
55 base::Value* GetContentSettingValueAndPatterns( | 56 base::Value* GetContentSettingValueAndPatterns( |
56 RuleIterator* rule_iterator, | 57 RuleIterator* rule_iterator, |
57 const GURL& primary_url, | 58 const GURL& primary_url, |
58 const GURL& secondary_url, | 59 const GURL& secondary_url, |
59 ContentSettingsPattern* primary_pattern, | 60 ContentSettingsPattern* primary_pattern, |
60 ContentSettingsPattern* secondary_pattern); | 61 ContentSettingsPattern* secondary_pattern); |
61 | 62 |
| 63 // Returns a |base::Value*| representation of |setting| if |setting| is |
| 64 // a valid content setting. Otherwise, returns a nullptr. |
| 65 scoped_ptr<base::Value> ContentSettingToValue(ContentSetting setting); |
| 66 |
62 base::Value* GetContentSettingValueAndPatterns( | 67 base::Value* GetContentSettingValueAndPatterns( |
63 const ProviderInterface* provider, | 68 const ProviderInterface* provider, |
64 const GURL& primary_url, | 69 const GURL& primary_url, |
65 const GURL& secondary_url, | 70 const GURL& secondary_url, |
66 ContentSettingsType content_type, | 71 ContentSettingsType content_type, |
67 const std::string& resource_identifier, | 72 const std::string& resource_identifier, |
68 bool include_incognito, | 73 bool include_incognito, |
69 ContentSettingsPattern* primary_pattern, | 74 ContentSettingsPattern* primary_pattern, |
70 ContentSettingsPattern* secondary_pattern); | 75 ContentSettingsPattern* secondary_pattern); |
71 | 76 |
72 // Populates |rules| with content setting rules for content types that are | 77 // Populates |rules| with content setting rules for content types that are |
73 // handled by the renderer. | 78 // handled by the renderer. |
74 void GetRendererContentSettingRules(const HostContentSettingsMap* map, | 79 void GetRendererContentSettingRules(const HostContentSettingsMap* map, |
75 RendererContentSettingRules* rules); | 80 RendererContentSettingRules* rules); |
76 | 81 |
77 } // namespace content_settings | 82 } // namespace content_settings |
78 | 83 |
79 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_UTILS_H_ | 84 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_UTILS_H_ |
OLD | NEW |