OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 // | |
5 // This file contains (de)serialization (or if you like python, pickling) | |
6 // methods for various objects that we want to persist. | |
7 // In serialization, we write an object's state to a string in some opaque | |
8 // format. Deserialization reconstructs the object's state from such a string. | |
9 | |
10 #ifndef WEBKIT_GLUE_GLUE_SERIALIZE_H_ | |
11 #define WEBKIT_GLUE_GLUE_SERIALIZE_H_ | |
12 | |
13 #include <string> | |
14 | |
15 #include "base/files/file_path.h" | |
16 #include "third_party/WebKit/public/web/WebHistoryItem.h" | |
17 #include "webkit/glue/webkit_glue_export.h" | |
18 | |
19 class GURL; | |
20 | |
21 namespace webkit_glue { | |
22 | |
23 // HistoryItem serialization. | |
24 WEBKIT_GLUE_EXPORT std::string HistoryItemToString( | |
25 const WebKit::WebHistoryItem& item); | |
26 WEBKIT_GLUE_EXPORT WebKit::WebHistoryItem HistoryItemFromString( | |
27 const std::string& serialized_item); | |
28 | |
29 // Reads file paths from the HTTP body and the file input elements of a | |
30 // serialized WebHistoryItem. | |
31 WEBKIT_GLUE_EXPORT std::vector<base::FilePath> FilePathsFromHistoryState( | |
32 const std::string& content_state); | |
33 | |
34 // For testing purposes only. | |
35 WEBKIT_GLUE_EXPORT void HistoryItemToVersionedString( | |
36 const WebKit::WebHistoryItem& item, | |
37 int version, | |
38 std::string* serialized_item); | |
39 WEBKIT_GLUE_EXPORT int HistoryItemCurrentVersion(); | |
40 | |
41 // Removes form data containing passwords from the history state string | |
42 // |content_state|. | |
43 WEBKIT_GLUE_EXPORT std::string RemovePasswordDataFromHistoryState( | |
44 const std::string& content_state); | |
45 | |
46 // Removes scroll offset from the history state string |content_state|. | |
47 WEBKIT_GLUE_EXPORT std::string RemoveScrollOffsetFromHistoryState( | |
48 const std::string& content_state); | |
49 | |
50 // Creates serialized state for the specified URL. This is a variant of | |
51 // HistoryItemToString (in glue_serialize) that is used during session restore | |
52 // if the saved state is empty. | |
53 WEBKIT_GLUE_EXPORT std::string CreateHistoryStateForURL(const GURL& url); | |
54 | |
55 } // namespace webkit_glue | |
56 | |
57 #endif // #ifndef WEBKIT_GLUE_GLUE_SERIALIZE_H_ | |
OLD | NEW |