| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/render_messages_params.h" | 5 #include "chrome/common/render_messages_params.h" |
| 6 | 6 |
| 7 #include "chrome/common/navigation_gesture.h" | 7 #include "chrome/common/navigation_gesture.h" |
| 8 #include "chrome/common/common_param_traits.h" | 8 #include "chrome/common/common_param_traits.h" |
| 9 #include "chrome/common/extensions/extension_constants.h" | 9 #include "chrome/common/extensions/extension_constants.h" |
| 10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 : closing_process_id(0), | 52 : closing_process_id(0), |
| 53 closing_route_id(0), | 53 closing_route_id(0), |
| 54 for_cross_site_transition(false), | 54 for_cross_site_transition(false), |
| 55 new_render_process_host_id(0), | 55 new_render_process_host_id(0), |
| 56 new_request_id(0) { | 56 new_request_id(0) { |
| 57 } | 57 } |
| 58 | 58 |
| 59 ViewMsg_ClosePage_Params::~ViewMsg_ClosePage_Params() { | 59 ViewMsg_ClosePage_Params::~ViewMsg_ClosePage_Params() { |
| 60 } | 60 } |
| 61 | 61 |
| 62 ViewHostMsg_Resource_Request::ViewHostMsg_Resource_Request() | |
| 63 : load_flags(0), | |
| 64 origin_pid(0), | |
| 65 resource_type(ResourceType::MAIN_FRAME), | |
| 66 request_context(0), | |
| 67 appcache_host_id(0), | |
| 68 download_to_file(false), | |
| 69 has_user_gesture(false), | |
| 70 host_renderer_id(0), | |
| 71 host_render_view_id(0) { | |
| 72 } | |
| 73 | |
| 74 ViewHostMsg_Resource_Request::~ViewHostMsg_Resource_Request() { | |
| 75 } | |
| 76 | |
| 77 ViewMsg_Print_Params::ViewMsg_Print_Params() | 62 ViewMsg_Print_Params::ViewMsg_Print_Params() |
| 78 : margin_top(0), | 63 : margin_top(0), |
| 79 margin_left(0), | 64 margin_left(0), |
| 80 dpi(0), | 65 dpi(0), |
| 81 min_shrink(0), | 66 min_shrink(0), |
| 82 max_shrink(0), | 67 max_shrink(0), |
| 83 desired_dpi(0), | 68 desired_dpi(0), |
| 84 document_cookie(0), | 69 document_cookie(0), |
| 85 selection_only(false), | 70 selection_only(false), |
| 86 supports_alpha_blend(true) { | 71 supports_alpha_blend(true) { |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 break; | 368 break; |
| 384 | 369 |
| 385 default: | 370 default: |
| 386 event = "NavigationType_UNKNOWN"; | 371 event = "NavigationType_UNKNOWN"; |
| 387 break; | 372 break; |
| 388 } | 373 } |
| 389 LogParam(event, l); | 374 LogParam(event, l); |
| 390 } | 375 } |
| 391 }; | 376 }; |
| 392 | 377 |
| 393 template <> | |
| 394 struct ParamTraits<ResourceType::Type> { | |
| 395 typedef ResourceType::Type param_type; | |
| 396 static void Write(Message* m, const param_type& p) { | |
| 397 m->WriteInt(p); | |
| 398 } | |
| 399 static bool Read(const Message* m, void** iter, param_type* p) { | |
| 400 int type; | |
| 401 if (!m->ReadInt(iter, &type) || !ResourceType::ValidType(type)) | |
| 402 return false; | |
| 403 *p = ResourceType::FromInt(type); | |
| 404 return true; | |
| 405 } | |
| 406 static void Log(const param_type& p, std::string* l) { | |
| 407 std::string type; | |
| 408 switch (p) { | |
| 409 case ResourceType::MAIN_FRAME: | |
| 410 type = "MAIN_FRAME"; | |
| 411 break; | |
| 412 case ResourceType::SUB_FRAME: | |
| 413 type = "SUB_FRAME"; | |
| 414 break; | |
| 415 case ResourceType::SUB_RESOURCE: | |
| 416 type = "SUB_RESOURCE"; | |
| 417 break; | |
| 418 case ResourceType::OBJECT: | |
| 419 type = "OBJECT"; | |
| 420 break; | |
| 421 case ResourceType::MEDIA: | |
| 422 type = "MEDIA"; | |
| 423 break; | |
| 424 default: | |
| 425 type = "UNKNOWN"; | |
| 426 break; | |
| 427 } | |
| 428 | |
| 429 LogParam(type, l); | |
| 430 } | |
| 431 }; | |
| 432 | |
| 433 template<> | 378 template<> |
| 434 struct ParamTraits<NavigationGesture> { | 379 struct ParamTraits<NavigationGesture> { |
| 435 typedef NavigationGesture param_type; | 380 typedef NavigationGesture param_type; |
| 436 static void Write(Message* m, const param_type& p) { | 381 static void Write(Message* m, const param_type& p) { |
| 437 m->WriteInt(p); | 382 m->WriteInt(p); |
| 438 } | 383 } |
| 439 static bool Read(const Message* m, void** iter, param_type* p) { | 384 static bool Read(const Message* m, void** iter, param_type* p) { |
| 440 int type; | 385 int type; |
| 441 if (!m->ReadInt(iter, &type)) | 386 if (!m->ReadInt(iter, &type)) |
| 442 return false; | 387 return false; |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 LogParam(p.closing_route_id, l); | 875 LogParam(p.closing_route_id, l); |
| 931 l->append(", "); | 876 l->append(", "); |
| 932 LogParam(p.for_cross_site_transition, l); | 877 LogParam(p.for_cross_site_transition, l); |
| 933 l->append(", "); | 878 l->append(", "); |
| 934 LogParam(p.new_render_process_host_id, l); | 879 LogParam(p.new_render_process_host_id, l); |
| 935 l->append(", "); | 880 l->append(", "); |
| 936 LogParam(p.new_request_id, l); | 881 LogParam(p.new_request_id, l); |
| 937 l->append(")"); | 882 l->append(")"); |
| 938 } | 883 } |
| 939 | 884 |
| 940 void ParamTraits<ViewHostMsg_Resource_Request>::Write(Message* m, | |
| 941 const param_type& p) { | |
| 942 WriteParam(m, p.method); | |
| 943 WriteParam(m, p.url); | |
| 944 WriteParam(m, p.first_party_for_cookies); | |
| 945 WriteParam(m, p.referrer); | |
| 946 WriteParam(m, p.headers); | |
| 947 WriteParam(m, p.load_flags); | |
| 948 WriteParam(m, p.origin_pid); | |
| 949 WriteParam(m, p.resource_type); | |
| 950 WriteParam(m, p.request_context); | |
| 951 WriteParam(m, p.appcache_host_id); | |
| 952 WriteParam(m, p.upload_data); | |
| 953 WriteParam(m, p.download_to_file); | |
| 954 WriteParam(m, p.has_user_gesture); | |
| 955 WriteParam(m, p.host_renderer_id); | |
| 956 WriteParam(m, p.host_render_view_id); | |
| 957 } | |
| 958 | |
| 959 bool ParamTraits<ViewHostMsg_Resource_Request>::Read(const Message* m, | |
| 960 void** iter, | |
| 961 param_type* r) { | |
| 962 return | |
| 963 ReadParam(m, iter, &r->method) && | |
| 964 ReadParam(m, iter, &r->url) && | |
| 965 ReadParam(m, iter, &r->first_party_for_cookies) && | |
| 966 ReadParam(m, iter, &r->referrer) && | |
| 967 ReadParam(m, iter, &r->headers) && | |
| 968 ReadParam(m, iter, &r->load_flags) && | |
| 969 ReadParam(m, iter, &r->origin_pid) && | |
| 970 ReadParam(m, iter, &r->resource_type) && | |
| 971 ReadParam(m, iter, &r->request_context) && | |
| 972 ReadParam(m, iter, &r->appcache_host_id) && | |
| 973 ReadParam(m, iter, &r->upload_data) && | |
| 974 ReadParam(m, iter, &r->download_to_file) && | |
| 975 ReadParam(m, iter, &r->has_user_gesture) && | |
| 976 ReadParam(m, iter, &r->host_renderer_id) && | |
| 977 ReadParam(m, iter, &r->host_render_view_id); | |
| 978 } | |
| 979 | |
| 980 void ParamTraits<ViewHostMsg_Resource_Request>::Log(const param_type& p, | |
| 981 std::string* l) { | |
| 982 l->append("("); | |
| 983 LogParam(p.method, l); | |
| 984 l->append(", "); | |
| 985 LogParam(p.url, l); | |
| 986 l->append(", "); | |
| 987 LogParam(p.referrer, l); | |
| 988 l->append(", "); | |
| 989 LogParam(p.load_flags, l); | |
| 990 l->append(", "); | |
| 991 LogParam(p.origin_pid, l); | |
| 992 l->append(", "); | |
| 993 LogParam(p.resource_type, l); | |
| 994 l->append(", "); | |
| 995 LogParam(p.request_context, l); | |
| 996 l->append(", "); | |
| 997 LogParam(p.appcache_host_id, l); | |
| 998 l->append(", "); | |
| 999 LogParam(p.download_to_file, l); | |
| 1000 l->append(", "); | |
| 1001 LogParam(p.has_user_gesture, l); | |
| 1002 l->append(", "); | |
| 1003 LogParam(p.host_renderer_id, l); | |
| 1004 l->append(", "); | |
| 1005 LogParam(p.host_render_view_id, l); | |
| 1006 l->append(")"); | |
| 1007 } | |
| 1008 | |
| 1009 void ParamTraits<ViewMsg_Print_Params>::Write(Message* m, const param_type& p) { | 885 void ParamTraits<ViewMsg_Print_Params>::Write(Message* m, const param_type& p) { |
| 1010 WriteParam(m, p.page_size); | 886 WriteParam(m, p.page_size); |
| 1011 WriteParam(m, p.printable_size); | 887 WriteParam(m, p.printable_size); |
| 1012 WriteParam(m, p.margin_top); | 888 WriteParam(m, p.margin_top); |
| 1013 WriteParam(m, p.margin_left); | 889 WriteParam(m, p.margin_left); |
| 1014 WriteParam(m, p.dpi); | 890 WriteParam(m, p.dpi); |
| 1015 WriteParam(m, p.min_shrink); | 891 WriteParam(m, p.min_shrink); |
| 1016 WriteParam(m, p.max_shrink); | 892 WriteParam(m, p.max_shrink); |
| 1017 WriteParam(m, p.desired_dpi); | 893 WriteParam(m, p.desired_dpi); |
| 1018 WriteParam(m, p.document_cookie); | 894 WriteParam(m, p.document_cookie); |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 l->append(", "); | 1591 l->append(", "); |
| 1716 LogParam(p.tag_name, l); | 1592 LogParam(p.tag_name, l); |
| 1717 l->append(", "); | 1593 l->append(", "); |
| 1718 LogParam(p.parent, l); | 1594 LogParam(p.parent, l); |
| 1719 l->append(", "); | 1595 l->append(", "); |
| 1720 LogParam(p.children, l); | 1596 LogParam(p.children, l); |
| 1721 l->append(")"); | 1597 l->append(")"); |
| 1722 } | 1598 } |
| 1723 | 1599 |
| 1724 } // namespace IPC | 1600 } // namespace IPC |
| OLD | NEW |