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

Unified Diff: ios/web/public/web_state/page_display_state.h

Issue 2664113003: Moved serialization out of CRWSessionEntry. (Closed)
Patch Set: BuildSerialization => BuildStorage, entries => itemStorages Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ios/web/public/web_state/page_display_state.h
diff --git a/ios/web/public/web_state/page_display_state.h b/ios/web/public/web_state/page_display_state.h
index a9e8802092d56cce1ad84de47c218226f22a4a46..19fd0638aed31e5160edfc71e0a9dd6955269a58 100644
--- a/ios/web/public/web_state/page_display_state.h
+++ b/ios/web/public/web_state/page_display_state.h
@@ -5,6 +5,8 @@
#ifndef IOS_WEB_PUBLIC_WEB_STATE_PAGE_DISPLAY_STATE_H_
#define IOS_WEB_PUBLIC_WEB_STATE_PAGE_DISPLAY_STATE_H_
+#import <Foundation/Foundation.h>
Eugene But (OOO till 7-30) 2017/02/03 01:52:34 This changes the header to Objective-C, so please
kkhorimoto 2017/02/03 02:47:23 Done.
+
namespace web {
// Class used to represent the scrolling offset of a webview.
@@ -29,6 +31,10 @@ class PageScrollState {
bool operator==(const PageScrollState& other) const;
bool operator!=(const PageScrollState& other) const;
+ // Serialization keys.
+ static NSString* XOffsetKey();
Eugene But (OOO till 7-30) 2017/02/03 01:52:34 Should these keys be constants, like all other key
kkhorimoto 2017/02/03 02:47:23 Done.
+ static NSString* YOffsetKey();
+
private:
// The x value of the page's UIScrollView contentOffset.
double offset_x_;
@@ -74,6 +80,11 @@ class PageZoomState {
bool operator==(const PageZoomState& other) const;
bool operator!=(const PageZoomState& other) const;
+ // Serialization keys.
+ static NSString* MinZoomKey();
+ static NSString* MaxZoomKey();
+ static NSString* ZoomKey();
+
private:
// The minimumZoomScale value of the page's UIScrollView.
double minimum_zoom_scale_;
@@ -96,6 +107,7 @@ class PageDisplayState {
double minimum_zoom_scale,
double maximum_zoom_scale,
double zoom_scale);
+ PageDisplayState(NSDictionary* serialization);
~PageDisplayState();
// PageScrollStates cannot be applied until the scroll offset and zoom scale
@@ -118,6 +130,12 @@ class PageDisplayState {
bool operator==(const PageDisplayState& other) const;
bool operator!=(const PageDisplayState& other) const;
+ // Returns a serialized representation of the PageDisplayState.
+ NSDictionary* GetSerialization() const;
Eugene But (OOO till 7-30) 2017/02/03 01:52:34 Could you please add tests for these new functions
kkhorimoto 2017/02/03 02:47:23 Done.
+
+ // Returns a description string for the PageDisplayState.
+ NSString* GetDescription() const;
+
private:
// The scroll state for the page's UIScrollView.
PageScrollState scroll_state_;

Powered by Google App Engine
This is Rietveld 408576698