Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: ios/web/public/web_state/page_display_state.h

Issue 2664113003: Moved serialization out of CRWSessionEntry. (Closed)
Patch Set: Eugene's comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/web/public/navigation_item.h ('k') | ios/web/public/web_state/page_display_state.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_WEB_STATE_PAGE_DISPLAY_STATE_H_ 5 #ifndef IOS_WEB_PUBLIC_WEB_STATE_PAGE_DISPLAY_STATE_H_
6 #define IOS_WEB_PUBLIC_WEB_STATE_PAGE_DISPLAY_STATE_H_ 6 #define IOS_WEB_PUBLIC_WEB_STATE_PAGE_DISPLAY_STATE_H_
7 7
8 #import <Foundation/Foundation.h>
9
8 namespace web { 10 namespace web {
9 11
10 // Class used to represent the scrolling offset of a webview. 12 // Class used to represent the scrolling offset of a webview.
11 class PageScrollState { 13 class PageScrollState {
12 public: 14 public:
13 // Default constructor. Initializes scroll offsets to NAN. 15 // Default constructor. Initializes scroll offsets to NAN.
14 PageScrollState(); 16 PageScrollState();
15 // Constructor with initial values. 17 // Constructor with initial values.
16 PageScrollState(double offset_x, double offset_y); 18 PageScrollState(double offset_x, double offset_y);
17 ~PageScrollState(); 19 ~PageScrollState();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // Default constructor. Initializes scroll offsets and zoom scales to NAN. 91 // Default constructor. Initializes scroll offsets and zoom scales to NAN.
90 PageDisplayState(); 92 PageDisplayState();
91 // Constructor with initial values. 93 // Constructor with initial values.
92 PageDisplayState(const PageScrollState& scroll_state, 94 PageDisplayState(const PageScrollState& scroll_state,
93 const PageZoomState& zoom_state); 95 const PageZoomState& zoom_state);
94 PageDisplayState(double offset_x, 96 PageDisplayState(double offset_x,
95 double offset_y, 97 double offset_y,
96 double minimum_zoom_scale, 98 double minimum_zoom_scale,
97 double maximum_zoom_scale, 99 double maximum_zoom_scale,
98 double zoom_scale); 100 double zoom_scale);
101 PageDisplayState(NSDictionary* serialization);
99 ~PageDisplayState(); 102 ~PageDisplayState();
100 103
101 // PageScrollStates cannot be applied until the scroll offset and zoom scale 104 // PageScrollStates cannot be applied until the scroll offset and zoom scale
102 // are both valid. 105 // are both valid.
103 bool IsValid() const; 106 bool IsValid() const;
104 107
105 // Accessors. 108 // Accessors.
106 const PageScrollState& scroll_state() const { return scroll_state_; } 109 const PageScrollState& scroll_state() const { return scroll_state_; }
107 PageScrollState& scroll_state() { return scroll_state_; } 110 PageScrollState& scroll_state() { return scroll_state_; }
108 void set_scroll_state(const PageScrollState& scroll_state) { 111 void set_scroll_state(const PageScrollState& scroll_state) {
109 scroll_state_ = scroll_state; 112 scroll_state_ = scroll_state;
110 } 113 }
111 const PageZoomState& zoom_state() const { return zoom_state_; } 114 const PageZoomState& zoom_state() const { return zoom_state_; }
112 PageZoomState& zoom_state() { return zoom_state_; } 115 PageZoomState& zoom_state() { return zoom_state_; }
113 void set_zoom_state(const PageZoomState& zoom_state) { 116 void set_zoom_state(const PageZoomState& zoom_state) {
114 zoom_state_ = zoom_state; 117 zoom_state_ = zoom_state;
115 } 118 }
116 119
117 // Comparator operators. 120 // Comparator operators.
118 bool operator==(const PageDisplayState& other) const; 121 bool operator==(const PageDisplayState& other) const;
119 bool operator!=(const PageDisplayState& other) const; 122 bool operator!=(const PageDisplayState& other) const;
120 123
124 // Returns a serialized representation of the PageDisplayState.
125 NSDictionary* GetSerialization() const;
126
127 // Returns a description string for the PageDisplayState.
128 NSString* GetDescription() const;
129
121 private: 130 private:
122 // The scroll state for the page's UIScrollView. 131 // The scroll state for the page's UIScrollView.
123 PageScrollState scroll_state_; 132 PageScrollState scroll_state_;
124 // The zoom state for the page's UIScrollView. 133 // The zoom state for the page's UIScrollView.
125 PageZoomState zoom_state_; 134 PageZoomState zoom_state_;
126 }; 135 };
127 136
128 } // namespace web 137 } // namespace web
129 138
130 #endif // IOS_WEB_PUBLIC_WEB_STATE_PAGE_DISPLAY_STATE_H_ 139 #endif // IOS_WEB_PUBLIC_WEB_STATE_PAGE_DISPLAY_STATE_H_
OLDNEW
« no previous file with comments | « ios/web/public/navigation_item.h ('k') | ios/web/public/web_state/page_display_state.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698