| 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 #ifndef ANDROID_WEBVIEW_NATIVE_STATE_SERIALIZER_H_ | |
| 6 #define ANDROID_WEBVIEW_NATIVE_STATE_SERIALIZER_H_ | |
| 7 | |
| 8 #include <cstdint> | |
| 9 | |
| 10 #include "base/compiler_specific.h" | |
| 11 | |
| 12 namespace base { | |
| 13 | |
| 14 class Pickle; | |
| 15 class PickleIterator; | |
| 16 | |
| 17 } // namespace base | |
| 18 | |
| 19 namespace content { | |
| 20 | |
| 21 class NavigationEntry; | |
| 22 class WebContents; | |
| 23 | |
| 24 } // namespace content | |
| 25 | |
| 26 namespace android_webview { | |
| 27 | |
| 28 // Write and restore a WebContents to and from a pickle. Return true on | |
| 29 // success. | |
| 30 | |
| 31 // Note that |pickle| may be changed even if function returns false. | |
| 32 bool WriteToPickle(const content::WebContents& web_contents, | |
| 33 base::Pickle* pickle) WARN_UNUSED_RESULT; | |
| 34 | |
| 35 // |web_contents| will not be modified if function returns false. | |
| 36 bool RestoreFromPickle(base::PickleIterator* iterator, | |
| 37 content::WebContents* web_contents) WARN_UNUSED_RESULT; | |
| 38 | |
| 39 | |
| 40 namespace internal { | |
| 41 | |
| 42 const uint32_t AW_STATE_VERSION_INITIAL = 20130814; | |
| 43 const uint32_t AW_STATE_VERSION_DATA_URL = 20151204; | |
| 44 | |
| 45 // Functions below are individual helper functions called by functions above. | |
| 46 // They are broken up for unit testing, and should not be called out side of | |
| 47 // tests. | |
| 48 bool WriteHeaderToPickle(base::Pickle* pickle) WARN_UNUSED_RESULT; | |
| 49 bool WriteHeaderToPickle(uint32_t state_version, | |
| 50 base::Pickle* pickle) WARN_UNUSED_RESULT; | |
| 51 uint32_t RestoreHeaderFromPickle(base::PickleIterator* iterator) | |
| 52 WARN_UNUSED_RESULT; | |
| 53 bool IsSupportedVersion(uint32_t state_version) WARN_UNUSED_RESULT; | |
| 54 bool WriteNavigationEntryToPickle(const content::NavigationEntry& entry, | |
| 55 base::Pickle* pickle) WARN_UNUSED_RESULT; | |
| 56 bool WriteNavigationEntryToPickle(uint32_t state_version, | |
| 57 const content::NavigationEntry& entry, | |
| 58 base::Pickle* pickle) WARN_UNUSED_RESULT; | |
| 59 bool RestoreNavigationEntryFromPickle(base::PickleIterator* iterator, | |
| 60 content::NavigationEntry* entry) | |
| 61 WARN_UNUSED_RESULT; | |
| 62 bool RestoreNavigationEntryFromPickle(uint32_t state_version, | |
| 63 base::PickleIterator* iterator, | |
| 64 content::NavigationEntry* entry) | |
| 65 WARN_UNUSED_RESULT; | |
| 66 | |
| 67 } // namespace interanl | |
| 68 | |
| 69 } // namespace android_webview | |
| 70 | |
| 71 #endif // ANDROID_WEBVIEW_NATIVE_STATE_SERIALIZER_H_ | |
| OLD | NEW |