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 "components/sessions/core/session_backend.h" | 5 #include "components/sessions/core/session_backend.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | |
9 #include <limits> | 8 #include <limits> |
| 9 #include <utility> |
10 | 10 |
11 #include "base/files/file.h" | 11 #include "base/files/file.h" |
12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
16 #include "base/threading/thread_restrictions.h" | 16 #include "base/threading/thread_restrictions.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 | 18 |
19 using base::TimeTicks; | 19 using base::TimeTicks; |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 void SessionBackend::ReadLastSessionCommands( | 247 void SessionBackend::ReadLastSessionCommands( |
248 const base::CancelableTaskTracker::IsCanceledCallback& is_canceled, | 248 const base::CancelableTaskTracker::IsCanceledCallback& is_canceled, |
249 const sessions::BaseSessionService::GetCommandsCallback& callback) { | 249 const sessions::BaseSessionService::GetCommandsCallback& callback) { |
250 if (is_canceled.Run()) | 250 if (is_canceled.Run()) |
251 return; | 251 return; |
252 | 252 |
253 Init(); | 253 Init(); |
254 | 254 |
255 ScopedVector<sessions::SessionCommand> commands; | 255 ScopedVector<sessions::SessionCommand> commands; |
256 ReadLastSessionCommandsImpl(&commands); | 256 ReadLastSessionCommandsImpl(&commands); |
257 callback.Run(commands.Pass()); | 257 callback.Run(std::move(commands)); |
258 } | 258 } |
259 | 259 |
260 bool SessionBackend::ReadLastSessionCommandsImpl( | 260 bool SessionBackend::ReadLastSessionCommandsImpl( |
261 ScopedVector<sessions::SessionCommand>* commands) { | 261 ScopedVector<sessions::SessionCommand>* commands) { |
262 Init(); | 262 Init(); |
263 SessionFileReader file_reader(GetLastSessionPath()); | 263 SessionFileReader file_reader(GetLastSessionPath()); |
264 return file_reader.Read(type_, commands); | 264 return file_reader.Read(type_, commands); |
265 } | 265 } |
266 | 266 |
267 void SessionBackend::DeleteLastSession() { | 267 void SessionBackend::DeleteLastSession() { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 base::FilePath SessionBackend::GetCurrentSessionPath() { | 402 base::FilePath SessionBackend::GetCurrentSessionPath() { |
403 base::FilePath path = path_to_dir_; | 403 base::FilePath path = path_to_dir_; |
404 if (type_ == sessions::BaseSessionService::TAB_RESTORE) | 404 if (type_ == sessions::BaseSessionService::TAB_RESTORE) |
405 path = path.AppendASCII(kCurrentTabSessionFileName); | 405 path = path.AppendASCII(kCurrentTabSessionFileName); |
406 else | 406 else |
407 path = path.AppendASCII(kCurrentSessionFileName); | 407 path = path.AppendASCII(kCurrentSessionFileName); |
408 return path; | 408 return path; |
409 } | 409 } |
410 | 410 |
411 } // namespace sessions | 411 } // namespace sessions |
OLD | NEW |