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

Side by Side Diff: chrome/common/render_messages.cc

Issue 3043037: Adds IDBKeyPath parser / extractor, and provides a mechanism to call it sandboxed. (Closed)
Patch Set: Makes MSVC happy. Created 10 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
« no previous file with comments | « chrome/common/render_messages.h ('k') | chrome/common/render_messages_internal.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/common/render_messages.h" 5 #include "chrome/common/render_messages.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/common/edit_command.h" 8 #include "chrome/common/edit_command.h"
9 #include "chrome/common/extensions/extension_extent.h" 9 #include "chrome/common/extensions/extension_extent.h"
10 #include "chrome/common/extensions/url_pattern.h" 10 #include "chrome/common/extensions/url_pattern.h"
11 #include "chrome/common/indexed_db_key.h" 11 #include "chrome/common/indexed_db_param_traits.h"
12 #include "chrome/common/serialized_script_value.h"
13 #include "chrome/common/thumbnail_score.h" 12 #include "chrome/common/thumbnail_score.h"
14 #include "gfx/rect.h" 13 #include "gfx/rect.h"
15 #include "ipc/ipc_channel_handle.h" 14 #include "ipc/ipc_channel_handle.h"
16 #include "net/http/http_response_headers.h" 15 #include "net/http/http_response_headers.h"
17 #include "third_party/skia/include/core/SkBitmap.h" 16 #include "third_party/skia/include/core/SkBitmap.h"
18 #include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h" 17 #include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h"
19 #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" 18 #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h"
20 #include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerAction.h" 19 #include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerAction.h"
21 #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" 20 #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h"
22 #include "webkit/appcache/appcache_interfaces.h" 21 #include "webkit/appcache/appcache_interfaces.h"
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 if (has_object) 369 if (has_object)
371 *r = new net::HttpResponseHeaders(*m, iter); 370 *r = new net::HttpResponseHeaders(*m, iter);
372 return true; 371 return true;
373 } 372 }
374 373
375 void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Log( 374 void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Log(
376 const param_type& p, std::wstring* l) { 375 const param_type& p, std::wstring* l) {
377 l->append(L"<HttpResponseHeaders>"); 376 l->append(L"<HttpResponseHeaders>");
378 } 377 }
379 378
380 void ParamTraits<SerializedScriptValue>::Write(Message* m, const param_type& p) {
381 WriteParam(m, p.is_null());
382 WriteParam(m, p.is_invalid());
383 WriteParam(m, p.data());
384 }
385
386 bool ParamTraits<SerializedScriptValue>::Read(const Message* m, void** iter,
387 param_type* r) {
388 bool is_null;
389 bool is_invalid;
390 string16 data;
391 bool ok =
392 ReadParam(m, iter, &is_null) &&
393 ReadParam(m, iter, &is_invalid) &&
394 ReadParam(m, iter, &data);
395 if (!ok)
396 return false;
397 r->set_is_null(is_null);
398 r->set_is_invalid(is_invalid);
399 r->set_data(data);
400 return true;
401 }
402
403 void ParamTraits<SerializedScriptValue>::Log(const param_type& p,
404 std::wstring* l) {
405 l->append(L"<SerializedScriptValue>(");
406 LogParam(p.is_null(), l);
407 l->append(L", ");
408 LogParam(p.is_invalid(), l);
409 l->append(L", ");
410 LogParam(p.data(), l);
411 l->append(L")");
412 }
413
414 void ParamTraits<IndexedDBKey>::Write(Message* m, const param_type& p) {
415 WriteParam(m, int(p.type()));
416 // TODO(jorlow): Technically, we only need to pack the type being used.
417 WriteParam(m, p.string());
418 WriteParam(m, p.number());
419 }
420
421 bool ParamTraits<IndexedDBKey>::Read(const Message* m, void** iter,
422 param_type* r) {
423 int type;
424 string16 string;
425 int32 number;
426 bool ok =
427 ReadParam(m, iter, &type) &&
428 ReadParam(m, iter, &string) &&
429 ReadParam(m, iter, &number);
430 if (!ok)
431 return false;
432 switch (type) {
433 case WebKit::WebIDBKey::NullType:
434 r->SetNull();
435 return true;
436 case WebKit::WebIDBKey::StringType:
437 r->Set(string);
438 return true;
439 case WebKit::WebIDBKey::NumberType:
440 r->Set(number);
441 return true;
442 case WebKit::WebIDBKey::InvalidType:
443 r->SetInvalid();
444 return true;
445 }
446 NOTREACHED();
447 return false;
448 }
449
450 void ParamTraits<IndexedDBKey>::Log(const param_type& p, std::wstring* l) {
451 l->append(L"<IndexedDBKey>(");
452 LogParam(int(p.type()), l);
453 l->append(L", ");
454 LogParam(p.string(), l);
455 l->append(L", ");
456 LogParam(p.number(), l);
457 l->append(L")");
458 }
459
460 void ParamTraits<webkit_glue::FormData>::Write(Message* m, 379 void ParamTraits<webkit_glue::FormData>::Write(Message* m,
461 const param_type& p) { 380 const param_type& p) {
462 WriteParam(m, p.name); 381 WriteParam(m, p.name);
463 WriteParam(m, p.method); 382 WriteParam(m, p.method);
464 WriteParam(m, p.origin); 383 WriteParam(m, p.origin);
465 WriteParam(m, p.action); 384 WriteParam(m, p.action);
466 WriteParam(m, p.user_submitted); 385 WriteParam(m, p.user_submitted);
467 WriteParam(m, p.fields); 386 WriteParam(m, p.fields);
468 } 387 }
469 388
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 l->append(L", "); 833 l->append(L", ");
915 LogParam(p.location, l); 834 LogParam(p.location, l);
916 l->append(L", "); 835 l->append(L", ");
917 LogParam(p.attributes, l); 836 LogParam(p.attributes, l);
918 l->append(L", "); 837 l->append(L", ");
919 LogParam(p.children, l); 838 LogParam(p.children, l);
920 l->append(L")"); 839 l->append(L")");
921 } 840 }
922 841
923 } // namespace IPC 842 } // namespace IPC
OLDNEW
« no previous file with comments | « chrome/common/render_messages.h ('k') | chrome/common/render_messages_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698