OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef IOS_WEB_PUBLIC_CRW_NAVIGATION_ITEM_STORAGE_H_ | 5 #ifndef IOS_WEB_PUBLIC_CRW_NAVIGATION_ITEM_STORAGE_H_ |
6 #define IOS_WEB_PUBLIC_CRW_NAVIGATION_ITEM_STORAGE_H_ | 6 #define IOS_WEB_PUBLIC_CRW_NAVIGATION_ITEM_STORAGE_H_ |
7 | 7 |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "ios/web/public/referrer.h" | 13 #include "ios/web/public/referrer.h" |
| 14 #include "ios/web/public/user_agent.h" |
14 #import "ios/web/public/web_state/page_display_state.h" | 15 #import "ios/web/public/web_state/page_display_state.h" |
15 #include "url/gurl.h" | 16 #include "url/gurl.h" |
16 | 17 |
17 namespace web { | 18 namespace web { |
18 | 19 |
19 // Keys used to serialize navigation properties. | 20 // Keys used to serialize navigation properties. |
20 | 21 |
21 // Current URL (std::string). | 22 // Current URL (std::string). |
22 extern NSString* const kNavigationItemStorageURLKey; | 23 extern NSString* const kNavigationItemStorageURLKey; |
23 // Current URL. Deprecated, used for backward compatibility (NSURL). | 24 // Current URL. Deprecated, used for backward compatibility (NSURL). |
24 extern NSString* const kNavigationItemStorageURLDeperecatedKey; | 25 extern NSString* const kNavigationItemStorageURLDeperecatedKey; |
25 // Page referrer URL (std::string). | 26 // Page referrer URL (std::string). |
26 extern NSString* const kNavigationItemStorageReferrerURLKey; | 27 extern NSString* const kNavigationItemStorageReferrerURLKey; |
27 // Page referrer URL (NSURL). Deprecated, used for backward compatibility. | 28 // Page referrer URL (NSURL). Deprecated, used for backward compatibility. |
| 29 // TODO(crbug.com/696125): Remove this key. |
28 extern NSString* const kNavigationItemStorageReferrerURLDeprecatedKey; | 30 extern NSString* const kNavigationItemStorageReferrerURLDeprecatedKey; |
29 // Page referrer policy (int). | 31 // Page referrer policy (int). |
30 extern NSString* const kNavigationItemStorageReferrerPolicyKey; | 32 extern NSString* const kNavigationItemStorageReferrerPolicyKey; |
31 // The time at which the last known local navigation has completed (int64_t). | 33 // The time at which the last known local navigation has completed (int64_t). |
32 extern NSString* const kNavigationItemStorageTimestampKey; | 34 extern NSString* const kNavigationItemStorageTimestampKey; |
33 // Page title (NSString). | 35 // Page title (NSString). |
34 extern NSString* const kNavigationItemStorageTitleKey; | 36 extern NSString* const kNavigationItemStorageTitleKey; |
35 // The PageDisplayState (NSDictionary). | 37 // The PageDisplayState (NSDictionary). |
36 extern NSString* const kNavigationItemStoragePageDisplayStateKey; | 38 extern NSString* const kNavigationItemStoragePageDisplayStateKey; |
37 // POST request data (NSData). | 39 // POST request data (NSData). |
38 extern NSString* const kNavigationItemStoragePOSTDataKey; | 40 extern NSString* const kNavigationItemStoragePOSTDataKey; |
39 // HTTP request headers (NSDictionary). | 41 // HTTP request headers (NSDictionary). |
40 extern NSString* const kNavigationItemStorageHTTPRequestHeadersKey; | 42 extern NSString* const kNavigationItemStorageHTTPRequestHeadersKey; |
41 // Whether or not to bypass showing the resubmit data confirmation when loading | 43 // Whether or not to bypass showing the resubmit data confirmation when loading |
42 // a POST request (BOOL). | 44 // a POST request (BOOL). |
43 extern NSString* const kNavigationItemStorageSkipRepostFormConfirmationKey; | 45 extern NSString* const kNavigationItemStorageSkipRepostFormConfirmationKey; |
44 // Should desktop user agent be used (BOOL)? | 46 // The user agent type (std::string). |
45 extern NSString* const kNavigationItemStorageUseDesktopUserAgentKey; | 47 extern NSString* const kNavigationItemStorageUserAgentTypeKey; |
| 48 // Should desktop user agent be used (BOOL). Deprecated, used for backward |
| 49 // compatibility. |
| 50 // TODO(crbug.com/696125): remove this key. |
| 51 extern NSString* const kNavigationItemStorageUseDesktopUserAgentDeprecatedKey; |
46 | 52 |
47 } // namespace web | 53 } // namespace web |
48 | 54 |
49 // NSCoding-compliant class used to serialize NavigationItem's persisted | 55 // NSCoding-compliant class used to serialize NavigationItem's persisted |
50 // properties. | 56 // properties. |
51 @interface CRWNavigationItemStorage : NSObject<NSCoding> | 57 @interface CRWNavigationItemStorage : NSObject<NSCoding> |
52 | 58 |
53 @property(nonatomic, assign) GURL virtualURL; | 59 @property(nonatomic, assign) GURL virtualURL; |
54 @property(nonatomic, assign) web::Referrer referrer; | 60 @property(nonatomic, assign) web::Referrer referrer; |
55 @property(nonatomic, assign) base::Time timestamp; | 61 @property(nonatomic, assign) base::Time timestamp; |
56 @property(nonatomic, assign) base::string16 title; | 62 @property(nonatomic, assign) base::string16 title; |
57 @property(nonatomic, assign) web::PageDisplayState displayState; | 63 @property(nonatomic, assign) web::PageDisplayState displayState; |
58 @property(nonatomic, assign) BOOL shouldSkipRepostFormConfirmation; | 64 @property(nonatomic, assign) BOOL shouldSkipRepostFormConfirmation; |
59 @property(nonatomic, assign, getter=isOverridingUserAgent) | 65 @property(nonatomic, assign) web::UserAgentType userAgentType; |
60 BOOL overridingUserAgent; | |
61 @property(nonatomic, copy) NSData* POSTData; | 66 @property(nonatomic, copy) NSData* POSTData; |
62 @property(nonatomic, copy) NSDictionary* HTTPRequestHeaders; | 67 @property(nonatomic, copy) NSDictionary* HTTPRequestHeaders; |
63 | 68 |
64 @end | 69 @end |
65 | 70 |
66 #endif // IOS_WEB_PUBLIC_CRW_NAVIGATION_ITEM_STORAGE_H_ | 71 #endif // IOS_WEB_PUBLIC_CRW_NAVIGATION_ITEM_STORAGE_H_ |
OLD | NEW |