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 "chrome/browser/ui/webui/options/content_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options/content_settings_handler.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1239 ExContentSettingsType type = ExContentSettingsTypeFromGroupName(type_string); | 1239 ExContentSettingsType type = ExContentSettingsTypeFromGroupName(type_string); |
1240 bool is_valid = false; | 1240 bool is_valid = false; |
1241 if (type == EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC) { | 1241 if (type == EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC) { |
1242 is_valid = IsValidHost(pattern_string); | 1242 is_valid = IsValidHost(pattern_string); |
1243 } else { | 1243 } else { |
1244 ContentSettingsPattern pattern = | 1244 ContentSettingsPattern pattern = |
1245 ContentSettingsPattern::FromString(pattern_string); | 1245 ContentSettingsPattern::FromString(pattern_string); |
1246 is_valid = pattern.IsValid(); | 1246 is_valid = pattern.IsValid(); |
1247 } | 1247 } |
1248 | 1248 |
1249 scoped_ptr<Value> type_value(Value::CreateStringValue(type_string)); | |
1250 scoped_ptr<Value> mode_value(Value::CreateStringValue(mode_string)); | |
1251 scoped_ptr<Value> pattern_value(Value::CreateStringValue(pattern_string)); | |
1252 scoped_ptr<Value> valid_value(Value::CreateBooleanValue(is_valid)); | |
1253 | |
1254 web_ui()->CallJavascriptFunction( | 1249 web_ui()->CallJavascriptFunction( |
1255 "ContentSettings.patternValidityCheckComplete", | 1250 "ContentSettings.patternValidityCheckComplete", |
1256 *type_value.get(), | 1251 base::StringValue(type_string), |
1257 *mode_value.get(), | 1252 base::StringValue(mode_string), |
1258 *pattern_value.get(), | 1253 base::StringValue(pattern_string), |
1259 *valid_value.get()); | 1254 base::FundamentalValue(is_valid)); |
1260 } | 1255 } |
1261 | 1256 |
1262 // static | 1257 // static |
1263 std::string ContentSettingsHandler::ContentSettingsTypeToGroupName( | 1258 std::string ContentSettingsHandler::ContentSettingsTypeToGroupName( |
1264 ContentSettingsType type) { | 1259 ContentSettingsType type) { |
1265 return ExContentSettingsTypeToGroupName(ExContentSettingsType(type)); | 1260 return ExContentSettingsTypeToGroupName(ExContentSettingsType(type)); |
1266 } | 1261 } |
1267 | 1262 |
1268 HostContentSettingsMap* ContentSettingsHandler::GetContentSettingsMap() { | 1263 HostContentSettingsMap* ContentSettingsHandler::GetContentSettingsMap() { |
1269 return Profile::FromWebUI(web_ui())->GetHostContentSettingsMap(); | 1264 return Profile::FromWebUI(web_ui())->GetHostContentSettingsMap(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) { | 1307 for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) { |
1313 if (type == kExContentSettingsTypeGroupNames[i].type) | 1308 if (type == kExContentSettingsTypeGroupNames[i].type) |
1314 return kExContentSettingsTypeGroupNames[i].name; | 1309 return kExContentSettingsTypeGroupNames[i].name; |
1315 } | 1310 } |
1316 | 1311 |
1317 NOTREACHED(); | 1312 NOTREACHED(); |
1318 return std::string(); | 1313 return std::string(); |
1319 } | 1314 } |
1320 | 1315 |
1321 } // namespace options | 1316 } // namespace options |
OLD | NEW |