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

Side by Side Diff: ios/chrome/browser/sessions/session_service.mm

Issue 2687353003: Created SerializableUserDataManager. (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
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 #import "ios/chrome/browser/sessions/session_service.h" 5 #import "ios/chrome/browser/sessions/session_service.h"
6 6
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/mac/bind_objc_block.h" 12 #include "base/mac/bind_objc_block.h"
13 #include "base/mac/foundation_util.h" 13 #include "base/mac/foundation_util.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/sequenced_task_runner.h" 15 #include "base/sequenced_task_runner.h"
16 #include "base/strings/sys_string_conversions.h" 16 #include "base/strings/sys_string_conversions.h"
17 #include "base/synchronization/lock.h" 17 #include "base/synchronization/lock.h"
18 #include "base/threading/sequenced_worker_pool.h" 18 #include "base/threading/sequenced_worker_pool.h"
19 #include "base/threading/thread_restrictions.h" 19 #include "base/threading/thread_restrictions.h"
20 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 20 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
21 #import "ios/chrome/browser/sessions/session_window.h" 21 #import "ios/chrome/browser/sessions/session_window.h"
22 #import "ios/web/navigation/crw_session_certificate_policy_manager.h" 22 #import "ios/web/navigation/crw_session_certificate_policy_manager.h"
23 #import "ios/web/public/crw_navigation_item_storage.h" 23 #import "ios/web/public/crw_navigation_item_storage.h"
24 #import "ios/web/public/crw_navigation_manager_storage.h" 24 #import "ios/web/public/crw_session_storage.h"
25 #include "ios/web/public/web_thread.h" 25 #include "ios/web/public/web_thread.h"
26 26
27 // When C++ exceptions are disabled, the C++ library defines |try| and 27 // When C++ exceptions are disabled, the C++ library defines |try| and
28 // |catch| so as to allow exception-expecting C++ code to build properly when 28 // |catch| so as to allow exception-expecting C++ code to build properly when
29 // language support for exceptions is not present. These macros interfere 29 // language support for exceptions is not present. These macros interfere
30 // with the use of |@try| and |@catch| in Objective-C files such as this one. 30 // with the use of |@try| and |@catch| in Objective-C files such as this one.
31 // Undefine these macros here, after everything has been #included, since 31 // Undefine these macros here, after everything has been #included, since
32 // there will be no C++ uses and only Objective-C uses from this point on. 32 // there will be no C++ uses and only Objective-C uses from this point on.
33 #undef try 33 #undef try
34 #undef catch 34 #undef catch
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 forBrowserState:browserState]; 204 forBrowserState:browserState];
205 return window; 205 return window;
206 } 206 }
207 207
208 - (SessionWindowIOS*)loadWindowFromPath:(NSString*)path 208 - (SessionWindowIOS*)loadWindowFromPath:(NSString*)path
209 forBrowserState:(ios::ChromeBrowserState*)browserState { 209 forBrowserState:(ios::ChromeBrowserState*)browserState {
210 // HACK: Handle the case where we had to change the class name of a persisted 210 // HACK: Handle the case where we had to change the class name of a persisted
211 // class on disk. 211 // class on disk.
212 [SessionWindowUnarchiver setClass:[CRWSessionCertificatePolicyManager class] 212 [SessionWindowUnarchiver setClass:[CRWSessionCertificatePolicyManager class]
213 forClassName:@"SessionCertificatePolicyManager"]; 213 forClassName:@"SessionCertificatePolicyManager"];
214 [SessionWindowUnarchiver setClass:[CRWNavigationManagerStorage class] 214 [SessionWindowUnarchiver setClass:[CRWSessionStorage class]
215 forClassName:@"SessionController"]; 215 forClassName:@"SessionController"];
216 [SessionWindowUnarchiver setClass:[CRWNavigationManagerStorage class] 216 [SessionWindowUnarchiver setClass:[CRWSessionStorage class]
217 forClassName:@"CRWSessionController"]; 217 forClassName:@"CRWSessionController"];
218 [SessionWindowUnarchiver setClass:[CRWNavigationItemStorage class] 218 [SessionWindowUnarchiver setClass:[CRWNavigationItemStorage class]
219 forClassName:@"SessionEntry"]; 219 forClassName:@"SessionEntry"];
220 [SessionWindowUnarchiver setClass:[CRWNavigationItemStorage class] 220 [SessionWindowUnarchiver setClass:[CRWNavigationItemStorage class]
221 forClassName:@"CRWSessionEntry"]; 221 forClassName:@"CRWSessionEntry"];
222 // TODO(crbug.com/661633): Remove this hack. 222 // TODO(crbug.com/661633): Remove this hack.
223 [SessionWindowUnarchiver setClass:[SessionWindowIOS class] 223 [SessionWindowUnarchiver setClass:[SessionWindowIOS class]
224 forClassName:@"SessionWindow"]; 224 forClassName:@"SessionWindow"];
225 SessionWindowIOS* window = nil; 225 SessionWindowIOS* window = nil;
226 @try { 226 @try {
(...skipping 19 matching lines...) Expand all
246 base::ThreadRestrictions::AssertIOAllowed(); 246 base::ThreadRestrictions::AssertIOAllowed();
247 NSFileManager* fileManager = [NSFileManager defaultManager]; 247 NSFileManager* fileManager = [NSFileManager defaultManager];
248 if (![fileManager fileExistsAtPath:sessionFile]) 248 if (![fileManager fileExistsAtPath:sessionFile])
249 return; 249 return;
250 if (![fileManager removeItemAtPath:sessionFile error:nil]) 250 if (![fileManager removeItemAtPath:sessionFile error:nil])
251 CHECK(false) << "Unable to delete session file."; 251 CHECK(false) << "Unable to delete session file.";
252 })); 252 }));
253 } 253 }
254 254
255 @end 255 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/crash_report/crash_restore_helper.mm ('k') | ios/chrome/browser/sessions/session_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698