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 "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
12 #include "third_party/skia/include/core/SkBitmap.h" | 12 #include "third_party/skia/include/core/SkBitmap.h" |
| 13 #include "ui/base/range/range.h" |
13 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
14 #include "webkit/glue/password_form.h" | 15 #include "webkit/glue/password_form.h" |
15 #include "webkit/glue/resource_loader_bridge.h" | 16 #include "webkit/glue/resource_loader_bridge.h" |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
19 struct SkBitmap_Data { | 20 struct SkBitmap_Data { |
20 // The configuration for the bitmap (bits per pixel, etc). | 21 // The configuration for the bitmap (bits per pixel, etc). |
21 SkBitmap::Config fConfig; | 22 SkBitmap::Config fConfig; |
22 | 23 |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 r->set_width(w); | 605 r->set_width(w); |
605 r->set_height(h); | 606 r->set_height(h); |
606 return true; | 607 return true; |
607 } | 608 } |
608 | 609 |
609 void ParamTraits<gfx::Rect>::Log(const gfx::Rect& p, std::string* l) { | 610 void ParamTraits<gfx::Rect>::Log(const gfx::Rect& p, std::string* l) { |
610 l->append(base::StringPrintf("(%d, %d, %d, %d)", p.x(), p.y(), | 611 l->append(base::StringPrintf("(%d, %d, %d, %d)", p.x(), p.y(), |
611 p.width(), p.height())); | 612 p.width(), p.height())); |
612 } | 613 } |
613 | 614 |
| 615 void ParamTraits<ui::Range>::Write(Message* m, const ui::Range& r) { |
| 616 m->WriteSize(r.start()); |
| 617 m->WriteSize(r.end()); |
| 618 } |
| 619 |
| 620 bool ParamTraits<ui::Range>::Read(const Message* m, void** iter, ui::Range* r) { |
| 621 size_t start, end; |
| 622 if (!m->ReadSize(iter, &start) || !m->ReadSize(iter, &end)) |
| 623 return false; |
| 624 r->set_start(start); |
| 625 r->set_end(end); |
| 626 return true; |
| 627 } |
| 628 |
| 629 void ParamTraits<ui::Range>::Log(const ui::Range& r, std::string* l) { |
| 630 l->append(base::StringPrintf("(%"PRIuS", %"PRIuS")", r.start(), r.end())); |
| 631 } |
| 632 |
614 // Only the webkit_blob::BlobData ParamTraits<> definition needs this | 633 // Only the webkit_blob::BlobData ParamTraits<> definition needs this |
615 // definition, so keep this in the implementation file so we can forward declare | 634 // definition, so keep this in the implementation file so we can forward declare |
616 // BlobData in the header. | 635 // BlobData in the header. |
617 template <> | 636 template <> |
618 struct ParamTraits<webkit_blob::BlobData::Item> { | 637 struct ParamTraits<webkit_blob::BlobData::Item> { |
619 typedef webkit_blob::BlobData::Item param_type; | 638 typedef webkit_blob::BlobData::Item param_type; |
620 static void Write(Message* m, const param_type& p) { | 639 static void Write(Message* m, const param_type& p) { |
621 WriteParam(m, static_cast<int>(p.type())); | 640 WriteParam(m, static_cast<int>(p.type())); |
622 if (p.type() == webkit_blob::BlobData::TYPE_DATA) { | 641 if (p.type() == webkit_blob::BlobData::TYPE_DATA) { |
623 WriteParam(m, p.data()); | 642 WriteParam(m, p.data()); |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 ReadParam(m, iter, &p->ssl_valid) && | 889 ReadParam(m, iter, &p->ssl_valid) && |
871 ReadParam(m, iter, &p->preferred) && | 890 ReadParam(m, iter, &p->preferred) && |
872 ReadParam(m, iter, &p->blacklisted_by_user); | 891 ReadParam(m, iter, &p->blacklisted_by_user); |
873 } | 892 } |
874 void ParamTraits<webkit_glue::PasswordForm>::Log(const param_type& p, | 893 void ParamTraits<webkit_glue::PasswordForm>::Log(const param_type& p, |
875 std::string* l) { | 894 std::string* l) { |
876 l->append("<PasswordForm>"); | 895 l->append("<PasswordForm>"); |
877 } | 896 } |
878 | 897 |
879 } // namespace IPC | 898 } // namespace IPC |
OLD | NEW |