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 "chromeos/dbus/cros_disks_client.h" | 5 #include "chromeos/dbus/cros_disks_client.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 // Performs file actions for Mount(). | 469 // Performs file actions for Mount(). |
470 static MountError PerformFakeMount(const std::string& source_path, | 470 static MountError PerformFakeMount(const std::string& source_path, |
471 const base::FilePath& mounted_path) { | 471 const base::FilePath& mounted_path) { |
472 // Check the source path exists. | 472 // Check the source path exists. |
473 if (!base::PathExists(base::FilePath::FromUTF8Unsafe(source_path))) { | 473 if (!base::PathExists(base::FilePath::FromUTF8Unsafe(source_path))) { |
474 DLOG(ERROR) << "Source does not exist at " << source_path; | 474 DLOG(ERROR) << "Source does not exist at " << source_path; |
475 return MOUNT_ERROR_INVALID_PATH; | 475 return MOUNT_ERROR_INVALID_PATH; |
476 } | 476 } |
477 | 477 |
478 // Just create an empty directory and shows it as the mounted directory. | 478 // Just create an empty directory and shows it as the mounted directory. |
479 if (!file_util::CreateDirectory(mounted_path)) { | 479 if (!base::CreateDirectory(mounted_path)) { |
480 DLOG(ERROR) << "Failed to create directory at " << mounted_path.value(); | 480 DLOG(ERROR) << "Failed to create directory at " << mounted_path.value(); |
481 return MOUNT_ERROR_DIRECTORY_CREATION_FAILED; | 481 return MOUNT_ERROR_DIRECTORY_CREATION_FAILED; |
482 } | 482 } |
483 | 483 |
484 // Put a dummy file. | 484 // Put a dummy file. |
485 const base::FilePath dummy_file_path = | 485 const base::FilePath dummy_file_path = |
486 mounted_path.Append("SUCCESSFULLY_PERFORMED_FAKE_MOUNT.txt"); | 486 mounted_path.Append("SUCCESSFULLY_PERFORMED_FAKE_MOUNT.txt"); |
487 const std::string dummy_file_content = "This is a dummy file."; | 487 const std::string dummy_file_content = "This is a dummy file."; |
488 const int write_result = file_util::WriteFile( | 488 const int write_result = file_util::WriteFile( |
489 dummy_file_path, dummy_file_content.data(), dummy_file_content.size()); | 489 dummy_file_path, dummy_file_content.data(), dummy_file_content.size()); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 } | 728 } |
729 | 729 |
730 // static | 730 // static |
731 base::FilePath CrosDisksClient::GetRemovableDiskMountPoint() { | 731 base::FilePath CrosDisksClient::GetRemovableDiskMountPoint() { |
732 return base::FilePath(base::SysInfo::IsRunningOnChromeOS() ? | 732 return base::FilePath(base::SysInfo::IsRunningOnChromeOS() ? |
733 FILE_PATH_LITERAL("/media/removable") : | 733 FILE_PATH_LITERAL("/media/removable") : |
734 FILE_PATH_LITERAL("/tmp/chromeos/media/removable")); | 734 FILE_PATH_LITERAL("/tmp/chromeos/media/removable")); |
735 } | 735 } |
736 | 736 |
737 } // namespace chromeos | 737 } // namespace chromeos |
OLD | NEW |