diff options
Diffstat (limited to 'chrome/common/render_messages.h')
-rw-r--r-- | chrome/common/render_messages.h | 99 |
1 files changed, 91 insertions, 8 deletions
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 96e8a4c..3a419cc2 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -23,12 +23,14 @@ #include "chrome/common/extensions/extension_extent.h" #include "chrome/common/extensions/url_pattern.h" #include "chrome/common/font_descriptor_mac.h" +#include "chrome/common/indexed_db_key.h" #include "chrome/common/navigation_gesture.h" #include "chrome/common/page_transition_types.h" #include "chrome/common/renderer_preferences.h" #include "chrome/common/resource_response.h" #include "chrome/common/translate_errors.h" #include "chrome/common/view_types.h" +#include "chrome/common/serialized_script_value.h" #include "chrome/common/webkit_param_traits.h" #include "chrome/common/window_container_type.h" #include "gfx/native_widget_types.h" @@ -569,7 +571,7 @@ struct ViewHostMsg_IDBDatabaseCreateObjectStore_Params { string16 name_; // The keyPath of the object store. - string16 keypath_; + NullableString16 key_path_; // Whether the object store created should have a key generator. bool auto_increment_; @@ -587,7 +589,7 @@ struct ViewHostMsg_IDBObjectStoreCreateIndex_Params { string16 name_; // The keyPath of the index. - string16 keypath_; + NullableString16 key_path_; // Whether the index created has unique keys. bool unique_; @@ -1586,6 +1588,87 @@ struct ParamTraits<SyncLoadResult> { } }; +template <> +struct ParamTraits<SerializedScriptValue> { + typedef SerializedScriptValue param_type; + static void Write(Message* m, const param_type& p) { + WriteParam(m, p.is_null()); + WriteParam(m, p.is_invalid()); + WriteParam(m, p.data()); + } + static bool Read(const Message* m, void** iter, param_type* r) { + bool is_null; + bool is_invalid; + string16 data; + bool ok = + ReadParam(m, iter, &is_null) && + ReadParam(m, iter, &is_invalid) && + ReadParam(m, iter, &data); + if (!ok) + return false; + r->set_is_null(is_null); + r->set_is_invalid(is_invalid); + r->set_data(data); + return true; + } + static void Log(const param_type& p, std::wstring* l) { + l->append(L"<SerializedScriptValue>("); + LogParam(p.is_null(), l); + l->append(L", "); + LogParam(p.is_invalid(), l); + l->append(L", "); + LogParam(p.data(), l); + l->append(L")"); + } +}; + +template <> +struct ParamTraits<IndexedDBKey> { + typedef IndexedDBKey param_type; + static void Write(Message* m, const param_type& p) { + WriteParam(m, int(p.type())); + // TODO(jorlow): Technically, we only need to pack the type being used. + WriteParam(m, p.string()); + WriteParam(m, p.number()); + } + static bool Read(const Message* m, void** iter, param_type* r) { + int type; + string16 string; + int32 number; + bool ok = + ReadParam(m, iter, &type) && + ReadParam(m, iter, &string) && + ReadParam(m, iter, &number); + if (!ok) + return false; + switch (type) { + case WebKit::WebIDBKey::NullType: + r->SetNull(); + return true; + case WebKit::WebIDBKey::StringType: + r->Set(string); + return true; + case WebKit::WebIDBKey::NumberType: + r->Set(number); + return true; + case WebKit::WebIDBKey::InvalidType: + r->SetInvalid(); + return true; + } + NOTREACHED(); + return false; + } + static void Log(const param_type& p, std::wstring* l) { + l->append(L"<IndexedDBKey>("); + LogParam(int(p.type()), l); + l->append(L", "); + LogParam(p.string(), l); + l->append(L", "); + LogParam(p.number(), l); + l->append(L")"); + } +}; + // Traits for FormData structure to pack/unpack. template <> struct ParamTraits<webkit_glue::FormData> { @@ -2553,7 +2636,7 @@ struct ParamTraits<ViewHostMsg_IDBDatabaseCreateObjectStore_Params> { static void Write(Message* m, const param_type& p) { WriteParam(m, p.response_id_); WriteParam(m, p.name_); - WriteParam(m, p.keypath_); + WriteParam(m, p.key_path_); WriteParam(m, p.auto_increment_); WriteParam(m, p.idb_database_id_); } @@ -2561,7 +2644,7 @@ struct ParamTraits<ViewHostMsg_IDBDatabaseCreateObjectStore_Params> { return ReadParam(m, iter, &p->response_id_) && ReadParam(m, iter, &p->name_) && - ReadParam(m, iter, &p->keypath_) && + ReadParam(m, iter, &p->key_path_) && ReadParam(m, iter, &p->auto_increment_) && ReadParam(m, iter, &p->idb_database_id_); } @@ -2571,7 +2654,7 @@ struct ParamTraits<ViewHostMsg_IDBDatabaseCreateObjectStore_Params> { l->append(L", "); LogParam(p.name_, l); l->append(L", "); - LogParam(p.keypath_, l); + LogParam(p.key_path_, l); l->append(L", "); LogParam(p.auto_increment_, l); l->append(L", "); @@ -2587,7 +2670,7 @@ struct ParamTraits<ViewHostMsg_IDBObjectStoreCreateIndex_Params> { static void Write(Message* m, const param_type& p) { WriteParam(m, p.response_id_); WriteParam(m, p.name_); - WriteParam(m, p.keypath_); + WriteParam(m, p.key_path_); WriteParam(m, p.unique_); WriteParam(m, p.idb_object_store_id_); } @@ -2595,7 +2678,7 @@ struct ParamTraits<ViewHostMsg_IDBObjectStoreCreateIndex_Params> { return ReadParam(m, iter, &p->response_id_) && ReadParam(m, iter, &p->name_) && - ReadParam(m, iter, &p->keypath_) && + ReadParam(m, iter, &p->key_path_) && ReadParam(m, iter, &p->unique_) && ReadParam(m, iter, &p->idb_object_store_id_); } @@ -2605,7 +2688,7 @@ struct ParamTraits<ViewHostMsg_IDBObjectStoreCreateIndex_Params> { l->append(L", "); LogParam(p.name_, l); l->append(L", "); - LogParam(p.keypath_, l); + LogParam(p.key_path_, l); l->append(L", "); LogParam(p.unique_, l); l->append(L", "); |