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

Side by Side Diff: base/file_util.cc

Issue 24616002: Clean up a few unused globals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win Created 7 years, 2 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
« no previous file with comments | « no previous file | base/file_util_unittest.cc » ('j') | chrome/common/chrome_paths.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/file_util.h" 5 #include "base/file_util.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <io.h> 8 #include <io.h>
9 #endif 9 #endif
10 #include <stdio.h> 10 #include <stdio.h>
11 11
12 #include <fstream> 12 #include <fstream>
13 13
14 #include "base/files/file_enumerator.h" 14 #include "base/files/file_enumerator.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/strings/string_piece.h" 17 #include "base/strings/string_piece.h"
18 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
19 #include "base/strings/stringprintf.h" 19 #include "base/strings/stringprintf.h"
20 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
21 21
22 namespace base { 22 namespace base {
23 23
24 namespace { 24 namespace {
25 25
26 const FilePath::CharType kExtensionSeparator = FILE_PATH_LITERAL('.');
27
28 // The maximum number of 'uniquified' files we will try to create. 26 // The maximum number of 'uniquified' files we will try to create.
29 // This is used when the filename we're trying to download is already in use, 27 // This is used when the filename we're trying to download is already in use,
30 // so we create a new unique filename by appending " (nnn)" before the 28 // so we create a new unique filename by appending " (nnn)" before the
31 // extension, where 1 <= nnn <= kMaxUniqueFiles. 29 // extension, where 1 <= nnn <= kMaxUniqueFiles.
32 // Also used by code that cleans up said files. 30 // Also used by code that cleans up said files.
33 static const int kMaxUniqueFiles = 100; 31 static const int kMaxUniqueFiles = 100;
34 32
35 } // namespace 33 } // namespace
36 34
37 bool g_bug108724_debug = false; 35 bool g_bug108724_debug = false;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 148 }
151 149
152 } // namespace base 150 } // namespace base
153 151
154 // ----------------------------------------------------------------------------- 152 // -----------------------------------------------------------------------------
155 153
156 namespace file_util { 154 namespace file_util {
157 155
158 using base::FileEnumerator; 156 using base::FileEnumerator;
159 using base::FilePath; 157 using base::FilePath;
160 using base::kExtensionSeparator;
161 using base::kMaxUniqueFiles; 158 using base::kMaxUniqueFiles;
162 159
163 bool IsDirectoryEmpty(const FilePath& dir_path) { 160 bool IsDirectoryEmpty(const FilePath& dir_path) {
164 FileEnumerator files(dir_path, false, 161 FileEnumerator files(dir_path, false,
165 FileEnumerator::FILES | FileEnumerator::DIRECTORIES); 162 FileEnumerator::FILES | FileEnumerator::DIRECTORIES);
166 if (files.Next().empty()) 163 if (files.Next().empty())
167 return true; 164 return true;
168 return false; 165 return false;
169 } 166 }
170 167
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 if (!PathExists(new_path) && 252 if (!PathExists(new_path) &&
256 (!have_suffix || !PathExists(FilePath(new_path.value() + suffix)))) { 253 (!have_suffix || !PathExists(FilePath(new_path.value() + suffix)))) {
257 return count; 254 return count;
258 } 255 }
259 } 256 }
260 257
261 return -1; 258 return -1;
262 } 259 }
263 260
264 } // namespace file_util 261 } // namespace file_util
OLDNEW
« no previous file with comments | « no previous file | base/file_util_unittest.cc » ('j') | chrome/common/chrome_paths.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698