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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // Deleting the ScopedVector will also delete its elements. | 239 // Deleting the ScopedVector will also delete its elements. |
240 delete commands; | 240 delete commands; |
241 } | 241 } |
242 | 242 |
243 void SessionBackend::ReadLastSessionCommands( | 243 void SessionBackend::ReadLastSessionCommands( |
244 const base::CancelableTaskTracker::IsCanceledCallback& is_canceled, | 244 const base::CancelableTaskTracker::IsCanceledCallback& is_canceled, |
245 const BaseSessionService::InternalGetCommandsCallback& callback) { | 245 const BaseSessionService::GetCommandsCallback& callback) { |
246 if (is_canceled.Run()) | 246 if (is_canceled.Run()) |
247 return; | 247 return; |
248 | 248 |
249 Init(); | 249 Init(); |
250 | 250 |
251 ScopedVector<SessionCommand> commands; | 251 ScopedVector<SessionCommand> commands; |
252 ReadLastSessionCommandsImpl(&commands); | 252 ReadLastSessionCommandsImpl(&commands); |
253 callback.Run(commands.Pass()); | 253 callback.Run(commands.Pass()); |
254 } | 254 } |
255 | 255 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 } | 395 } |
396 | 396 |
397 base::FilePath SessionBackend::GetCurrentSessionPath() { | 397 base::FilePath SessionBackend::GetCurrentSessionPath() { |
398 base::FilePath path = path_to_dir_; | 398 base::FilePath path = path_to_dir_; |
399 if (type_ == BaseSessionService::TAB_RESTORE) | 399 if (type_ == BaseSessionService::TAB_RESTORE) |
400 path = path.AppendASCII(kCurrentTabSessionFileName); | 400 path = path.AppendASCII(kCurrentTabSessionFileName); |
401 else | 401 else |
402 path = path.AppendASCII(kCurrentSessionFileName); | 402 path = path.AppendASCII(kCurrentSessionFileName); |
403 return path; | 403 return path; |
404 } | 404 } |
OLD | NEW |