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"
21 // A CRWSessionEntry is similar to a NavigationEntry object in desktop Chrome.
22 // It maintains the information needed to save/restore a single entry in session
23 // history (i.e., one site) for a tab. A tab may have multiple of these objects
24 // comprising its entire session history.
25 // TODO(rohitrao): Fold CRWSessionEntry's logic into NavigationItem.
26 @interface CRWSessionEntry
: NSObject
<NSCoding
, NSCopying
>
28 @
property(nonatomic
, assign
) NSInteger index
;
29 @
property(nonatomic
, readonly
) const GURL
& originalUrl
;
30 @
property(nonatomic
, assign
) BOOL useDesktopUserAgent
;
31 @
property(nonatomic
, assign
) BOOL usedDataReductionProxy
;
32 @
property(nonatomic
, retain
) NSString
* serializedStateObject
;
33 @
property(nonatomic
, assign
) BOOL createdFromPushState
;
34 @
property(nonatomic
, retain
) NSData
* POSTData
;
35 @
property(nonatomic
, readonly
) NSDictionary
* httpHeaders
;
36 @
property(nonatomic
, assign
) BOOL skipResubmitDataConfirmation
;
38 // Initialize the session entry with the given url.
39 - (id
)initWithUrl
:(const GURL
&)url
40 referrer
:(const web::Referrer
&)referrer
41 transition
:(ui::PageTransition
)transition
42 useDesktopUserAgent
:(BOOL
)useDesktopUserAgent
43 rendererInitiated
:(BOOL
)rendererInitiated
;
45 // Initialize the session entry with the given NavigationItem.
46 - (id
)initWithNavigationItem
:(scoped_ptr
<web::NavigationItem
>)item
49 // Returns a pointer to the NavigationItem associated with this CRWSessionEntry.
50 // Eventually, this will replace CRWSessionEntry entirely.
51 - (web::NavigationItem
*)navigationItem
;
53 // Adds headers from |moreHTTPHeaders| to |httpHeaders|; existing headers with
54 // the same key will be overridden.
55 - (void)addHTTPHeaders
:(NSDictionary
*)moreHTTPHeaders
;
57 // Removes the header for the given key from |httpHeaders|.
58 - (void)removeHTTPHeaderForKey
:(NSString
*)key
;
60 // Resets |httpHeaders| to nil.
61 - (void)resetHTTPHeaders
;
65 #endif // IOS_WEB_NAVIGATION_CRW_SESSION_ENTRY_H_