OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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_NAVIGATION_CRW_SESSION_ENTRY_H_ | 5 #ifndef IOS_WEB_NAVIGATION_CRW_SESSION_ENTRY_H_ |
6 #define IOS_WEB_NAVIGATION_CRW_SESSION_ENTRY_H_ | 6 #define IOS_WEB_NAVIGATION_CRW_SESSION_ENTRY_H_ |
7 | 7 |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
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 "ui/base/page_transition_types.h" | 13 #include "ui/base/page_transition_types.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 namespace web { | 16 namespace web { |
17 class NavigationItem; | 17 class NavigationItem; |
| 18 class NavigationItemImpl; |
18 struct Referrer; | 19 struct Referrer; |
19 } | 20 } |
20 | 21 |
21 // A CRWSessionEntry is similar to a NavigationEntry object in desktop Chrome. | 22 // 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 // 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 // history (i.e., one site) for a tab. A tab may have multiple of these objects |
24 // comprising its entire session history. | 25 // comprising its entire session history. |
25 // TODO(rohitrao): Fold CRWSessionEntry's logic into NavigationItem. | 26 // TODO(rohitrao): Fold CRWSessionEntry's logic into NavigationItem. |
26 @interface CRWSessionEntry : NSObject<NSCoding, NSCopying> | 27 @interface CRWSessionEntry : NSObject<NSCoding, NSCopying> |
27 | 28 |
28 @property(nonatomic, assign) NSInteger index; | |
29 @property(nonatomic, readonly) const GURL& originalUrl; | 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; | |
37 | 30 |
38 // Initialize the session entry with the given url. | 31 // Pointer to the NavigationItem associated with this CRWSessionEntry. |
39 - (id)initWithUrl:(const GURL&)url | 32 // Eventually, this will replace CRWSessionEntry entirely. |
40 referrer:(const web::Referrer&)referrer | 33 @property(nonatomic, readonly) web::NavigationItem* navigationItem; |
41 transition:(ui::PageTransition)transition | 34 |
42 useDesktopUserAgent:(BOOL)useDesktopUserAgent | 35 // Pointer to the NavigationItemImpl associated with this CRWSessionEntry. |
43 rendererInitiated:(BOOL)rendererInitiated; | 36 // TODO(kkhorimoto): This is a convenience property to avoid requiring static |
| 37 // casts every time the web layer needs access to members only available in |
| 38 // NavigationItemImpl. Remove once more navigation management moves into |
| 39 // NavigationManager and CRWSessionEntry=>web::NavigationItemImpl conversions |
| 40 // become less prominent. |
| 41 @property(nonatomic, readonly) web::NavigationItemImpl* navigationItemImpl; |
44 | 42 |
45 // Initialize the session entry with the given NavigationItem. | 43 // Initialize the session entry with the given NavigationItem. |
46 - (id)initWithNavigationItem:(scoped_ptr<web::NavigationItem>)item | 44 - (instancetype)initWithNavigationItem:(scoped_ptr<web::NavigationItem>)item; |
47 index:(int)index; | |
48 | |
49 // Returns a pointer to the NavigationItem associated with this CRWSessionEntry. | |
50 // Eventually, this will replace CRWSessionEntry entirely. | |
51 - (web::NavigationItem*)navigationItem; | |
52 | |
53 // Adds headers from |moreHTTPHeaders| to |httpHeaders|; existing headers with | |
54 // the same key will be overridden. | |
55 - (void)addHTTPHeaders:(NSDictionary*)moreHTTPHeaders; | |
56 | |
57 // Removes the header for the given key from |httpHeaders|. | |
58 - (void)removeHTTPHeaderForKey:(NSString*)key; | |
59 | |
60 // Resets |httpHeaders| to nil. | |
61 - (void)resetHTTPHeaders; | |
62 | 45 |
63 @end | 46 @end |
64 | 47 |
65 #endif // IOS_WEB_NAVIGATION_CRW_SESSION_ENTRY_H_ | 48 #endif // IOS_WEB_NAVIGATION_CRW_SESSION_ENTRY_H_ |
OLD | NEW |