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

Unified Diff: ios/shared/chrome/browser/tabs/web_state_list_serialisation.h

Issue 2771863002: [ios] Add free function to (de)serialise WebStateList. (Closed)
Patch Set: Created 3 years, 9 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/shared/chrome/browser/tabs/web_state_list_serialisation.h
diff --git a/ios/shared/chrome/browser/tabs/web_state_list_serialisation.h b/ios/shared/chrome/browser/tabs/web_state_list_serialisation.h
new file mode 100644
index 0000000000000000000000000000000000000000..d03c99f5cb82a66324f11dad2c01ae048c4a32a9
--- /dev/null
+++ b/ios/shared/chrome/browser/tabs/web_state_list_serialisation.h
@@ -0,0 +1,27 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_SERIALISATION_H_
+#define IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_SERIALISATION_H_
+
+#import <Foundation/Foundation.h>
+
+#import "ios/web/public/web_state/web_state.h"
marq (ping after 24h) 2017/03/24 10:37:17 I'm sure you've explained this already, but assume
sdefresne 2017/03/27 16:14:44 Two reasons: 1. on desktop, those are not methods
marq (ping after 24h) 2017/03/28 15:47:24 I'm not sure I find the first two reasons compelli
+
+@class CRWSessionStorage;
+class WebStateList;
+
+// Returns an array of serialised sessions.
+// TODO(sdefresne): add unit tests.
+NSArray<CRWSessionStorage*>* SerializeWebStateList(
+ WebStateList* web_state_list);
+
+// Restores serialised sessions into the specified WebStateList. Returns the
+// number of WebStates restored.
marq (ping after 24h) 2017/03/24 10:37:17 Prefer comments that explicitly name parameters:
sdefresne 2017/03/27 16:14:44 Done.
+// TODO(sdefresne): add unit tests.
+int DeserializeWebStateListFrom(WebStateList* web_state_list,
marq (ping after 24h) 2017/03/24 10:37:17 Is the return value just a convenience, or is it a
marq (ping after 24h) 2017/03/24 10:37:17 Naming nit: If you're going to use a preposition a
sdefresne 2017/03/27 16:14:44 Dropped "From".
sdefresne 2017/03/27 16:14:44 For convenience. Removed.
+ web::WebState::CreateParams params,
+ NSArray<CRWSessionStorage*>* sessions);
+
+#endif // IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_SERIALISATION_H_

Powered by Google App Engine
This is Rietveld 408576698