Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: chrome/browser/sessions/session_backend.cc

Issue 18584011: Rename base::Delete to base::DeleteFile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 258
259 bool SessionBackend::ReadLastSessionCommandsImpl( 259 bool SessionBackend::ReadLastSessionCommandsImpl(
260 std::vector<SessionCommand*>* commands) { 260 std::vector<SessionCommand*>* commands) {
261 Init(); 261 Init();
262 SessionFileReader file_reader(GetLastSessionPath()); 262 SessionFileReader file_reader(GetLastSessionPath());
263 return file_reader.Read(type_, commands); 263 return file_reader.Read(type_, commands);
264 } 264 }
265 265
266 void SessionBackend::DeleteLastSession() { 266 void SessionBackend::DeleteLastSession() {
267 Init(); 267 Init();
268 base::Delete(GetLastSessionPath(), false); 268 base::DeleteFile(GetLastSessionPath(), false);
269 } 269 }
270 270
271 void SessionBackend::MoveCurrentSessionToLastSession() { 271 void SessionBackend::MoveCurrentSessionToLastSession() {
272 Init(); 272 Init();
273 current_session_file_.reset(NULL); 273 current_session_file_.reset(NULL);
274 274
275 const base::FilePath current_session_path = GetCurrentSessionPath(); 275 const base::FilePath current_session_path = GetCurrentSessionPath();
276 const base::FilePath last_session_path = GetLastSessionPath(); 276 const base::FilePath last_session_path = GetLastSessionPath();
277 if (base::PathExists(last_session_path)) 277 if (base::PathExists(last_session_path))
278 base::Delete(last_session_path, false); 278 base::DeleteFile(last_session_path, false);
279 if (base::PathExists(current_session_path)) { 279 if (base::PathExists(current_session_path)) {
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_ = base::Move(current_session_path, last_session_path); 290 last_session_valid_ = base::Move(current_session_path, last_session_path);
291 } 291 }
292 292
293 if (base::PathExists(current_session_path)) 293 if (base::PathExists(current_session_path))
294 base::Delete(current_session_path, false); 294 base::DeleteFile(current_session_path, false);
295 295
296 // Create and open the file for the current session. 296 // Create and open the file for the current session.
297 ResetFile(); 297 ResetFile();
298 } 298 }
299 299
300 bool SessionBackend::ReadCurrentSessionCommandsImpl( 300 bool SessionBackend::ReadCurrentSessionCommandsImpl(
301 std::vector<SessionCommand*>* commands) { 301 std::vector<SessionCommand*>* commands) {
302 Init(); 302 Init();
303 SessionFileReader file_reader(GetCurrentSessionPath()); 303 SessionFileReader file_reader(GetCurrentSessionPath());
304 return file_reader.Read(type_, commands); 304 return file_reader.Read(type_, commands);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_store_file.cc ('k') | chrome/browser/shell_integration_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698