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/chromeos/drive/file_system_util.h" | 5 #include "chrome/browser/chromeos/drive/file_system_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 DCHECK(IsStringUTF8(input)); | 316 DCHECK(IsStringUTF8(input)); |
317 | 317 |
318 std::string output; | 318 std::string output; |
319 if (!base::ConvertToUtf8AndNormalize(input, base::kCodepageUTF8, &output)) | 319 if (!base::ConvertToUtf8AndNormalize(input, base::kCodepageUTF8, &output)) |
320 output = input; | 320 output = input; |
321 ReplaceChars(output, kSlash, std::string(kEscapedSlash), &output); | 321 ReplaceChars(output, kSlash, std::string(kEscapedSlash), &output); |
322 return output; | 322 return output; |
323 } | 323 } |
324 | 324 |
325 void MigrateCacheFilesFromOldDirectories( | 325 void MigrateCacheFilesFromOldDirectories( |
326 const base::FilePath& cache_root_directory) { | 326 const base::FilePath& cache_root_directory, |
| 327 const base::FilePath::StringType& cache_file_directory_name) { |
327 const base::FilePath persistent_directory = | 328 const base::FilePath persistent_directory = |
328 cache_root_directory.AppendASCII("persistent"); | 329 cache_root_directory.AppendASCII("persistent"); |
329 const base::FilePath tmp_directory = | 330 const base::FilePath tmp_directory = |
330 cache_root_directory.AppendASCII("tmp"); | 331 cache_root_directory.AppendASCII("tmp"); |
331 if (!base::PathExists(persistent_directory)) | 332 if (!base::PathExists(persistent_directory)) |
332 return; | 333 return; |
333 | 334 |
334 const base::FilePath cache_file_directory = | 335 const base::FilePath cache_file_directory = |
335 cache_root_directory.Append(kCacheFileDirectory); | 336 cache_root_directory.Append(cache_file_directory_name); |
336 | 337 |
337 // Move all files inside "persistent" to "files". | 338 // Move all files inside "persistent" to "files". |
338 MoveAllFilesFromDirectory(persistent_directory, cache_file_directory); | 339 MoveAllFilesFromDirectory(persistent_directory, cache_file_directory); |
339 base::DeleteFile(persistent_directory, true /* recursive */); | 340 base::DeleteFile(persistent_directory, true /* recursive */); |
340 | 341 |
341 // Move all files inside "tmp" to "files". | 342 // Move all files inside "tmp" to "files". |
342 MoveAllFilesFromDirectory(tmp_directory, cache_file_directory); | 343 MoveAllFilesFromDirectory(tmp_directory, cache_file_directory); |
343 } | 344 } |
344 | 345 |
345 void PrepareWritableFileAndRun(Profile* profile, | 346 void PrepareWritableFileAndRun(Profile* profile, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 // Disable Drive if preference is set. This can happen with commandline flag | 453 // Disable Drive if preference is set. This can happen with commandline flag |
453 // --disable-drive or enterprise policy, or with user settings. | 454 // --disable-drive or enterprise policy, or with user settings. |
454 if (profile->GetPrefs()->GetBoolean(prefs::kDisableDrive)) | 455 if (profile->GetPrefs()->GetBoolean(prefs::kDisableDrive)) |
455 return false; | 456 return false; |
456 | 457 |
457 return true; | 458 return true; |
458 } | 459 } |
459 | 460 |
460 } // namespace util | 461 } // namespace util |
461 } // namespace drive | 462 } // namespace drive |
OLD | NEW |