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 #include "components/content_settings/core/browser/content_settings_utils.h" | 5 #include "components/content_settings/core/browser/content_settings_utils.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 std::string ContentSettingToString(ContentSetting setting) { | 78 std::string ContentSettingToString(ContentSetting setting) { |
79 switch (setting) { | 79 switch (setting) { |
80 case CONTENT_SETTING_ALLOW: | 80 case CONTENT_SETTING_ALLOW: |
81 return "allow"; | 81 return "allow"; |
82 case CONTENT_SETTING_ASK: | 82 case CONTENT_SETTING_ASK: |
83 return "ask"; | 83 return "ask"; |
84 case CONTENT_SETTING_BLOCK: | 84 case CONTENT_SETTING_BLOCK: |
85 return "block"; | 85 return "block"; |
86 case CONTENT_SETTING_SESSION_ONLY: | 86 case CONTENT_SETTING_SESSION_ONLY: |
87 return "session"; | 87 return "session"; |
| 88 case CONTENT_SETTING_DETECT_IMPORTANT_CONTENT: |
| 89 return "detect"; |
88 case CONTENT_SETTING_DEFAULT: | 90 case CONTENT_SETTING_DEFAULT: |
89 return "default"; | 91 return "default"; |
90 case CONTENT_SETTING_NUM_SETTINGS: | 92 case CONTENT_SETTING_NUM_SETTINGS: |
91 NOTREACHED(); | 93 NOTREACHED(); |
92 } | 94 } |
93 | 95 |
94 return std::string(); | 96 return std::string(); |
95 } | 97 } |
96 | 98 |
97 ContentSetting ContentSettingFromString(const std::string& name) { | 99 ContentSetting ContentSettingFromString(const std::string& name) { |
98 if (name == "allow") | 100 if (name == "allow") |
99 return CONTENT_SETTING_ALLOW; | 101 return CONTENT_SETTING_ALLOW; |
100 if (name == "ask") | 102 if (name == "ask") |
101 return CONTENT_SETTING_ASK; | 103 return CONTENT_SETTING_ASK; |
102 if (name == "block") | 104 if (name == "block") |
103 return CONTENT_SETTING_BLOCK; | 105 return CONTENT_SETTING_BLOCK; |
104 if (name == "session") | 106 if (name == "session") |
105 return CONTENT_SETTING_SESSION_ONLY; | 107 return CONTENT_SETTING_SESSION_ONLY; |
| 108 if (name == "detect") |
| 109 return CONTENT_SETTING_DETECT_IMPORTANT_CONTENT; |
106 | 110 |
107 NOTREACHED() << name << " is not a recognized content setting."; | 111 NOTREACHED() << name << " is not a recognized content setting."; |
108 return CONTENT_SETTING_DEFAULT; | 112 return CONTENT_SETTING_DEFAULT; |
109 } | 113 } |
110 | 114 |
111 std::string CreatePatternString( | 115 std::string CreatePatternString( |
112 const ContentSettingsPattern& item_pattern, | 116 const ContentSettingsPattern& item_pattern, |
113 const ContentSettingsPattern& top_level_frame_pattern) { | 117 const ContentSettingsPattern& top_level_frame_pattern) { |
114 return item_pattern.ToString() | 118 return item_pattern.ToString() |
115 + std::string(kPatternSeparator) | 119 + std::string(kPatternSeparator) |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 222 |
219 void GetRendererContentSettingRules(const HostContentSettingsMap* map, | 223 void GetRendererContentSettingRules(const HostContentSettingsMap* map, |
220 RendererContentSettingRules* rules) { | 224 RendererContentSettingRules* rules) { |
221 map->GetSettingsForOneType( | 225 map->GetSettingsForOneType( |
222 CONTENT_SETTINGS_TYPE_IMAGES, std::string(), &(rules->image_rules)); | 226 CONTENT_SETTINGS_TYPE_IMAGES, std::string(), &(rules->image_rules)); |
223 map->GetSettingsForOneType( | 227 map->GetSettingsForOneType( |
224 CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(), &(rules->script_rules)); | 228 CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(), &(rules->script_rules)); |
225 } | 229 } |
226 | 230 |
227 } // namespace content_settings | 231 } // namespace content_settings |
OLD | NEW |