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/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 if (current_session_file_.get() && current_session_file_->IsOpen() && | 237 if (current_session_file_.get() && current_session_file_->IsOpen() && |
238 !AppendCommandsToFile(current_session_file_.get(), *commands)) { | 238 !AppendCommandsToFile(current_session_file_.get(), *commands)) { |
239 current_session_file_.reset(NULL); | 239 current_session_file_.reset(NULL); |
240 } | 240 } |
241 empty_file_ = false; | 241 empty_file_ = false; |
242 STLDeleteElements(commands); | 242 STLDeleteElements(commands); |
243 delete commands; | 243 delete commands; |
244 } | 244 } |
245 | 245 |
246 void SessionBackend::ReadLastSessionCommands( | 246 void SessionBackend::ReadLastSessionCommands( |
247 const CancelableTaskTracker::IsCanceledCallback& is_canceled, | 247 const base::CancelableTaskTracker::IsCanceledCallback& is_canceled, |
248 const BaseSessionService::InternalGetCommandsCallback& callback) { | 248 const BaseSessionService::InternalGetCommandsCallback& callback) { |
249 if (is_canceled.Run()) | 249 if (is_canceled.Run()) |
250 return; | 250 return; |
251 | 251 |
252 Init(); | 252 Init(); |
253 | 253 |
254 ScopedVector<SessionCommand> commands; | 254 ScopedVector<SessionCommand> commands; |
255 ReadLastSessionCommandsImpl(&(commands.get())); | 255 ReadLastSessionCommandsImpl(&(commands.get())); |
256 callback.Run(commands.Pass()); | 256 callback.Run(commands.Pass()); |
257 } | 257 } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 } | 398 } |
399 | 399 |
400 base::FilePath SessionBackend::GetCurrentSessionPath() { | 400 base::FilePath SessionBackend::GetCurrentSessionPath() { |
401 base::FilePath path = path_to_dir_; | 401 base::FilePath path = path_to_dir_; |
402 if (type_ == BaseSessionService::TAB_RESTORE) | 402 if (type_ == BaseSessionService::TAB_RESTORE) |
403 path = path.AppendASCII(kCurrentTabSessionFileName); | 403 path = path.AppendASCII(kCurrentTabSessionFileName); |
404 else | 404 else |
405 path = path.AppendASCII(kCurrentSessionFileName); | 405 path = path.AppendASCII(kCurrentSessionFileName); |
406 return path; | 406 return path; |
407 } | 407 } |
OLD | NEW |