| OLD | NEW |
| 1 // Copyright (c) 2011 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 "chrome/common/common_param_traits.h" | 5 #include "chrome/common/common_param_traits.h" |
| 6 | 6 |
| 7 #include "ipc/ipc_message.h" | 7 #include "ipc/ipc_message.h" |
| 8 #include "ipc/ipc_message_utils.h" | 8 #include "ipc/ipc_message_utils.h" |
| 9 | 9 |
| 10 namespace IPC { | 10 namespace IPC { |
| 11 | 11 |
| 12 void ParamTraits<ContentSetting>::Write(Message* m, const param_type& p) { | 12 void ParamTraits<ContentSetting>::Write(Message* m, const param_type& p) { |
| 13 m->WriteInt(static_cast<int>(p)); | 13 m->WriteInt(static_cast<int>(p)); |
| 14 } | 14 } |
| 15 | 15 |
| 16 bool ParamTraits<ContentSetting>::Read(const Message* m, void** iter, | 16 bool ParamTraits<ContentSetting>::Read(const Message* m, PickleIterator* iter, |
| 17 param_type* p) { | 17 param_type* p) { |
| 18 int type; | 18 int type; |
| 19 if (!m->ReadInt(iter, &type)) | 19 if (!m->ReadInt(iter, &type)) |
| 20 return false; | 20 return false; |
| 21 *p = static_cast<param_type>(type); | 21 *p = static_cast<param_type>(type); |
| 22 return true; | 22 return true; |
| 23 } | 23 } |
| 24 | 24 |
| 25 void ParamTraits<ContentSetting>::Log(const param_type& p, std::string* l) { | 25 void ParamTraits<ContentSetting>::Log(const param_type& p, std::string* l) { |
| 26 std::string content_setting; | 26 std::string content_setting; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 44 content_setting = "UNKNOWN"; | 44 content_setting = "UNKNOWN"; |
| 45 break; | 45 break; |
| 46 } | 46 } |
| 47 LogParam(content_setting, l); | 47 LogParam(content_setting, l); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void ParamTraits<ContentSettingsType>::Write(Message* m, const param_type& p) { | 50 void ParamTraits<ContentSettingsType>::Write(Message* m, const param_type& p) { |
| 51 m->WriteInt(static_cast<int>(p)); | 51 m->WriteInt(static_cast<int>(p)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool ParamTraits<ContentSettingsType>::Read(const Message* m, void** iter, | 54 bool ParamTraits<ContentSettingsType>::Read(const Message* m, |
| 55 param_type* p) { | 55 PickleIterator* iter, |
| 56 param_type* p) { |
| 56 int type; | 57 int type; |
| 57 if (!m->ReadInt(iter, &type)) | 58 if (!m->ReadInt(iter, &type)) |
| 58 return false; | 59 return false; |
| 59 *p = static_cast<param_type>(type); | 60 *p = static_cast<param_type>(type); |
| 60 return true; | 61 return true; |
| 61 } | 62 } |
| 62 | 63 |
| 63 void ParamTraits<ContentSettingsType>::Log(const param_type& p, | 64 void ParamTraits<ContentSettingsType>::Log(const param_type& p, |
| 64 std::string* l) { | 65 std::string* l) { |
| 65 std::string setting_type; | 66 std::string setting_type; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 92 setting_type = "CONTENT_SETTINGS_TYPE_INTENTS"; | 93 setting_type = "CONTENT_SETTINGS_TYPE_INTENTS"; |
| 93 break; | 94 break; |
| 94 default: | 95 default: |
| 95 setting_type = "UNKNOWN"; | 96 setting_type = "UNKNOWN"; |
| 96 break; | 97 break; |
| 97 } | 98 } |
| 98 LogParam(setting_type, l); | 99 LogParam(setting_type, l); |
| 99 } | 100 } |
| 100 | 101 |
| 101 } // namespace IPC | 102 } // namespace IPC |
| OLD | NEW |