Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: webkit/glue/glue_serialize.cc

Issue 1036003: Add chromium-side support for history.{push,replace}State. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | webkit/tools/layout_tests/test_expectations.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/glue_serialize.cc
===================================================================
--- webkit/glue/glue_serialize.cc (revision 41846)
+++ webkit/glue/glue_serialize.cc (working copy)
@@ -13,6 +13,7 @@
#include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h"
#include "third_party/WebKit/WebKit/chromium/public/WebHTTPBody.h"
#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebSerializedScriptValue.h"
#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
#include "third_party/WebKit/WebKit/chromium/public/WebVector.h"
#include "webkit/glue/webkit_glue.h"
@@ -21,6 +22,7 @@
using WebKit::WebHistoryItem;
using WebKit::WebHTTPBody;
using WebKit::WebPoint;
+using WebKit::WebSerializedScriptValue;
using WebKit::WebString;
using WebKit::WebUChar;
using WebKit::WebVector;
@@ -50,12 +52,13 @@
// 4: Adds support for storing FormData::identifier().
// 5: Adds support for empty FormData
// 6: Adds support for documentSequenceNumbers
+// 7: Adds support for stateObject
// Should be const, but unit tests may modify it.
//
// NOTE: If the version is -1, then the pickle contains only a URL string.
// See CreateHistoryStateForURL.
//
-int kVersion = 6;
+int kVersion = 7;
// A bunch of convenience functions to read/write to SerializeObjects.
// The serializers assume the input data is in the correct format and so does
@@ -290,6 +293,12 @@
if (kVersion >= 6)
WriteInteger64(item.documentSequenceNumber(), obj);
+ if (kVersion >= 7) {
+ bool has_state_object = !item.stateObject().isNull();
+ WriteBoolean(has_state_object, obj);
+ if (has_state_object)
+ WriteString(item.stateObject().toString(), obj);
+ }
// Yes, the referrer is written twice. This is for backwards
// compatibility with the format.
@@ -343,6 +352,13 @@
if (obj->version >= 6)
item.setDocumentSequenceNumber(ReadInteger64(obj));
+ if (obj->version >= 7) {
+ bool has_state_object = ReadBoolean(obj);
+ if (has_state_object) {
+ item.setStateObject(
+ WebSerializedScriptValue::fromString(ReadString(obj)));
+ }
+ }
// The extra referrer string is read for backwards compat.
const WebHTTPBody& http_body = ReadFormData(obj);
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | webkit/tools/layout_tests/test_expectations.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698