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

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_api_helpers.cc

Issue 22885002: c/b/extensions, json_schema_compiler: Do not use Value::Create*. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Removed C-style casts. Created 7 years, 4 months 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
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/extensions/api/web_request/web_request_api_helpers.h" 5 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 const EventResponseDelta* delta, 217 const EventResponseDelta* delta,
218 net::NetLog::LogLevel log_level) { 218 net::NetLog::LogLevel log_level) {
219 base::DictionaryValue* dict = new base::DictionaryValue(); 219 base::DictionaryValue* dict = new base::DictionaryValue();
220 dict->SetString("extension_id", delta->extension_id); 220 dict->SetString("extension_id", delta->extension_id);
221 221
222 base::ListValue* modified_headers = new base::ListValue(); 222 base::ListValue* modified_headers = new base::ListValue();
223 net::HttpRequestHeaders::Iterator modification( 223 net::HttpRequestHeaders::Iterator modification(
224 delta->modified_request_headers); 224 delta->modified_request_headers);
225 while (modification.GetNext()) { 225 while (modification.GetNext()) {
226 std::string line = modification.name() + ": " + modification.value(); 226 std::string line = modification.name() + ": " + modification.value();
227 modified_headers->Append(Value::CreateStringValue(line)); 227 modified_headers->Append(new base::StringValue(line));
228 } 228 }
229 dict->Set("modified_headers", modified_headers); 229 dict->Set("modified_headers", modified_headers);
230 230
231 base::ListValue* deleted_headers = new base::ListValue(); 231 base::ListValue* deleted_headers = new base::ListValue();
232 for (std::vector<std::string>::const_iterator key = 232 for (std::vector<std::string>::const_iterator key =
233 delta->deleted_request_headers.begin(); 233 delta->deleted_request_headers.begin();
234 key != delta->deleted_request_headers.end(); 234 key != delta->deleted_request_headers.end();
235 ++key) { 235 ++key) {
236 deleted_headers->Append(Value::CreateStringValue(*key)); 236 deleted_headers->Append(new base::StringValue(*key));
237 } 237 }
238 dict->Set("deleted_headers", deleted_headers); 238 dict->Set("deleted_headers", deleted_headers);
239 return dict; 239 return dict;
240 } 240 }
241 241
242 bool InDecreasingExtensionInstallationTimeOrder( 242 bool InDecreasingExtensionInstallationTimeOrder(
243 const linked_ptr<EventResponseDelta>& a, 243 const linked_ptr<EventResponseDelta>& a,
244 const linked_ptr<EventResponseDelta>& b) { 244 const linked_ptr<EventResponseDelta>& b) {
245 return a->extension_install_time > b->extension_install_time; 245 return a->extension_install_time > b->extension_install_time;
246 } 246 }
247 247
248 base::ListValue* StringToCharList(const std::string& s) { 248 base::ListValue* StringToCharList(const std::string& s) {
249 base::ListValue* result = new base::ListValue; 249 base::ListValue* result = new base::ListValue;
250 for (size_t i = 0, n = s.size(); i < n; ++i) { 250 for (size_t i = 0, n = s.size(); i < n; ++i) {
251 result->Append( 251 result->Append(
252 Value::CreateIntegerValue( 252 new base::FundamentalValue(
253 *reinterpret_cast<const unsigned char*>(&s[i]))); 253 *reinterpret_cast<const unsigned char*>(&s[i])));
254 } 254 }
255 return result; 255 return result;
256 } 256 }
257 257
258 bool CharListToString(const base::ListValue* list, std::string* out) { 258 bool CharListToString(const base::ListValue* list, std::string* out) {
259 if (!list) 259 if (!list)
260 return false; 260 return false;
261 const size_t list_length = list->GetSize(); 261 const size_t list_length = list->GetSize();
262 out->resize(list_length); 262 out->resize(list_length);
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 for (content::RenderProcessHost::iterator it = 1272 for (content::RenderProcessHost::iterator it =
1273 content::RenderProcessHost::AllHostsIterator(); 1273 content::RenderProcessHost::AllHostsIterator();
1274 !it.IsAtEnd(); it.Advance()) { 1274 !it.IsAtEnd(); it.Advance()) {
1275 content::RenderProcessHost* host = it.GetCurrentValue(); 1275 content::RenderProcessHost* host = it.GetCurrentValue();
1276 if (host->GetBrowserContext() == browser_context) 1276 if (host->GetBrowserContext() == browser_context)
1277 SendExtensionWebRequestStatusToHost(host); 1277 SendExtensionWebRequestStatusToHost(host);
1278 } 1278 }
1279 } 1279 }
1280 1280
1281 } // namespace extension_web_request_api_helpers 1281 } // namespace extension_web_request_api_helpers
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698