| 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/render_messages_params.h" | 5 #include "chrome/common/render_messages_params.h" |
| 6 | 6 |
| 7 #include "chrome/common/common_param_traits.h" | |
| 8 #include "chrome/common/extensions/extension_constants.h" | 7 #include "chrome/common/extensions/extension_constants.h" |
| 9 #include "chrome/common/render_messages.h" | 8 #include "chrome/common/render_messages.h" |
| 10 #include "net/base/upload_data.h" | 9 #include "net/base/upload_data.h" |
| 11 | 10 |
| 12 ViewMsg_Print_Params::ViewMsg_Print_Params() | 11 ViewMsg_Print_Params::ViewMsg_Print_Params() |
| 13 : margin_top(0), | 12 : margin_top(0), |
| 14 margin_left(0), | 13 margin_left(0), |
| 15 dpi(0), | 14 dpi(0), |
| 16 min_shrink(0), | 15 min_shrink(0), |
| 17 max_shrink(0), | 16 max_shrink(0), |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 122 |
| 124 ViewHostMsg_DomMessage_Params::ViewHostMsg_DomMessage_Params() | 123 ViewHostMsg_DomMessage_Params::ViewHostMsg_DomMessage_Params() |
| 125 : request_id(0), | 124 : request_id(0), |
| 126 has_callback(false), | 125 has_callback(false), |
| 127 user_gesture(false) { | 126 user_gesture(false) { |
| 128 } | 127 } |
| 129 | 128 |
| 130 ViewHostMsg_DomMessage_Params::~ViewHostMsg_DomMessage_Params() { | 129 ViewHostMsg_DomMessage_Params::~ViewHostMsg_DomMessage_Params() { |
| 131 } | 130 } |
| 132 | 131 |
| 133 ViewHostMsg_MalwareDOMDetails_Node::ViewHostMsg_MalwareDOMDetails_Node() { | |
| 134 } | |
| 135 | |
| 136 ViewHostMsg_MalwareDOMDetails_Node::~ViewHostMsg_MalwareDOMDetails_Node() { | |
| 137 } | |
| 138 | |
| 139 ViewHostMsg_MalwareDOMDetails_Params::ViewHostMsg_MalwareDOMDetails_Params() { | |
| 140 } | |
| 141 | |
| 142 ViewHostMsg_MalwareDOMDetails_Params::~ViewHostMsg_MalwareDOMDetails_Params() { | |
| 143 } | |
| 144 | |
| 145 ViewMsg_ExtensionLoaded_Params::ViewMsg_ExtensionLoaded_Params() | 132 ViewMsg_ExtensionLoaded_Params::ViewMsg_ExtensionLoaded_Params() |
| 146 : location(Extension::INVALID) { | 133 : location(Extension::INVALID) { |
| 147 } | 134 } |
| 148 | 135 |
| 149 ViewMsg_ExtensionLoaded_Params::~ViewMsg_ExtensionLoaded_Params() { | 136 ViewMsg_ExtensionLoaded_Params::~ViewMsg_ExtensionLoaded_Params() { |
| 150 } | 137 } |
| 151 | 138 |
| 152 ViewMsg_ExtensionLoaded_Params::ViewMsg_ExtensionLoaded_Params( | 139 ViewMsg_ExtensionLoaded_Params::ViewMsg_ExtensionLoaded_Params( |
| 153 const ViewMsg_ExtensionLoaded_Params& other) | 140 const ViewMsg_ExtensionLoaded_Params& other) |
| 154 : manifest(other.manifest->DeepCopy()), | 141 : manifest(other.manifest->DeepCopy()), |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 val >= Extension::NUM_LOCATIONS) | 204 val >= Extension::NUM_LOCATIONS) |
| 218 return false; | 205 return false; |
| 219 *p = static_cast<param_type>(val); | 206 *p = static_cast<param_type>(val); |
| 220 return true; | 207 return true; |
| 221 } | 208 } |
| 222 static void Log(const param_type& p, std::string* l) { | 209 static void Log(const param_type& p, std::string* l) { |
| 223 ParamTraits<int>::Log(static_cast<int>(p), l); | 210 ParamTraits<int>::Log(static_cast<int>(p), l); |
| 224 } | 211 } |
| 225 }; | 212 }; |
| 226 | 213 |
| 227 template <> | |
| 228 struct ParamTraits | |
| 229 <ViewHostMsg_AccessibilityNotification_Params::NotificationType> { | |
| 230 typedef ViewHostMsg_AccessibilityNotification_Params params; | |
| 231 typedef params::NotificationType param_type; | |
| 232 static void Write(Message* m, const param_type& p) { | |
| 233 int val = static_cast<int>(p); | |
| 234 WriteParam(m, val); | |
| 235 } | |
| 236 static bool Read(const Message* m, void** iter, param_type* p) { | |
| 237 int val = 0; | |
| 238 if (!ReadParam(m, iter, &val) || | |
| 239 val < params::NOTIFICATION_TYPE_CHECK_STATE_CHANGED || | |
| 240 val > params::NOTIFICATION_TYPE_SELECTED_TEXT_CHANGED) { | |
| 241 return false; | |
| 242 } | |
| 243 *p = static_cast<param_type>(val); | |
| 244 return true; | |
| 245 } | |
| 246 static void Log(const param_type& p, std::string* l) { | |
| 247 ParamTraits<int>::Log(static_cast<int>(p), l); | |
| 248 } | |
| 249 }; | |
| 250 | |
| 251 void ParamTraits<ViewHostMsg_PageHasOSDD_Type>::Write(Message* m, | 214 void ParamTraits<ViewHostMsg_PageHasOSDD_Type>::Write(Message* m, |
| 252 const param_type& p) { | 215 const param_type& p) { |
| 253 m->WriteInt(p.type); | 216 m->WriteInt(p.type); |
| 254 } | 217 } |
| 255 | 218 |
| 256 bool ParamTraits<ViewHostMsg_PageHasOSDD_Type>::Read(const Message* m, | 219 bool ParamTraits<ViewHostMsg_PageHasOSDD_Type>::Read(const Message* m, |
| 257 void** iter, | 220 void** iter, |
| 258 param_type* p) { | 221 param_type* p) { |
| 259 int type; | 222 int type; |
| 260 if (!m->ReadInt(iter, &type)) | 223 if (!m->ReadInt(iter, &type)) |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 LogParam(p.source_url, l); | 528 LogParam(p.source_url, l); |
| 566 l->append(", "); | 529 l->append(", "); |
| 567 LogParam(p.request_id, l); | 530 LogParam(p.request_id, l); |
| 568 l->append(", "); | 531 l->append(", "); |
| 569 LogParam(p.has_callback, l); | 532 LogParam(p.has_callback, l); |
| 570 l->append(", "); | 533 l->append(", "); |
| 571 LogParam(p.user_gesture, l); | 534 LogParam(p.user_gesture, l); |
| 572 l->append(")"); | 535 l->append(")"); |
| 573 } | 536 } |
| 574 | 537 |
| 575 void ParamTraits<ViewHostMsg_AccessibilityNotification_Params>::Write( | |
| 576 Message* m, | |
| 577 const param_type& p) { | |
| 578 WriteParam(m, p.notification_type); | |
| 579 WriteParam(m, p.acc_obj); | |
| 580 } | |
| 581 | |
| 582 bool ParamTraits<ViewHostMsg_AccessibilityNotification_Params>::Read( | |
| 583 const Message* m, | |
| 584 void** iter, | |
| 585 param_type* p) { | |
| 586 return | |
| 587 ReadParam(m, iter, &p->notification_type) && | |
| 588 ReadParam(m, iter, &p->acc_obj); | |
| 589 } | |
| 590 | |
| 591 void ParamTraits<ViewHostMsg_AccessibilityNotification_Params>::Log( | |
| 592 const param_type& p, | |
| 593 std::string* l) { | |
| 594 l->append("("); | |
| 595 LogParam(p.notification_type, l); | |
| 596 l->append(", "); | |
| 597 LogParam(p.acc_obj, l); | |
| 598 l->append(")"); | |
| 599 } | |
| 600 | |
| 601 void ParamTraits<ViewHostMsg_MalwareDOMDetails_Params>::Write( | |
| 602 Message* m, | |
| 603 const param_type& p) { | |
| 604 WriteParam(m, p.nodes); | |
| 605 } | |
| 606 | |
| 607 bool ParamTraits<ViewHostMsg_MalwareDOMDetails_Params>::Read( | |
| 608 const Message* m, | |
| 609 void** iter, | |
| 610 param_type* p) { | |
| 611 return ReadParam(m, iter, &p->nodes); | |
| 612 } | |
| 613 | |
| 614 void ParamTraits<ViewHostMsg_MalwareDOMDetails_Params>::Log( | |
| 615 const param_type& p, | |
| 616 std::string* l) { | |
| 617 l->append("("); | |
| 618 LogParam(p.nodes, l); | |
| 619 l->append(")"); | |
| 620 } | |
| 621 | |
| 622 void ParamTraits<ViewHostMsg_MalwareDOMDetails_Node>::Write( | |
| 623 Message* m, | |
| 624 const param_type& p) { | |
| 625 WriteParam(m, p.url); | |
| 626 WriteParam(m, p.tag_name); | |
| 627 WriteParam(m, p.parent); | |
| 628 WriteParam(m, p.children); | |
| 629 } | |
| 630 | |
| 631 bool ParamTraits<ViewHostMsg_MalwareDOMDetails_Node>::Read( | |
| 632 const Message* m, | |
| 633 void** iter, | |
| 634 param_type* p) { | |
| 635 return | |
| 636 ReadParam(m, iter, &p->url) && | |
| 637 ReadParam(m, iter, &p->tag_name) && | |
| 638 ReadParam(m, iter, &p->parent) && | |
| 639 ReadParam(m, iter, &p->children); | |
| 640 } | |
| 641 | |
| 642 void ParamTraits<ViewHostMsg_MalwareDOMDetails_Node>::Log( | |
| 643 const param_type& p, | |
| 644 std::string* l) { | |
| 645 l->append("("); | |
| 646 LogParam(p.url, l); | |
| 647 l->append(", "); | |
| 648 LogParam(p.tag_name, l); | |
| 649 l->append(", "); | |
| 650 LogParam(p.parent, l); | |
| 651 l->append(", "); | |
| 652 LogParam(p.children, l); | |
| 653 l->append(")"); | |
| 654 } | |
| 655 | |
| 656 } // namespace IPC | 538 } // namespace IPC |
| OLD | NEW |