| OLD | NEW |
| 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" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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:[CRWSessionStorage class] | 214 [SessionWindowUnarchiver setClass:[CRWSessionStorage class] |
| 215 forClassName:@"SessionController"]; | 215 forClassName:@"SessionController"]; |
| 216 [SessionWindowUnarchiver setClass:[CRWSessionStorage class] | 216 [SessionWindowUnarchiver setClass:[CRWSessionStorage class] |
| 217 forClassName:@"CRWSessionController"]; | 217 forClassName:@"CRWSessionController"]; |
| 218 [SessionWindowUnarchiver setClass:[CRWSessionStorage class] |
| 219 forClassName:@"CRWNavigationManagerStorage"]; |
| 218 [SessionWindowUnarchiver setClass:[CRWNavigationItemStorage class] | 220 [SessionWindowUnarchiver setClass:[CRWNavigationItemStorage class] |
| 219 forClassName:@"SessionEntry"]; | 221 forClassName:@"SessionEntry"]; |
| 220 [SessionWindowUnarchiver setClass:[CRWNavigationItemStorage class] | 222 [SessionWindowUnarchiver setClass:[CRWNavigationItemStorage class] |
| 221 forClassName:@"CRWSessionEntry"]; | 223 forClassName:@"CRWSessionEntry"]; |
| 222 // TODO(crbug.com/661633): Remove this hack. | 224 // TODO(crbug.com/661633): Remove this hack. |
| 223 [SessionWindowUnarchiver setClass:[SessionWindowIOS class] | 225 [SessionWindowUnarchiver setClass:[SessionWindowIOS class] |
| 224 forClassName:@"SessionWindow"]; | 226 forClassName:@"SessionWindow"]; |
| 225 SessionWindowIOS* window = nil; | 227 SessionWindowIOS* window = nil; |
| 226 @try { | 228 @try { |
| 227 NSData* data = [NSData dataWithContentsOfFile:path]; | 229 NSData* data = [NSData dataWithContentsOfFile:path]; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 246 base::ThreadRestrictions::AssertIOAllowed(); | 248 base::ThreadRestrictions::AssertIOAllowed(); |
| 247 NSFileManager* fileManager = [NSFileManager defaultManager]; | 249 NSFileManager* fileManager = [NSFileManager defaultManager]; |
| 248 if (![fileManager fileExistsAtPath:sessionFile]) | 250 if (![fileManager fileExistsAtPath:sessionFile]) |
| 249 return; | 251 return; |
| 250 if (![fileManager removeItemAtPath:sessionFile error:nil]) | 252 if (![fileManager removeItemAtPath:sessionFile error:nil]) |
| 251 CHECK(false) << "Unable to delete session file."; | 253 CHECK(false) << "Unable to delete session file."; |
| 252 })); | 254 })); |
| 253 } | 255 } |
| 254 | 256 |
| 255 @end | 257 @end |
| OLD | NEW |