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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 // NOTE: this is invoked on the main thread, don't do file access here. | 211 // NOTE: this is invoked on the main thread, don't do file access here. |
212 } | 212 } |
213 | 213 |
214 void SessionBackend::Init() { | 214 void SessionBackend::Init() { |
215 if (inited_) | 215 if (inited_) |
216 return; | 216 return; |
217 | 217 |
218 inited_ = true; | 218 inited_ = true; |
219 | 219 |
220 // Create the directory for session info. | 220 // Create the directory for session info. |
221 file_util::CreateDirectory(path_to_dir_); | 221 base::CreateDirectory(path_to_dir_); |
222 | 222 |
223 MoveCurrentSessionToLastSession(); | 223 MoveCurrentSessionToLastSession(); |
224 } | 224 } |
225 | 225 |
226 void SessionBackend::AppendCommands( | 226 void SessionBackend::AppendCommands( |
227 std::vector<SessionCommand*>* commands, | 227 std::vector<SessionCommand*>* commands, |
228 bool reset_first) { | 228 bool reset_first) { |
229 Init(); | 229 Init(); |
230 // Make sure and check current_session_file_, if opening the file failed | 230 // Make sure and check current_session_file_, if opening the file failed |
231 // current_session_file_ will be NULL. | 231 // current_session_file_ will be NULL. |
(...skipping 166 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 |