| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 int64 file_size; | 280 int64 file_size; |
| 281 if (file_util::GetFileSize(current_session_path, &file_size)) { | 281 if (file_util::GetFileSize(current_session_path, &file_size)) { |
| 282 if (type_ == BaseSessionService::TAB_RESTORE) { | 282 if (type_ == BaseSessionService::TAB_RESTORE) { |
| 283 UMA_HISTOGRAM_COUNTS("TabRestore.last_session_file_size", | 283 UMA_HISTOGRAM_COUNTS("TabRestore.last_session_file_size", |
| 284 static_cast<int>(file_size / 1024)); | 284 static_cast<int>(file_size / 1024)); |
| 285 } else { | 285 } else { |
| 286 UMA_HISTOGRAM_COUNTS("SessionRestore.last_session_file_size", | 286 UMA_HISTOGRAM_COUNTS("SessionRestore.last_session_file_size", |
| 287 static_cast<int>(file_size / 1024)); | 287 static_cast<int>(file_size / 1024)); |
| 288 } | 288 } |
| 289 } | 289 } |
| 290 last_session_valid_ = file_util::Move(current_session_path, | 290 last_session_valid_ = base::Move(current_session_path, last_session_path); |
| 291 last_session_path); | |
| 292 } | 291 } |
| 293 | 292 |
| 294 if (file_util::PathExists(current_session_path)) | 293 if (file_util::PathExists(current_session_path)) |
| 295 base::Delete(current_session_path, false); | 294 base::Delete(current_session_path, false); |
| 296 | 295 |
| 297 // Create and open the file for the current session. | 296 // Create and open the file for the current session. |
| 298 ResetFile(); | 297 ResetFile(); |
| 299 } | 298 } |
| 300 | 299 |
| 301 bool SessionBackend::ReadCurrentSessionCommandsImpl( | 300 bool SessionBackend::ReadCurrentSessionCommandsImpl( |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 } | 398 } |
| 400 | 399 |
| 401 base::FilePath SessionBackend::GetCurrentSessionPath() { | 400 base::FilePath SessionBackend::GetCurrentSessionPath() { |
| 402 base::FilePath path = path_to_dir_; | 401 base::FilePath path = path_to_dir_; |
| 403 if (type_ == BaseSessionService::TAB_RESTORE) | 402 if (type_ == BaseSessionService::TAB_RESTORE) |
| 404 path = path.AppendASCII(kCurrentTabSessionFileName); | 403 path = path.AppendASCII(kCurrentTabSessionFileName); |
| 405 else | 404 else |
| 406 path = path.AppendASCII(kCurrentSessionFileName); | 405 path = path.AppendASCII(kCurrentSessionFileName); |
| 407 return path; | 406 return path; |
| 408 } | 407 } |
| OLD | NEW |