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

Side by Side Diff: chrome/browser/download/download_path_reservation_tracker.cc

Issue 18286004: Move PathExists to base namespace. (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/download/download_path_reservation_tracker.h" 5 #include "chrome/browser/download/download_path_reservation_tracker.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 // Returns true if the given path is in use by any path reservation or the 90 // Returns true if the given path is in use by any path reservation or the
91 // file system. Called on the FILE thread. 91 // file system. Called on the FILE thread.
92 bool IsPathInUse(const base::FilePath& path) { 92 bool IsPathInUse(const base::FilePath& path) {
93 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 93 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
94 // If there is a reservation, then the path is in use. 94 // If there is a reservation, then the path is in use.
95 if (IsPathReserved(path)) 95 if (IsPathReserved(path))
96 return true; 96 return true;
97 97
98 // If the path exists in the file system, then the path is in use. 98 // If the path exists in the file system, then the path is in use.
99 if (file_util::PathExists(path)) 99 if (base::PathExists(path))
100 return true; 100 return true;
101 101
102 return false; 102 return false;
103 } 103 }
104 104
105 // Truncates path->BaseName() to make path->BaseName().value().size() <= limit. 105 // Truncates path->BaseName() to make path->BaseName().value().size() <= limit.
106 // - It keeps the extension as is. Only truncates the body part. 106 // - It keeps the extension as is. Only truncates the body part.
107 // - It secures the base filename length to be more than or equals to 107 // - It secures the base filename length to be more than or equals to
108 // kTruncatedNameLengthLowerbound. 108 // kTruncatedNameLengthLowerbound.
109 // If it was unable to shorten the name, returns false. 109 // If it was unable to shorten the name, returns false.
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 create_directory, 358 create_directory,
359 conflict_action, 359 conflict_action,
360 callback)); 360 callback));
361 } 361 }
362 362
363 // static 363 // static
364 bool DownloadPathReservationTracker::IsPathInUseForTesting( 364 bool DownloadPathReservationTracker::IsPathInUseForTesting(
365 const base::FilePath& path) { 365 const base::FilePath& path) {
366 return IsPathInUse(path); 366 return IsPathInUse(path);
367 } 367 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_browsertest.cc ('k') | chrome/browser/download/save_page_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698