| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/sessions/session_backend.h" | 5 #include "chrome/browser/sessions/session_backend.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // Need to check current_session_file_ again, ResetFile may fail. | 233 // Need to check current_session_file_ again, ResetFile may fail. |
| 234 if (current_session_file_.get() && current_session_file_->IsValid() && | 234 if (current_session_file_.get() && current_session_file_->IsValid() && |
| 235 !AppendCommandsToFile(current_session_file_.get(), commands)) { | 235 !AppendCommandsToFile(current_session_file_.get(), commands)) { |
| 236 current_session_file_.reset(NULL); | 236 current_session_file_.reset(NULL); |
| 237 } | 237 } |
| 238 empty_file_ = false; | 238 empty_file_ = false; |
| 239 } | 239 } |
| 240 | 240 |
| 241 void SessionBackend::ReadLastSessionCommands( | 241 void SessionBackend::ReadLastSessionCommands( |
| 242 const base::CancelableTaskTracker::IsCanceledCallback& is_canceled, | 242 const base::CancelableTaskTracker::IsCanceledCallback& is_canceled, |
| 243 const BaseSessionService::InternalGetCommandsCallback& callback) { | 243 const BaseSessionService::GetCommandsCallback& callback) { |
| 244 if (is_canceled.Run()) | 244 if (is_canceled.Run()) |
| 245 return; | 245 return; |
| 246 | 246 |
| 247 Init(); | 247 Init(); |
| 248 | 248 |
| 249 ScopedVector<SessionCommand> commands; | 249 ScopedVector<SessionCommand> commands; |
| 250 ReadLastSessionCommandsImpl(&commands); | 250 ReadLastSessionCommandsImpl(&commands); |
| 251 callback.Run(commands.Pass()); | 251 callback.Run(commands.Pass()); |
| 252 } | 252 } |
| 253 | 253 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 } | 393 } |
| 394 | 394 |
| 395 base::FilePath SessionBackend::GetCurrentSessionPath() { | 395 base::FilePath SessionBackend::GetCurrentSessionPath() { |
| 396 base::FilePath path = path_to_dir_; | 396 base::FilePath path = path_to_dir_; |
| 397 if (type_ == BaseSessionService::TAB_RESTORE) | 397 if (type_ == BaseSessionService::TAB_RESTORE) |
| 398 path = path.AppendASCII(kCurrentTabSessionFileName); | 398 path = path.AppendASCII(kCurrentTabSessionFileName); |
| 399 else | 399 else |
| 400 path = path.AppendASCII(kCurrentSessionFileName); | 400 path = path.AppendASCII(kCurrentSessionFileName); |
| 401 return path; | 401 return path; |
| 402 } | 402 } |
| OLD | NEW |