| 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 "chrome/common/common_param_traits.h" | 5 #include "chrome/common/common_param_traits.h" |
| 6 | 6 |
| 7 #include "base/time.h" | 7 #include "base/time.h" |
| 8 #include "chrome/common/chrome_constants.h" | 8 #include "chrome/common/chrome_constants.h" |
| 9 #include "chrome/common/content_settings.h" | 9 #include "chrome/common/content_settings.h" |
| 10 #include "chrome/common/geoposition.h" | 10 #include "chrome/common/geoposition.h" |
| 11 #include "chrome/common/thumbnail_score.h" | 11 #include "chrome/common/thumbnail_score.h" |
| 12 #include "chrome/common/web_apps.h" | 12 #include "chrome/common/web_apps.h" |
| 13 #include "content/common/common_param_traits.h" |
| 13 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 14 #include "net/base/host_port_pair.h" | 15 #include "net/base/host_port_pair.h" |
| 15 #include "net/base/upload_data.h" | 16 #include "net/base/upload_data.h" |
| 16 #include "printing/backend/print_backend.h" | 17 #include "printing/backend/print_backend.h" |
| 17 #include "printing/native_metafile.h" | 18 #include "printing/native_metafile.h" |
| 18 #include "printing/page_range.h" | 19 #include "printing/page_range.h" |
| 19 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
| 20 | 21 |
| 21 #ifndef EXCLUDE_SKIA_DEPENDENCIES | 22 #ifndef EXCLUDE_SKIA_DEPENDENCIES |
| 22 #include "third_party/skia/include/core/SkBitmap.h" | 23 #include "third_party/skia/include/core/SkBitmap.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 reinterpret_cast<const SkBitmap_Data*>(fixed_data); | 98 reinterpret_cast<const SkBitmap_Data*>(fixed_data); |
| 98 return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size); | 99 return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size); |
| 99 } | 100 } |
| 100 | 101 |
| 101 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) { | 102 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) { |
| 102 l->append("<SkBitmap>"); | 103 l->append("<SkBitmap>"); |
| 103 } | 104 } |
| 104 | 105 |
| 105 #endif // EXCLUDE_SKIA_DEPENDENCIES | 106 #endif // EXCLUDE_SKIA_DEPENDENCIES |
| 106 | 107 |
| 107 void ParamTraits<GURL>::Write(Message* m, const GURL& p) { | |
| 108 m->WriteString(p.possibly_invalid_spec()); | |
| 109 // TODO(brettw) bug 684583: Add encoding for query params. | |
| 110 } | |
| 111 | |
| 112 bool ParamTraits<GURL>::Read(const Message* m, void** iter, GURL* p) { | |
| 113 std::string s; | |
| 114 if (!m->ReadString(iter, &s) || s.length() > chrome::kMaxURLChars) { | |
| 115 *p = GURL(); | |
| 116 return false; | |
| 117 } | |
| 118 *p = GURL(s); | |
| 119 return true; | |
| 120 } | |
| 121 | |
| 122 void ParamTraits<GURL>::Log(const GURL& p, std::string* l) { | |
| 123 l->append(p.spec()); | |
| 124 } | |
| 125 | |
| 126 void ParamTraits<gfx::Point>::Write(Message* m, const gfx::Point& p) { | 108 void ParamTraits<gfx::Point>::Write(Message* m, const gfx::Point& p) { |
| 127 m->WriteInt(p.x()); | 109 m->WriteInt(p.x()); |
| 128 m->WriteInt(p.y()); | 110 m->WriteInt(p.y()); |
| 129 } | 111 } |
| 130 | 112 |
| 131 bool ParamTraits<gfx::Point>::Read(const Message* m, void** iter, | 113 bool ParamTraits<gfx::Point>::Read(const Message* m, void** iter, |
| 132 gfx::Point* r) { | 114 gfx::Point* r) { |
| 133 int x, y; | 115 int x, y; |
| 134 if (!m->ReadInt(iter, &x) || | 116 if (!m->ReadInt(iter, &x) || |
| 135 !m->ReadInt(iter, &y)) | 117 !m->ReadInt(iter, &y)) |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 l->append(","); | 718 l->append(","); |
| 737 LogParam(p.caps_mime_type, l); | 719 LogParam(p.caps_mime_type, l); |
| 738 l->append(","); | 720 l->append(","); |
| 739 LogParam(p.printer_defaults, l); | 721 LogParam(p.printer_defaults, l); |
| 740 l->append(","); | 722 l->append(","); |
| 741 LogParam(p.defaults_mime_type, l); | 723 LogParam(p.defaults_mime_type, l); |
| 742 l->append(")"); | 724 l->append(")"); |
| 743 } | 725 } |
| 744 | 726 |
| 745 } // namespace IPC | 727 } // namespace IPC |
| OLD | NEW |