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

Side by Side Diff: ios/chrome/browser/sessions/session_service_ios.h

Issue 2811593004: [ios] Allow having multiple session windows in a session. (Closed)
Patch Set: Address comments. Created 3 years, 8 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
OLDNEW
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_CHROME_BROWSER_SESSIONS_SESSION_SERVICE_IOS_H_ 5 #ifndef IOS_CHROME_BROWSER_SESSIONS_SESSION_SERVICE_IOS_H_
6 #define IOS_CHROME_BROWSER_SESSIONS_SESSION_SERVICE_IOS_H_ 6 #define IOS_CHROME_BROWSER_SESSIONS_SESSION_SERVICE_IOS_H_
7 7
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 9
10 #include "base/sequenced_task_runner.h" 10 #include "base/sequenced_task_runner.h"
11 11
12 @class SessionWindowIOS; 12 @class SessionIOS;
13 13
14 // A singleton service for saving the current session. Can either save on a 14 // A singleton service for saving the current session. Can either save on a
15 // delay or immediately. Saving is always performed on a separate thread. 15 // delay or immediately. Saving is always performed on a separate thread.
16 @interface SessionServiceIOS : NSObject 16 @interface SessionServiceIOS : NSObject
17 17
18 // Lazily creates a singleton instance with a default task runner. 18 // Lazily creates a singleton instance with a default task runner.
19 + (SessionServiceIOS*)sharedService; 19 + (SessionServiceIOS*)sharedService;
20 20
21 // Initializes a SessionServiceIOS with a given task runner. Prefer to use the 21 // Initializes a SessionServiceIOS with a given task runner. Prefer to use the
22 // |sharedService| method. 22 // |sharedService| method.
23 - (instancetype)initWithTaskRunner: 23 - (instancetype)initWithTaskRunner:
24 (const scoped_refptr<base::SequencedTaskRunner>&)taskRunner 24 (const scoped_refptr<base::SequencedTaskRunner>&)taskRunner
25 NS_DESIGNATED_INITIALIZER; 25 NS_DESIGNATED_INITIALIZER;
26 26
27 // Saves the session represented by |sessionWindow| to |directory| on disk. If 27 // Saves the session represented by |session| to |directory|. If |immediately|
28 // |immediately| is NO, the save is done after a delay. If another call is 28 // is NO, the save is done after a delay. If another call is pending, this one
29 // pending, this one is ignored. If YES, the save is done now, cancelling any 29 // is ignored. If YES, the save is done now, cancelling any pending calls.
30 // pending calls. Either way, the save is done on a separate thread to avoid 30 // Either way, the save is done on a separate thread to avoid blocking the UI
31 // blocking the UI thread. 31 // thread.
32 - (void)saveSessionWindow:(SessionWindowIOS*)sessionWindow 32 - (void)saveSession:(SessionIOS*)sessionWindow
33 directory:(NSString*)directory 33 directory:(NSString*)directory
34 immediately:(BOOL)immediately; 34 immediately:(BOOL)immediately;
35 35
36 // Loads the session window from default session file in |directory| on the 36 // Loads the session from default session file in |directory| on the main
37 // main thread. Returns nil in case of errors. 37 // thread. Returns nil in case of errors.
38 - (SessionWindowIOS*)loadSessionWindowFromDirectory:(NSString*)directory; 38 - (SessionIOS*)loadSessionFromDirectory:(NSString*)directory;
39 39
40 // Loads the session window from |sessionPath| on the main thread. Returns nil 40 // Loads the session from |sessionPath| on the main thread. Returns nil in case
41 // in case of errors. 41 // of errors.
42 - (SessionWindowIOS*)loadSessionWindowFromPath:(NSString*)sessionPath; 42 - (SessionIOS*)loadSessionFromPath:(NSString*)sessionPath;
43 43
44 // Schedules deletion of the file containing the last session in |directory|. 44 // Schedules deletion of the file containing the last session in |directory|.
45 - (void)deleteLastSessionFileInDirectory:(NSString*)directory; 45 - (void)deleteLastSessionFileInDirectory:(NSString*)directory;
46 46
47 // Returns the path of the session file for |directory|. 47 // Returns the path of the session file for |directory|.
48 + (NSString*)sessionPathForDirectory:(NSString*)directory; 48 + (NSString*)sessionPathForDirectory:(NSString*)directory;
49 49
50 @end 50 @end
51 51
52 @interface SessionServiceIOS (SubClassing) 52 @interface SessionServiceIOS (SubClassing)
53 53
54 // For some of the unit tests, we need to make sure the session is saved 54 // For some of the unit tests, we need to make sure the session is saved
55 // immediately so we can read it back in to verify various attributes. This 55 // immediately so we can read it back in to verify various attributes. This
56 // is not a situation we normally expect to be in because we never 56 // is not a situation we normally expect to be in because we never
57 // want the session being saved on the main thread in the production app. 57 // want the session being saved on the main thread in the production app.
58 - (void)performSaveSessionData:(NSData*)sessionData 58 - (void)performSaveSessionData:(NSData*)sessionData
59 sessionPath:(NSString*)sessionPath; 59 sessionPath:(NSString*)sessionPath;
60 60
61 @end 61 @end
62 62
63 #endif // IOS_CHROME_BROWSER_SESSIONS_SESSION_SERVICE_IOS_H_ 63 #endif // IOS_CHROME_BROWSER_SESSIONS_SESSION_SERVICE_IOS_H_
OLDNEW
« no previous file with comments | « ios/chrome/browser/sessions/session_ios.mm ('k') | ios/chrome/browser/sessions/session_service_ios.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698