| 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 #include "ios/chrome/browser/sessions/session_util.h" | 5 #include "ios/chrome/browser/sessions/session_util.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #import "ios/chrome/browser/sessions/session_service_ios.h" | 9 #import "ios/chrome/browser/sessions/session_service_ios.h" |
| 10 #include "ios/web/public/browser_state.h" | 10 #include "ios/web/public/browser_state.h" |
| 11 | 11 |
| 12 namespace session_util { | 12 namespace session_util { |
| 13 | 13 |
| 14 // Deletes the file containing the commands for the last session. | 14 // Deletes the file containing the commands for the last session. |
| 15 void DeleteLastSession(web::BrowserState* browser_state) { | 15 void DeleteLastSession(web::BrowserState* browser_state) { |
| 16 SessionServiceIOS* session_service = [SessionServiceIOS sharedService]; | 16 SessionServiceIOS* session_service = [SessionServiceIOS sharedService]; |
| 17 NSString* path = | 17 NSString* state_path = |
| 18 base::SysUTF8ToNSString(browser_state->GetStatePath().value()); | 18 base::SysUTF8ToNSString(browser_state->GetStatePath().AsUTF8Unsafe()); |
| 19 [session_service deleteLastSession:path]; | 19 NSString* session_path = [session_service sessionPathForDirectory:state_path]; |
| 20 [session_service deleteLastSessionAtPath:session_path]; |
| 20 } | 21 } |
| 21 | 22 |
| 22 } // namespace session_util | 23 } // namespace session_util |
| OLD | NEW |