| 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 #ifndef CHROME_COMMON_RENDER_MESSAGES_H_ | 5 #ifndef CHROME_COMMON_RENDER_MESSAGES_H_ |
| 6 #define CHROME_COMMON_RENDER_MESSAGES_H_ | 6 #define CHROME_COMMON_RENDER_MESSAGES_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include <map> | 10 #include <map> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/gfx/native_widget_types.h" | 13 #include "base/gfx/native_widget_types.h" |
| 14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
| 15 #include "base/shared_memory.h" | 15 #include "base/shared_memory.h" |
| 16 #include "chrome/browser/renderer_host/resource_handler.h" | 16 #include "chrome/browser/renderer_host/resource_handler.h" |
| 17 #include "chrome/common/filter_policy.h" | 17 #include "chrome/common/filter_policy.h" |
| 18 #include "chrome/common/ipc_message_utils.h" | 18 #include "chrome/common/ipc_message_utils.h" |
| 19 #include "chrome/common/modal_dialog_event.h" | 19 #include "chrome/common/modal_dialog_event.h" |
| 20 #include "chrome/common/page_transition_types.h" | 20 #include "chrome/common/page_transition_types.h" |
| 21 #include "chrome/common/transport_dib.h" | 21 #include "chrome/common/transport_dib.h" |
| 22 #include "chrome/common/webkit_param_traits.h" |
| 22 #include "googleurl/src/gurl.h" | 23 #include "googleurl/src/gurl.h" |
| 23 #include "media/audio/audio_output.h" | 24 #include "media/audio/audio_output.h" |
| 24 #include "net/base/upload_data.h" | 25 #include "net/base/upload_data.h" |
| 25 #include "net/http/http_response_headers.h" | 26 #include "net/http/http_response_headers.h" |
| 26 #include "net/url_request/url_request_status.h" | 27 #include "net/url_request/url_request_status.h" |
| 27 #include "third_party/WebKit/WebKit/chromium/public/WebCache.h" | |
| 28 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" | |
| 29 #include "third_party/WebKit/WebKit/chromium/public/WebFindInPageRequest.h" | |
| 30 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" | |
| 31 #include "webkit/glue/autofill_form.h" | 28 #include "webkit/glue/autofill_form.h" |
| 32 #include "webkit/glue/context_menu.h" | 29 #include "webkit/glue/context_menu.h" |
| 33 #include "webkit/glue/feed.h" | 30 #include "webkit/glue/feed.h" |
| 34 #include "webkit/glue/form_data.h" | 31 #include "webkit/glue/form_data.h" |
| 35 #include "webkit/glue/password_form.h" | 32 #include "webkit/glue/password_form.h" |
| 36 #include "webkit/glue/password_form_dom_manager.h" | 33 #include "webkit/glue/password_form_dom_manager.h" |
| 37 #include "webkit/glue/resource_loader_bridge.h" | 34 #include "webkit/glue/resource_loader_bridge.h" |
| 38 #include "webkit/glue/screen_info.h" | |
| 39 #include "webkit/glue/webaccessibility.h" | 35 #include "webkit/glue/webaccessibility.h" |
| 40 #include "webkit/glue/webdropdata.h" | 36 #include "webkit/glue/webdropdata.h" |
| 41 #include "webkit/glue/webplugin.h" | 37 #include "webkit/glue/webplugin.h" |
| 42 #include "webkit/glue/webpreferences.h" | 38 #include "webkit/glue/webpreferences.h" |
| 43 #include "webkit/glue/webview_delegate.h" | 39 #include "webkit/glue/webview_delegate.h" |
| 44 | 40 |
| 45 #if defined(OS_POSIX) | 41 #if defined(OS_POSIX) |
| 46 #include "skia/include/SkBitmap.h" | 42 #include "skia/include/SkBitmap.h" |
| 47 #endif | 43 #endif |
| 48 | 44 |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 // Number of bits per sample; | 361 // Number of bits per sample; |
| 366 int bits_per_sample; | 362 int bits_per_sample; |
| 367 | 363 |
| 368 // Number of bytes per packet. | 364 // Number of bytes per packet. |
| 369 size_t packet_size; | 365 size_t packet_size; |
| 370 }; | 366 }; |
| 371 | 367 |
| 372 namespace IPC { | 368 namespace IPC { |
| 373 | 369 |
| 374 template <> | 370 template <> |
| 375 struct ParamTraits<WebKit::WebString> { | |
| 376 typedef WebKit::WebString param_type; | |
| 377 static void Write(Message* m, const param_type& p) { | |
| 378 m->WriteData(reinterpret_cast<const char*>(p.data()), | |
| 379 static_cast<int>(p.length() * sizeof(WebKit::WebUChar))); | |
| 380 } | |
| 381 static bool Read(const Message* m, void** iter, param_type* p) { | |
| 382 const char* data; | |
| 383 int data_len; | |
| 384 if (!m->ReadData(iter, &data, &data_len)) | |
| 385 return false; | |
| 386 p->assign(reinterpret_cast<const WebKit::WebUChar*>(data), | |
| 387 static_cast<size_t>(data_len / sizeof(WebKit::WebUChar))); | |
| 388 return true; | |
| 389 } | |
| 390 static void Log(const param_type& p, std::wstring* l) { | |
| 391 l->append(UTF16ToWideHack(p)); | |
| 392 } | |
| 393 }; | |
| 394 | |
| 395 template <> | |
| 396 struct ParamTraits<WebKit::WebConsoleMessage::Level> { | |
| 397 typedef WebKit::WebConsoleMessage::Level param_type; | |
| 398 static void Write(Message* m, const param_type& p) { | |
| 399 WriteParam(m, static_cast<int>(p)); | |
| 400 } | |
| 401 static bool Read(const Message* m, void** iter, param_type* r) { | |
| 402 int value; | |
| 403 if (!ReadParam(m, iter, &value)) | |
| 404 return false; | |
| 405 *r = static_cast<param_type>(value); | |
| 406 return true; | |
| 407 } | |
| 408 static void Log(const param_type& p, std::wstring* l) { | |
| 409 LogParam(static_cast<int>(p), l); | |
| 410 } | |
| 411 }; | |
| 412 | |
| 413 template <> | |
| 414 struct ParamTraits<WebKit::WebConsoleMessage> { | |
| 415 typedef WebKit::WebConsoleMessage param_type; | |
| 416 static void Write(Message* m, const param_type& p) { | |
| 417 WriteParam(m, p.level); | |
| 418 WriteParam(m, p.text); | |
| 419 } | |
| 420 static bool Read(const Message* m, void** iter, param_type* r) { | |
| 421 return | |
| 422 ReadParam(m, iter, &r->level) && | |
| 423 ReadParam(m, iter, &r->text); | |
| 424 } | |
| 425 static void Log(const param_type& p, std::wstring* l) { | |
| 426 l->append(L"("); | |
| 427 LogParam(p.level, l); | |
| 428 l->append(L", "); | |
| 429 LogParam(p.text, l); | |
| 430 l->append(L")"); | |
| 431 } | |
| 432 }; | |
| 433 | |
| 434 template <> | |
| 435 struct ParamTraits<ResourceType::Type> { | 371 struct ParamTraits<ResourceType::Type> { |
| 436 typedef ResourceType::Type param_type; | 372 typedef ResourceType::Type param_type; |
| 437 static void Write(Message* m, const param_type& p) { | 373 static void Write(Message* m, const param_type& p) { |
| 438 m->WriteInt(p); | 374 m->WriteInt(p); |
| 439 } | 375 } |
| 440 static bool Read(const Message* m, void** iter, param_type* p) { | 376 static bool Read(const Message* m, void** iter, param_type* p) { |
| 441 int type; | 377 int type; |
| 442 if (!m->ReadInt(iter, &type) || !ResourceType::ValidType(type)) | 378 if (!m->ReadInt(iter, &type) || !ResourceType::ValidType(type)) |
| 443 return false; | 379 return false; |
| 444 *p = ResourceType::FromInt(type); | 380 *p = ResourceType::FromInt(type); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 event.append(L"EDITABLE|"); | 475 event.append(L"EDITABLE|"); |
| 540 if (p.type & ContextNode::MISSPELLED_WORD) | 476 if (p.type & ContextNode::MISSPELLED_WORD) |
| 541 event.append(L"MISSPELLED_WORD|"); | 477 event.append(L"MISSPELLED_WORD|"); |
| 542 event.append(L")"); | 478 event.append(L")"); |
| 543 } | 479 } |
| 544 | 480 |
| 545 LogParam(event, l); | 481 LogParam(event, l); |
| 546 } | 482 } |
| 547 }; | 483 }; |
| 548 | 484 |
| 549 template <> | |
| 550 struct ParamTraits<WebKit::WebInputEvent::Type> { | |
| 551 typedef WebKit::WebInputEvent::Type param_type; | |
| 552 static void Write(Message* m, const param_type& p) { | |
| 553 m->WriteInt(p); | |
| 554 } | |
| 555 static bool Read(const Message* m, void** iter, param_type* p) { | |
| 556 int type; | |
| 557 if (!m->ReadInt(iter, &type)) | |
| 558 return false; | |
| 559 *p = static_cast<WebKit::WebInputEvent::Type>(type); | |
| 560 return true; | |
| 561 } | |
| 562 static void Log(const param_type& p, std::wstring* l) { | |
| 563 std::wstring type; | |
| 564 switch (p) { | |
| 565 case WebKit::WebInputEvent::MouseDown: | |
| 566 type = L"MouseDown"; | |
| 567 break; | |
| 568 case WebKit::WebInputEvent::MouseUp: | |
| 569 type = L"MouseUp"; | |
| 570 break; | |
| 571 case WebKit::WebInputEvent::MouseMove: | |
| 572 type = L"MouseMove"; | |
| 573 break; | |
| 574 case WebKit::WebInputEvent::MouseLeave: | |
| 575 type = L"MouseLeave"; | |
| 576 break; | |
| 577 case WebKit::WebInputEvent::MouseDoubleClick: | |
| 578 type = L"MouseDoubleClick"; | |
| 579 break; | |
| 580 case WebKit::WebInputEvent::MouseWheel: | |
| 581 type = L"MouseWheel"; | |
| 582 break; | |
| 583 case WebKit::WebInputEvent::RawKeyDown: | |
| 584 type = L"RawKeyDown"; | |
| 585 break; | |
| 586 case WebKit::WebInputEvent::KeyDown: | |
| 587 type = L"KeyDown"; | |
| 588 break; | |
| 589 case WebKit::WebInputEvent::KeyUp: | |
| 590 type = L"KeyUp"; | |
| 591 break; | |
| 592 default: | |
| 593 type = L"None"; | |
| 594 break; | |
| 595 } | |
| 596 | |
| 597 LogParam(type, l); | |
| 598 } | |
| 599 }; | |
| 600 | |
| 601 // Traits for ViewHostMsg_UpdateFeedList_Params structure to pack/unpack. | 485 // Traits for ViewHostMsg_UpdateFeedList_Params structure to pack/unpack. |
| 602 template <> | 486 template <> |
| 603 struct ParamTraits<ViewHostMsg_UpdateFeedList_Params> { | 487 struct ParamTraits<ViewHostMsg_UpdateFeedList_Params> { |
| 604 typedef ViewHostMsg_UpdateFeedList_Params param_type; | 488 typedef ViewHostMsg_UpdateFeedList_Params param_type; |
| 605 static void Write(Message* msg, const param_type& param) { | 489 static void Write(Message* msg, const param_type& param) { |
| 606 WriteParam(msg, param.page_id); | 490 WriteParam(msg, param.page_id); |
| 607 WriteParam(msg, param.feedlist->list().size()); | 491 WriteParam(msg, param.feedlist->list().size()); |
| 608 for (std::vector<FeedItem>::const_iterator iter = | 492 for (std::vector<FeedItem>::const_iterator iter = |
| 609 param.feedlist->list().begin(); | 493 param.feedlist->list().begin(); |
| 610 iter != param.feedlist->list().end(); iter++) { | 494 iter != param.feedlist->list().end(); iter++) { |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1253 *r = new net::UploadData; | 1137 *r = new net::UploadData; |
| 1254 (*r)->swap_elements(&elements); | 1138 (*r)->swap_elements(&elements); |
| 1255 (*r)->set_identifier(identifier); | 1139 (*r)->set_identifier(identifier); |
| 1256 return true; | 1140 return true; |
| 1257 } | 1141 } |
| 1258 static void Log(const param_type& p, std::wstring* l) { | 1142 static void Log(const param_type& p, std::wstring* l) { |
| 1259 l->append(L"<net::UploadData>"); | 1143 l->append(L"<net::UploadData>"); |
| 1260 } | 1144 } |
| 1261 }; | 1145 }; |
| 1262 | 1146 |
| 1263 // Traits for WebKit::WebCache::UsageStats | |
| 1264 template <> | |
| 1265 struct ParamTraits<WebKit::WebCache::UsageStats> { | |
| 1266 typedef WebKit::WebCache::UsageStats param_type; | |
| 1267 static void Write(Message* m, const param_type& p) { | |
| 1268 WriteParam(m, p.minDeadCapacity); | |
| 1269 WriteParam(m, p.maxDeadCapacity); | |
| 1270 WriteParam(m, p.capacity); | |
| 1271 WriteParam(m, p.liveSize); | |
| 1272 WriteParam(m, p.deadSize); | |
| 1273 } | |
| 1274 static bool Read(const Message* m, void** iter, param_type* r) { | |
| 1275 return | |
| 1276 ReadParam(m, iter, &r->minDeadCapacity) && | |
| 1277 ReadParam(m, iter, &r->maxDeadCapacity) && | |
| 1278 ReadParam(m, iter, &r->capacity) && | |
| 1279 ReadParam(m, iter, &r->liveSize) && | |
| 1280 ReadParam(m, iter, &r->deadSize); | |
| 1281 } | |
| 1282 static void Log(const param_type& p, std::wstring* l) { | |
| 1283 l->append(L"<WebCache::UsageStats>"); | |
| 1284 } | |
| 1285 }; | |
| 1286 | |
| 1287 template <> | |
| 1288 struct ParamTraits<WebKit::WebCache::ResourceTypeStat> { | |
| 1289 typedef WebKit::WebCache::ResourceTypeStat param_type; | |
| 1290 static void Write(Message* m, const param_type& p) { | |
| 1291 WriteParam(m, p.count); | |
| 1292 WriteParam(m, p.size); | |
| 1293 WriteParam(m, p.liveSize); | |
| 1294 WriteParam(m, p.decodedSize); | |
| 1295 } | |
| 1296 static bool Read(const Message* m, void** iter, param_type* r) { | |
| 1297 bool result = | |
| 1298 ReadParam(m, iter, &r->count) && | |
| 1299 ReadParam(m, iter, &r->size) && | |
| 1300 ReadParam(m, iter, &r->liveSize) && | |
| 1301 ReadParam(m, iter, &r->decodedSize); | |
| 1302 return result; | |
| 1303 } | |
| 1304 static void Log(const param_type& p, std::wstring* l) { | |
| 1305 l->append(StringPrintf(L"%d %d %d %d", p.count, p.size, p.liveSize, | |
| 1306 p.decodedSize)); | |
| 1307 } | |
| 1308 }; | |
| 1309 | |
| 1310 template <> | |
| 1311 struct ParamTraits<WebKit::WebCache::ResourceTypeStats> { | |
| 1312 typedef WebKit::WebCache::ResourceTypeStats param_type; | |
| 1313 static void Write(Message* m, const param_type& p) { | |
| 1314 WriteParam(m, p.images); | |
| 1315 WriteParam(m, p.cssStyleSheets); | |
| 1316 WriteParam(m, p.scripts); | |
| 1317 WriteParam(m, p.xslStyleSheets); | |
| 1318 WriteParam(m, p.fonts); | |
| 1319 } | |
| 1320 static bool Read(const Message* m, void** iter, param_type* r) { | |
| 1321 bool result = | |
| 1322 ReadParam(m, iter, &r->images) && | |
| 1323 ReadParam(m, iter, &r->cssStyleSheets) && | |
| 1324 ReadParam(m, iter, &r->scripts) && | |
| 1325 ReadParam(m, iter, &r->xslStyleSheets) && | |
| 1326 ReadParam(m, iter, &r->fonts); | |
| 1327 return result; | |
| 1328 } | |
| 1329 static void Log(const param_type& p, std::wstring* l) { | |
| 1330 l->append(L"<WebCoreStats>"); | |
| 1331 LogParam(p.images, l); | |
| 1332 LogParam(p.cssStyleSheets, l); | |
| 1333 LogParam(p.scripts, l); | |
| 1334 LogParam(p.xslStyleSheets, l); | |
| 1335 LogParam(p.fonts, l); | |
| 1336 l->append(L"</WebCoreStats>"); | |
| 1337 } | |
| 1338 }; | |
| 1339 | |
| 1340 // Traits for PasswordFormDomManager::FillData. | 1147 // Traits for PasswordFormDomManager::FillData. |
| 1341 template <> | 1148 template <> |
| 1342 struct ParamTraits<PasswordFormDomManager::FillData> { | 1149 struct ParamTraits<PasswordFormDomManager::FillData> { |
| 1343 typedef PasswordFormDomManager::FillData param_type; | 1150 typedef PasswordFormDomManager::FillData param_type; |
| 1344 static void Write(Message* m, const param_type& p) { | 1151 static void Write(Message* m, const param_type& p) { |
| 1345 WriteParam(m, p.basic_data); | 1152 WriteParam(m, p.basic_data); |
| 1346 WriteParam(m, p.additional_logins); | 1153 WriteParam(m, p.additional_logins); |
| 1347 WriteParam(m, p.wait_for_username); | 1154 WriteParam(m, p.wait_for_username); |
| 1348 } | 1155 } |
| 1349 static bool Read(const Message* m, void** iter, param_type* r) { | 1156 static bool Read(const Message* m, void** iter, param_type* r) { |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1803 ReadParam(m, iter, &p->text_html) && | 1610 ReadParam(m, iter, &p->text_html) && |
| 1804 ReadParam(m, iter, &p->html_base_url) && | 1611 ReadParam(m, iter, &p->html_base_url) && |
| 1805 ReadParam(m, iter, &p->file_description_filename) && | 1612 ReadParam(m, iter, &p->file_description_filename) && |
| 1806 ReadParam(m, iter, &p->file_contents); | 1613 ReadParam(m, iter, &p->file_contents); |
| 1807 } | 1614 } |
| 1808 static void Log(const param_type& p, std::wstring* l) { | 1615 static void Log(const param_type& p, std::wstring* l) { |
| 1809 l->append(L"<WebDropData>"); | 1616 l->append(L"<WebDropData>"); |
| 1810 } | 1617 } |
| 1811 }; | 1618 }; |
| 1812 | 1619 |
| 1813 // Traits for ScreenInfo | |
| 1814 template <> | |
| 1815 struct ParamTraits<webkit_glue::ScreenInfo> { | |
| 1816 typedef webkit_glue::ScreenInfo param_type; | |
| 1817 static void Write(Message* m, const param_type& p) { | |
| 1818 WriteParam(m, p.depth); | |
| 1819 WriteParam(m, p.depth_per_component); | |
| 1820 WriteParam(m, p.is_monochrome); | |
| 1821 WriteParam(m, p.rect); | |
| 1822 WriteParam(m, p.available_rect); | |
| 1823 } | |
| 1824 static bool Read(const Message* m, void** iter, param_type* p) { | |
| 1825 return | |
| 1826 ReadParam(m, iter, &p->depth) && | |
| 1827 ReadParam(m, iter, &p->depth_per_component) && | |
| 1828 ReadParam(m, iter, &p->is_monochrome) && | |
| 1829 ReadParam(m, iter, &p->rect) && | |
| 1830 ReadParam(m, iter, &p->available_rect); | |
| 1831 } | |
| 1832 static void Log(const param_type& p, std::wstring* l) { | |
| 1833 l->append(L"<webkit_glue::ScreenInfo>"); | |
| 1834 } | |
| 1835 }; | |
| 1836 | |
| 1837 template<> | 1620 template<> |
| 1838 struct ParamTraits<ModalDialogEvent> { | 1621 struct ParamTraits<ModalDialogEvent> { |
| 1839 typedef ModalDialogEvent param_type; | 1622 typedef ModalDialogEvent param_type; |
| 1840 #if defined(OS_WIN) | 1623 #if defined(OS_WIN) |
| 1841 static void Write(Message* m, const param_type& p) { | 1624 static void Write(Message* m, const param_type& p) { |
| 1842 WriteParam(m, p.event); | 1625 WriteParam(m, p.event); |
| 1843 } | 1626 } |
| 1844 static bool Read(const Message* m, void** iter, param_type* p) { | 1627 static bool Read(const Message* m, void** iter, param_type* p) { |
| 1845 return ReadParam(m, iter, &p->event); | 1628 return ReadParam(m, iter, &p->event); |
| 1846 } | 1629 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1978 break; | 1761 break; |
| 1979 default: | 1762 default: |
| 1980 state = L"UNKNOWN"; | 1763 state = L"UNKNOWN"; |
| 1981 break; | 1764 break; |
| 1982 } | 1765 } |
| 1983 | 1766 |
| 1984 LogParam(state, l); | 1767 LogParam(state, l); |
| 1985 } | 1768 } |
| 1986 }; | 1769 }; |
| 1987 | 1770 |
| 1988 template <> | |
| 1989 struct ParamTraits<WebKit::WebFindInPageRequest> { | |
| 1990 typedef WebKit::WebFindInPageRequest param_type; | |
| 1991 static void Write(Message* m, const param_type& p) { | |
| 1992 WriteParam(m, p.identifier); | |
| 1993 WriteParam(m, p.text); | |
| 1994 WriteParam(m, p.forward); | |
| 1995 WriteParam(m, p.matchCase); | |
| 1996 WriteParam(m, p.findNext); | |
| 1997 } | |
| 1998 static bool Read(const Message* m, void** iter, param_type* p) { | |
| 1999 return | |
| 2000 ReadParam(m, iter, &p->identifier) && | |
| 2001 ReadParam(m, iter, &p->text) && | |
| 2002 ReadParam(m, iter, &p->forward) && | |
| 2003 ReadParam(m, iter, &p->matchCase) && | |
| 2004 ReadParam(m, iter, &p->findNext); | |
| 2005 } | |
| 2006 static void Log(const param_type& p, std::wstring* l) { | |
| 2007 l->append(L"<FindInPageRequest>"); | |
| 2008 } | |
| 2009 }; | |
| 2010 | |
| 2011 } // namespace IPC | 1771 } // namespace IPC |
| 2012 | 1772 |
| 2013 | 1773 |
| 2014 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" | 1774 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" |
| 2015 #include "chrome/common/ipc_message_macros.h" | 1775 #include "chrome/common/ipc_message_macros.h" |
| 2016 | 1776 |
| 2017 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ | 1777 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ |
| OLD | NEW |