OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/common/common_param_traits.h" | 5 #include "content/common/common_param_traits.h" |
6 | 6 |
7 #include "content/common/content_constants.h" | 7 #include "content/common/content_constants.h" |
8 #include "net/base/host_port_pair.h" | 8 #include "net/base/host_port_pair.h" |
9 #include "net/base/upload_data.h" | 9 #include "net/base/upload_data.h" |
10 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
| 11 #include "ui/gfx/rect.h" |
11 #include "webkit/glue/resource_loader_bridge.h" | 12 #include "webkit/glue/resource_loader_bridge.h" |
12 | 13 |
13 namespace IPC { | 14 namespace IPC { |
14 | 15 |
15 void ParamTraits<GURL>::Write(Message* m, const GURL& p) { | 16 void ParamTraits<GURL>::Write(Message* m, const GURL& p) { |
16 m->WriteString(p.possibly_invalid_spec()); | 17 m->WriteString(p.possibly_invalid_spec()); |
17 // TODO(brettw) bug 684583: Add encoding for query params. | 18 // TODO(brettw) bug 684583: Add encoding for query params. |
18 } | 19 } |
19 | 20 |
20 bool ParamTraits<GURL>::Read(const Message* m, void** iter, GURL* p) { | 21 bool ParamTraits<GURL>::Read(const Message* m, void** iter, GURL* p) { |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 LogParam(p.is_directory, l); | 464 LogParam(p.is_directory, l); |
464 l->append(","); | 465 l->append(","); |
465 LogParam(p.last_modified.ToDoubleT(), l); | 466 LogParam(p.last_modified.ToDoubleT(), l); |
466 l->append(","); | 467 l->append(","); |
467 LogParam(p.last_accessed.ToDoubleT(), l); | 468 LogParam(p.last_accessed.ToDoubleT(), l); |
468 l->append(","); | 469 l->append(","); |
469 LogParam(p.creation_time.ToDoubleT(), l); | 470 LogParam(p.creation_time.ToDoubleT(), l); |
470 l->append(")"); | 471 l->append(")"); |
471 } | 472 } |
472 | 473 |
| 474 void ParamTraits<gfx::Point>::Write(Message* m, const gfx::Point& p) { |
| 475 m->WriteInt(p.x()); |
| 476 m->WriteInt(p.y()); |
| 477 } |
| 478 |
| 479 bool ParamTraits<gfx::Point>::Read(const Message* m, void** iter, |
| 480 gfx::Point* r) { |
| 481 int x, y; |
| 482 if (!m->ReadInt(iter, &x) || |
| 483 !m->ReadInt(iter, &y)) |
| 484 return false; |
| 485 r->set_x(x); |
| 486 r->set_y(y); |
| 487 return true; |
| 488 } |
| 489 |
| 490 void ParamTraits<gfx::Point>::Log(const gfx::Point& p, std::string* l) { |
| 491 l->append(base::StringPrintf("(%d, %d)", p.x(), p.y())); |
| 492 } |
| 493 |
| 494 void ParamTraits<gfx::Size>::Write(Message* m, const gfx::Size& p) { |
| 495 m->WriteInt(p.width()); |
| 496 m->WriteInt(p.height()); |
| 497 } |
| 498 |
| 499 bool ParamTraits<gfx::Size>::Read(const Message* m, void** iter, gfx::Size* r) { |
| 500 int w, h; |
| 501 if (!m->ReadInt(iter, &w) || |
| 502 !m->ReadInt(iter, &h)) |
| 503 return false; |
| 504 r->set_width(w); |
| 505 r->set_height(h); |
| 506 return true; |
| 507 } |
| 508 |
| 509 void ParamTraits<gfx::Size>::Log(const gfx::Size& p, std::string* l) { |
| 510 l->append(base::StringPrintf("(%d, %d)", p.width(), p.height())); |
| 511 } |
| 512 |
| 513 void ParamTraits<gfx::Rect>::Write(Message* m, const gfx::Rect& p) { |
| 514 m->WriteInt(p.x()); |
| 515 m->WriteInt(p.y()); |
| 516 m->WriteInt(p.width()); |
| 517 m->WriteInt(p.height()); |
| 518 } |
| 519 |
| 520 bool ParamTraits<gfx::Rect>::Read(const Message* m, void** iter, gfx::Rect* r) { |
| 521 int x, y, w, h; |
| 522 if (!m->ReadInt(iter, &x) || |
| 523 !m->ReadInt(iter, &y) || |
| 524 !m->ReadInt(iter, &w) || |
| 525 !m->ReadInt(iter, &h)) |
| 526 return false; |
| 527 r->set_x(x); |
| 528 r->set_y(y); |
| 529 r->set_width(w); |
| 530 r->set_height(h); |
| 531 return true; |
| 532 } |
| 533 |
| 534 void ParamTraits<gfx::Rect>::Log(const gfx::Rect& p, std::string* l) { |
| 535 l->append(base::StringPrintf("(%d, %d, %d, %d)", p.x(), p.y(), |
| 536 p.width(), p.height())); |
| 537 } |
| 538 |
473 } // namespace IPC | 539 } // namespace IPC |
OLD | NEW |