OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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 IOS_WEB_PUBLIC_CRW_NAVIGATION_ITEM_STORAGE_H_ | |
6 #define IOS_WEB_PUBLIC_CRW_NAVIGATION_ITEM_STORAGE_H_ | |
7 | |
8 #import <Foundation/Foundation.h> | |
9 #include <stddef.h> | |
10 | |
11 #include "base/strings/string16.h" | |
12 #include "base/time/time.h" | |
13 #include "ios/web/public/referrer.h" | |
14 #include "ios/web/public/web_state/page_display_state.h" | |
15 #include "url/gurl.h" | |
16 | |
17 namespace web { | |
18 | |
19 // Keys used to serialize web::PageDisplayState properties. | |
20 extern NSString* const kNavigationItemStoragePageDisplayStateKey; | |
21 extern NSString* const kNavigationItemStorageScrollOffsetXKey; | |
22 extern NSString* const kNavigationItemStorageScrollOffsetYKey; | |
23 extern NSString* const kNavigationItemStorageMinimumZoomScaleKey; | |
24 extern NSString* const kNavigationItemStorageMaximumZoomScaleKey; | |
25 extern NSString* const kNavigationItemStorageZoomScaleKey; | |
26 | |
27 // Keys used to serialize navigation properties. | |
28 | |
29 // Current URL (std::string). | |
30 extern NSString* const kNavigationItemStorageURLKey; | |
31 // Current URL. Deprecated, used for backward compatibility (NSURL). | |
32 extern NSString* const kNavigationItemStorageURLDeperecatedKey; | |
33 // Page referrer URL (std::string). | |
34 extern NSString* const kNavigationItemStorageReferrerURLKey; | |
35 // Page referrer URL (NSURL). Deprecated, used for backward compatibility. | |
36 extern NSString* const kNavigationItemStorageReferrerURLDeprecatedKey; | |
37 // Page referrer policy (int). | |
38 extern NSString* const kNavigationItemStorageReferrerPolicyKey; | |
39 // The time at which the last known local navigation has completed (int64_t). | |
40 extern NSString* const kNavigationItemStorageTimestampKey; | |
41 // Page title (NSString). | |
42 extern NSString* const kNavigationItemStorageTitleKey; | |
43 // POST request data (NSData). | |
44 extern NSString* const kNavigationItemStoragePOSTDataKey; | |
45 // HTTP request headers (NSDictionary). | |
46 extern NSString* const kNavigationItemStorageHTTPRequestHeadersKey; | |
47 // Whether or not to bypass showing the resubmit data confirmation when loading | |
48 // a POST request (BOOL). | |
49 extern NSString* const kNavigationItemStorageSkipRepostFormConfirmationKey; | |
50 // Should desktop user agent be used (BOOL)? | |
51 extern NSString* const kNavigationItemStorageUseDesktopUserAgentKey; | |
52 | |
53 } // namespace web | |
54 | |
55 // NSCoding-compliant class used to serialize NavigationItem's persisted | |
56 // properties. | |
57 @interface CRWNavigationItemStorage : NSObject<NSCoding> | |
58 | |
59 @property(nonatomic, assign) GURL virtualURL; | |
60 @property(nonatomic, assign) web::Referrer referrer; | |
61 @property(nonatomic, assign) base::Time timestamp; | |
62 @property(nonatomic, assign) base::string16 title; | |
63 @property(nonatomic, assign) web::PageDisplayState displayState; | |
64 @property(nonatomic, assign) BOOL shouldSkipRepostFormConfirmation; | |
65 @property(nonatomic, assign, getter=isOverridingUserAgent) | |
66 BOOL overridingUserAgent; | |
67 @property(nonatomic, copy) NSData* POSTData; | |
68 @property(nonatomic, copy) NSDictionary* HTTPRequestHeaders; | |
69 | |
70 @end | |
71 | |
72 // Exposes serialization helper functions for tests. | |
Eugene But (OOO till 7-30)
2017/01/31 22:12:26
From Google Testing Dev Guide: "Test code using re
kkhorimoto
2017/02/03 00:36:09
Helpers moved to PageDisplayState.
| |
73 @interface CRWNavigationItemStorage (Testing) | |
74 | |
75 + (web::PageDisplayState)displayStateFromDictionary:(NSDictionary*)dictionary; | |
76 + (NSDictionary*)dictionaryFromDisplayState:(web::PageDisplayState)displayState; | |
77 | |
78 @end | |
79 | |
80 #endif // IOS_WEB_PUBLIC_CRW_NAVIGATION_ITEM_STORAGE_H_ | |
OLD | NEW |