OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/ipc_message_utils.h" | 5 #include "chrome/common/ipc_message_utils.h" |
6 | 6 |
7 #include "base/gfx/rect.h" | 7 #include "base/gfx/rect.h" |
8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
| 9 #ifndef EXCLUDE_SKIA_DEPENDENCIES |
9 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| 11 #endif |
10 #include "webkit/glue/dom_operations.h" | 12 #include "webkit/glue/dom_operations.h" |
11 | 13 |
12 namespace IPC { | 14 namespace IPC { |
13 | 15 |
| 16 #ifndef EXCLUDE_SKIA_DEPENDENCIES |
| 17 |
14 namespace { | 18 namespace { |
15 | 19 |
16 struct SkBitmap_Data { | 20 struct SkBitmap_Data { |
17 // The configuration for the bitmap (bits per pixel, etc). | 21 // The configuration for the bitmap (bits per pixel, etc). |
18 SkBitmap::Config fConfig; | 22 SkBitmap::Config fConfig; |
19 | 23 |
20 // The width of the bitmap in pixels. | 24 // The width of the bitmap in pixels. |
21 uint32 fWidth; | 25 uint32 fWidth; |
22 | 26 |
23 // The height of the bitmap in pixels. | 27 // The height of the bitmap in pixels. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 87 } |
84 const SkBitmap_Data* bmp_data = | 88 const SkBitmap_Data* bmp_data = |
85 reinterpret_cast<const SkBitmap_Data*>(fixed_data); | 89 reinterpret_cast<const SkBitmap_Data*>(fixed_data); |
86 return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size); | 90 return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size); |
87 } | 91 } |
88 | 92 |
89 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::wstring* l) { | 93 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::wstring* l) { |
90 l->append(StringPrintf(L"<SkBitmap>")); | 94 l->append(StringPrintf(L"<SkBitmap>")); |
91 } | 95 } |
92 | 96 |
| 97 #endif // EXCLUDE_SKIA_DEPENDENCIES |
93 | 98 |
94 void ParamTraits<GURL>::Write(Message* m, const GURL& p) { | 99 void ParamTraits<GURL>::Write(Message* m, const GURL& p) { |
95 m->WriteString(p.possibly_invalid_spec()); | 100 m->WriteString(p.possibly_invalid_spec()); |
96 // TODO(brettw) bug 684583: Add encoding for query params. | 101 // TODO(brettw) bug 684583: Add encoding for query params. |
97 } | 102 } |
98 | 103 |
99 bool ParamTraits<GURL>::Read(const Message* m, void** iter, GURL* p) { | 104 bool ParamTraits<GURL>::Read(const Message* m, void** iter, GURL* p) { |
100 std::string s; | 105 std::string s; |
101 if (!m->ReadString(iter, &s)) { | 106 if (!m->ReadString(iter, &s)) { |
102 *p = GURL(); | 107 *p = GURL(); |
103 return false; | 108 return false; |
104 } | 109 } |
105 *p = GURL(s); | 110 *p = GURL(s); |
106 return true; | 111 return true; |
107 } | 112 } |
108 | 113 |
109 void ParamTraits<GURL>::Log(const GURL& p, std::wstring* l) { | 114 void ParamTraits<GURL>::Log(const GURL& p, std::wstring* l) { |
110 l->append(UTF8ToWide(p.spec())); | 115 l->append(UTF8ToWide(p.spec())); |
111 } | 116 } |
112 | 117 |
113 | |
114 void ParamTraits<gfx::Point>::Write(Message* m, const gfx::Point& p) { | 118 void ParamTraits<gfx::Point>::Write(Message* m, const gfx::Point& p) { |
115 m->WriteInt(p.x()); | 119 m->WriteInt(p.x()); |
116 m->WriteInt(p.y()); | 120 m->WriteInt(p.y()); |
117 } | 121 } |
118 | 122 |
119 bool ParamTraits<gfx::Point>::Read(const Message* m, void** iter, | 123 bool ParamTraits<gfx::Point>::Read(const Message* m, void** iter, |
120 gfx::Point* r) { | 124 gfx::Point* r) { |
121 int x, y; | 125 int x, y; |
122 if (!m->ReadInt(iter, &x) || | 126 if (!m->ReadInt(iter, &x) || |
123 !m->ReadInt(iter, &y)) | 127 !m->ReadInt(iter, &y)) |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 215 } |
212 return result; | 216 return result; |
213 } | 217 } |
214 | 218 |
215 void ParamTraits<webkit_glue::WebApplicationInfo>::Log( | 219 void ParamTraits<webkit_glue::WebApplicationInfo>::Log( |
216 const webkit_glue::WebApplicationInfo& p, std::wstring* l) { | 220 const webkit_glue::WebApplicationInfo& p, std::wstring* l) { |
217 l->append(L"<WebApplicationInfo>"); | 221 l->append(L"<WebApplicationInfo>"); |
218 } | 222 } |
219 | 223 |
220 } // namespace IPC | 224 } // namespace IPC |
OLD | NEW |