| 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/extensions/api/content_settings/content_settings_api.h" | 5 #include "chrome/browser/extensions/api/content_settings/content_settings_api.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 setting_cookie, NULL); | 156 setting_cookie, NULL); |
| 157 } else { | 157 } else { |
| 158 setting = map->GetContentSetting(primary_url, secondary_url, content_type, | 158 setting = map->GetContentSetting(primary_url, secondary_url, content_type, |
| 159 resource_identifier); | 159 resource_identifier); |
| 160 } | 160 } |
| 161 | 161 |
| 162 DictionaryValue* result = new DictionaryValue(); | 162 DictionaryValue* result = new DictionaryValue(); |
| 163 result->SetString(keys::kContentSettingKey, | 163 result->SetString(keys::kContentSettingKey, |
| 164 helpers::ContentSettingToString(setting)); | 164 helpers::ContentSettingToString(setting)); |
| 165 | 165 |
| 166 result_.reset(result); | 166 SetResult(result); |
| 167 | 167 |
| 168 return true; | 168 return true; |
| 169 } | 169 } |
| 170 | 170 |
| 171 bool SetContentSettingFunction::RunImpl() { | 171 bool SetContentSettingFunction::RunImpl() { |
| 172 ContentSettingsType content_type; | 172 ContentSettingsType content_type; |
| 173 EXTENSION_FUNCTION_VALIDATE(RemoveContentType(args_.get(), &content_type)); | 173 EXTENSION_FUNCTION_VALIDATE(RemoveContentType(args_.get(), &content_type)); |
| 174 | 174 |
| 175 scoped_ptr<Set::Params> params(Set::Params::Create(*args_)); | 175 scoped_ptr<Set::Params> params(Set::Params::Create(*args_)); |
| 176 EXTENSION_FUNCTION_VALIDATE(params.get()); | 176 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 const std::vector<webkit::npapi::PluginGroup>& groups) { | 276 const std::vector<webkit::npapi::PluginGroup>& groups) { |
| 277 ListValue* list = new ListValue(); | 277 ListValue* list = new ListValue(); |
| 278 for (std::vector<webkit::npapi::PluginGroup>::const_iterator it = | 278 for (std::vector<webkit::npapi::PluginGroup>::const_iterator it = |
| 279 groups.begin(); | 279 groups.begin(); |
| 280 it != groups.end(); ++it) { | 280 it != groups.end(); ++it) { |
| 281 DictionaryValue* dict = new DictionaryValue(); | 281 DictionaryValue* dict = new DictionaryValue(); |
| 282 dict->SetString(keys::kIdKey, it->identifier()); | 282 dict->SetString(keys::kIdKey, it->identifier()); |
| 283 dict->SetString(keys::kDescriptionKey, it->GetGroupName()); | 283 dict->SetString(keys::kDescriptionKey, it->GetGroupName()); |
| 284 list->Append(dict); | 284 list->Append(dict); |
| 285 } | 285 } |
| 286 result_.reset(list); | 286 SetResult(list); |
| 287 BrowserThread::PostTask( | 287 BrowserThread::PostTask( |
| 288 BrowserThread::UI, FROM_HERE, base::Bind( | 288 BrowserThread::UI, FROM_HERE, base::Bind( |
| 289 &GetResourceIdentifiersFunction::SendResponse, this, true)); | 289 &GetResourceIdentifiersFunction::SendResponse, this, true)); |
| 290 } | 290 } |
| 291 | 291 |
| 292 // static | 292 // static |
| 293 void GetResourceIdentifiersFunction::SetPluginGroupsForTesting( | 293 void GetResourceIdentifiersFunction::SetPluginGroupsForTesting( |
| 294 const std::vector<webkit::npapi::PluginGroup>* plugin_groups) { | 294 const std::vector<webkit::npapi::PluginGroup>* plugin_groups) { |
| 295 g_testing_plugin_groups_ = plugin_groups; | 295 g_testing_plugin_groups_ = plugin_groups; |
| 296 } | 296 } |
| 297 | 297 |
| 298 } // namespace extensions | 298 } // namespace extensions |
| OLD | NEW |