1 // Copyright 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.
5 #ifndef IOS_WEB_NAVIGATION_CRW_SESSION_ENTRY_H_
6 #define IOS_WEB_NAVIGATION_CRW_SESSION_ENTRY_H_
8 #import <Foundation/Foundation.h>
10 #include "base/memory/scoped_ptr.h"
11 #include "base/strings/string16.h"
12 #include "base/time/time.h"
13 #include "ui/base/page_transition_types.h"
18 class NavigationItemImpl
;
21 // Keys used to serialize web::PageScrollState properties.
22 extern NSString
* const kSessionEntryPageScrollStateKey
;
23 extern NSString
* const kSessionEntryScrollOffsetXKey
;
24 extern NSString
* const kSessionEntryScrollOffsetYKey
;
25 extern NSString
* const kSessionEntryMinimumZoomScaleKey
;
26 extern NSString
* const kSessionEntryMaximumZoomScaleKey
;
27 extern NSString
* const kSessionEntryZoomScaleKey
;
29 // Keys used to serialize navigation properties.
31 // Current URL (std::string).
32 extern NSString
* const kSessionEntryURLKey
;
33 // Current URL. Deprecated, used for backward compatibility (NSURL).
34 extern NSString
* const kSessionEntryURLDeperecatedKey
;
35 // Page referrer URL (std::string).
36 extern NSString
* const kSessionEntryReferrerURLKey
;
37 // Page referrer URL (NSURL). Deprecated, used for backward compatibility.
38 extern NSString
* const kSessionEntryReferrerURLDeprecatedKey
;
39 // Page referrer policy (int).
40 extern NSString
* const kSessionEntryReferrerPolicyKey
;
41 // The time at which the last known local navigation has completed (int64_t).
42 extern NSString
* const kSessionEntryTimestampKey
;
43 // Page title (NSString).
44 extern NSString
* const kSessionEntryTitleKey
;
45 // POST request data (NSData).
46 extern NSString
* const kSessionEntryPOSTDataKey
;
47 // HTTP request headers (NSDictionary).
48 extern NSString
* const kSessionEntryHTTPRequestHeadersKey
;
49 // Whether or not to bypass showing the resubmit data confirmation when loading
50 // a POST request (BOOL).
51 extern NSString
* const kSessionEntrySkipResubmitConfirmationKey
;
52 // Should desktop user agent be used (BOOL)?
53 extern NSString
* const kSessionEntryUseDesktopUserAgentKey
;
56 // A CRWSessionEntry is similar to a NavigationEntry object in desktop Chrome.
57 // It maintains the information needed to save/restore a single entry in session
58 // history (i.e., one site) for a tab. A tab may have multiple of these objects
59 // comprising its entire session history.
60 // TODO(rohitrao): Fold CRWSessionEntry's logic into NavigationItem.
61 @interface CRWSessionEntry
: NSObject
<NSCoding
, NSCopying
>
63 @
property(nonatomic
, readonly
) const GURL
& originalUrl
;
65 // Pointer to the NavigationItem associated with this CRWSessionEntry.
66 // Eventually, this will replace CRWSessionEntry entirely.
67 @
property(nonatomic
, readonly
) web::NavigationItem
* navigationItem
;
69 // Pointer to the NavigationItemImpl associated with this CRWSessionEntry.
70 // TODO(kkhorimoto): This is a convenience property to avoid requiring static
71 // casts every time the web layer needs access to members only available in
72 // NavigationItemImpl. Remove once more navigation management moves into
73 // NavigationManager and CRWSessionEntry=>web::NavigationItemImpl conversions
74 // become less prominent.
75 @
property(nonatomic
, readonly
) web::NavigationItemImpl
* navigationItemImpl
;
77 // Initialize the session entry with the given NavigationItem.
78 - (instancetype
)initWithNavigationItem
:(scoped_ptr
<web::NavigationItem
>)item
;
82 #endif // IOS_WEB_NAVIGATION_CRW_SESSION_ENTRY_H_