OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/base/models/menu_model.h" | 5 #include "ui/base/models/menu_model.h" |
6 | 6 |
7 // Get basic type definitions. | 7 // Get basic type definitions. |
8 #define IPC_MESSAGE_IMPL | 8 #define IPC_MESSAGE_IMPL |
9 #include "chrome/common/automation_messages.h" | 9 #include "chrome/common/automation_messages.h" |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 ContextMenuModel::Item::Item() | 45 ContextMenuModel::Item::Item() |
46 : type(static_cast<int>(ui::MenuModel::TYPE_COMMAND)), | 46 : type(static_cast<int>(ui::MenuModel::TYPE_COMMAND)), |
47 item_id(0), | 47 item_id(0), |
48 checked(false), | 48 checked(false), |
49 enabled(true), | 49 enabled(true), |
50 submenu(NULL) { | 50 submenu(NULL) { |
51 } | 51 } |
52 | 52 |
53 namespace IPC { | 53 namespace IPC { |
54 | 54 |
55 void ParamTraits<AutomationMouseEvent>::Write(Message* m, | |
56 const param_type& p) { | |
57 WriteParam(m, std::string(reinterpret_cast<const char*>(&p.mouse_event), | |
58 sizeof(p.mouse_event))); | |
59 WriteParam(m, p.location_script_chain); | |
60 } | |
61 | |
62 bool ParamTraits<AutomationMouseEvent>::Read(const Message* m, | |
63 PickleIterator* iter, | |
64 param_type* p) { | |
65 std::string mouse_event; | |
66 if (!ReadParam(m, iter, &mouse_event)) | |
67 return false; | |
68 memcpy(&p->mouse_event, mouse_event.c_str(), mouse_event.length()); | |
69 if (!ReadParam(m, iter, &p->location_script_chain)) | |
70 return false; | |
71 return true; | |
72 } | |
73 | |
74 void ParamTraits<AutomationMouseEvent>::Log(const param_type& p, | |
75 std::string* l) { | |
76 l->append("("); | |
77 LogParam(std::string(reinterpret_cast<const char*>(&p.mouse_event), | |
78 sizeof(p.mouse_event)), | |
79 l); | |
80 l->append(", "); | |
81 LogParam(p.location_script_chain, l); | |
82 l->append(")"); | |
83 } | |
84 | |
85 void ParamTraits<ContextMenuModel>::Write(Message* m, | 55 void ParamTraits<ContextMenuModel>::Write(Message* m, |
86 const param_type& p) { | 56 const param_type& p) { |
87 WriteParam(m, p.items.size()); | 57 WriteParam(m, p.items.size()); |
88 for (size_t i = 0; i < p.items.size(); ++i) { | 58 for (size_t i = 0; i < p.items.size(); ++i) { |
89 WriteParam(m, static_cast<int>(p.items[i].type)); | 59 WriteParam(m, static_cast<int>(p.items[i].type)); |
90 WriteParam(m, p.items[i].item_id); | 60 WriteParam(m, p.items[i].item_id); |
91 WriteParam(m, p.items[i].label); | 61 WriteParam(m, p.items[i].label); |
92 WriteParam(m, p.items[i].checked); | 62 WriteParam(m, p.items[i].checked); |
93 WriteParam(m, p.items[i].enabled); | 63 WriteParam(m, p.items[i].enabled); |
94 | 64 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 LogParam(status, l); | 278 LogParam(status, l); |
309 | 279 |
310 if (p.status() == net::URLRequestStatus::FAILED) { | 280 if (p.status() == net::URLRequestStatus::FAILED) { |
311 l->append(", "); | 281 l->append(", "); |
312 LogParam(p.error(), l); | 282 LogParam(p.error(), l); |
313 l->append(")"); | 283 l->append(")"); |
314 } | 284 } |
315 } | 285 } |
316 | 286 |
317 } // namespace IPC | 287 } // namespace IPC |
OLD | NEW |