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

Side by Side Diff: chrome/browser/ui/webui/options/content_settings_handler.cc

Issue 11415226: webui/options: Do not use Value::CreateStringValue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 map->GetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, NULL); 1058 map->GetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, NULL);
1059 // TODO(bauerb): Remove this once the Google Talk plug-in works nicely with 1059 // TODO(bauerb): Remove this once the Google Talk plug-in works nicely with
1060 // click-to-play (b/6090625). 1060 // click-to-play (b/6090625).
1061 if (old_setting == CONTENT_SETTING_ALLOW && 1061 if (old_setting == CONTENT_SETTING_ALLOW &&
1062 default_setting == CONTENT_SETTING_ASK) { 1062 default_setting == CONTENT_SETTING_ASK) {
1063 map->SetWebsiteSetting( 1063 map->SetWebsiteSetting(
1064 ContentSettingsPattern::Wildcard(), 1064 ContentSettingsPattern::Wildcard(),
1065 ContentSettingsPattern::Wildcard(), 1065 ContentSettingsPattern::Wildcard(),
1066 CONTENT_SETTINGS_TYPE_PLUGINS, 1066 CONTENT_SETTINGS_TYPE_PLUGINS,
1067 "google-talk", 1067 "google-talk",
1068 Value::CreateIntegerValue(CONTENT_SETTING_ALLOW)); 1068 new base::FundamentalValue(CONTENT_SETTING_ALLOW));
1069 } 1069 }
1070 prefs->SetInteger(prefs::kContentSettingsDefaultWhitelistVersion, 1070 prefs->SetInteger(prefs::kContentSettingsDefaultWhitelistVersion,
1071 kDefaultWhitelistVersion); 1071 kDefaultWhitelistVersion);
1072 } 1072 }
1073 1073
1074 void ContentSettingsHandler::SetContentFilter(const ListValue* args) { 1074 void ContentSettingsHandler::SetContentFilter(const ListValue* args) {
1075 DCHECK_EQ(2U, args->GetSize()); 1075 DCHECK_EQ(2U, args->GetSize());
1076 std::string group, setting; 1076 std::string group, setting;
1077 if (!(args->GetString(0, &group) && 1077 if (!(args->GetString(0, &group) &&
1078 args->GetString(1, &setting))) { 1078 args->GetString(1, &setting))) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/clear_browser_data_handler.cc ('k') | chrome/browser/ui/webui/options/cookies_view_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698