forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstate_serializer.h
71 lines (52 loc) · 2.44 KB
/
state_serializer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef ANDROID_WEBVIEW_NATIVE_STATE_SERIALIZER_H_
#define ANDROID_WEBVIEW_NATIVE_STATE_SERIALIZER_H_
#include <cstdint>
#include "base/compiler_specific.h"
namespace base {
class Pickle;
class PickleIterator;
} // namespace base
namespace content {
class NavigationEntry;
class WebContents;
} // namespace content
namespace android_webview {
// Write and restore a WebContents to and from a pickle. Return true on
// success.
// Note that |pickle| may be changed even if function returns false.
bool WriteToPickle(const content::WebContents& web_contents,
base::Pickle* pickle) WARN_UNUSED_RESULT;
// |web_contents| will not be modified if function returns false.
bool RestoreFromPickle(base::PickleIterator* iterator,
content::WebContents* web_contents) WARN_UNUSED_RESULT;
namespace internal {
const uint32_t AW_STATE_VERSION_INITIAL = 20130814;
const uint32_t AW_STATE_VERSION_DATA_URL = 20151204;
// Functions below are individual helper functions called by functions above.
// They are broken up for unit testing, and should not be called out side of
// tests.
bool WriteHeaderToPickle(base::Pickle* pickle) WARN_UNUSED_RESULT;
bool WriteHeaderToPickle(uint32_t state_version,
base::Pickle* pickle) WARN_UNUSED_RESULT;
uint32_t RestoreHeaderFromPickle(base::PickleIterator* iterator)
WARN_UNUSED_RESULT;
bool IsSupportedVersion(uint32_t state_version) WARN_UNUSED_RESULT;
bool WriteNavigationEntryToPickle(const content::NavigationEntry& entry,
base::Pickle* pickle) WARN_UNUSED_RESULT;
bool WriteNavigationEntryToPickle(uint32_t state_version,
const content::NavigationEntry& entry,
base::Pickle* pickle) WARN_UNUSED_RESULT;
bool RestoreNavigationEntryFromPickle(base::PickleIterator* iterator,
content::NavigationEntry* entry)
WARN_UNUSED_RESULT;
bool RestoreNavigationEntryFromPickle(uint32_t state_version,
base::PickleIterator* iterator,
content::NavigationEntry* entry)
WARN_UNUSED_RESULT;
} // namespace interanl
} // namespace android_webview
#endif // ANDROID_WEBVIEW_NATIVE_STATE_SERIALIZER_H_