summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlukasza <lukasza@chromium.org>2015-08-20 18:13:24 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-21 01:13:59 +0000
commit6364a0299330a1ac060f0794f4638f82c0dc5cc2 (patch)
tree38c2645500cb3be95f73187aaa211f210dd3ce1a
parent85cc8532e314967a8ec308bc7fed379f3ad9d80a (diff)
downloadchromium_src-6364a0299330a1ac060f0794f4638f82c0dc5cc2.zip
chromium_src-6364a0299330a1ac060f0794f4638f82c0dc5cc2.tar.gz
chromium_src-6364a0299330a1ac060f0794f4638f82c0dc5cc2.tar.bz2
Move chrome/browser/chromeos/drive/resource* (+deps) into components/drive.
Files moved from chrome/browser/chromeos/drive into components/drive: - fake_free_disk_space_getter* - file_cache* - file_system_core_util* - resource_entry_conversion* - resource_metadata* - resource_metadata_storage* Other changes: - Removed unneeded includes where needed and possible. - Hidden usage of cryptohome::kMinFreeSpaceInBytes behind OS_CHROMEOS ifdefs and provided an equivalent constant shared by other OS-es. - Hidden usage of base::SetPosixFilePermissions behind OS_CHROMEOS ifdef as it was only needed to support cros_disks service on ChromeOS. - Moved 3 functions back from file_system_core_util into file_system_core. The 3 functions are ChromeOS-specific (dealing with where GDrive is mounted on ChromeOS) and moving them back helps avoid adding a new dependency on components/drive from chromeos directories. - When adding a third_party/leveldatabase dependency to gyp/gn/deps files under components/drive, I realized that gn is not consistent with gyp, by not explicitly listing a dependency on third_party/cacheinvalidation in components/drive/BUILD.gn. Test steps: 1. Verify that things still build via GYP (and unit tests pass). $ GYP_DEFINES="use_goma=1 gomadir=... chromeos=1" gclient sync $ ninja -C out/Debug -j 150 chrome unit_tests \ interactive_ui_tests browser_tests drive $ out/Debug/unit_tests 2. Verify that things still build via GN. $ gn gen out/Default --args='target_os="chromeos" use_goma=true' $ ninja -C out/Default -j 150 chrome unit_tests \ interactive_ui_tests browser_tests components/drive TEST=Please see "Test steps" above. BUG=257943, 498951 TBR=mtomasz@chromium.org, satorux@chromium.org, phajdan.jr@chromium.org, rockot@chromium.org, stevenjb@chromium.org, Review URL: https://codereview.chromium.org/1296483003 Cr-Commit-Position: refs/heads/master@{#344637}
-rw-r--r--chrome/browser/chromeos/drive/change_list_loader.cc4
-rw-r--r--chrome/browser/chromeos/drive/change_list_loader_unittest.cc6
-rw-r--r--chrome/browser/chromeos/drive/change_list_processor.cc6
-rw-r--r--chrome/browser/chromeos/drive/change_list_processor_unittest.cc8
-rw-r--r--chrome/browser/chromeos/drive/directory_loader.cc4
-rw-r--r--chrome/browser/chromeos/drive/directory_loader_unittest.cc6
-rw-r--r--chrome/browser/chromeos/drive/download_handler_unittest.cc2
-rw-r--r--chrome/browser/chromeos/drive/drive_file_stream_reader_unittest.cc2
-rw-r--r--chrome/browser/chromeos/drive/drive_integration_service.cc6
-rw-r--r--chrome/browser/chromeos/drive/drive_integration_service.h2
-rw-r--r--chrome/browser/chromeos/drive/fake_file_system.cc4
-rw-r--r--chrome/browser/chromeos/drive/fake_file_system_unittest.cc2
-rw-r--r--chrome/browser/chromeos/drive/file_system.cc6
-rw-r--r--chrome/browser/chromeos/drive/file_system/copy_operation.cc8
-rw-r--r--chrome/browser/chromeos/drive/file_system/copy_operation_unittest.cc6
-rw-r--r--chrome/browser/chromeos/drive/file_system/create_directory_operation.cc4
-rw-r--r--chrome/browser/chromeos/drive/file_system/create_file_operation.cc2
-rw-r--r--chrome/browser/chromeos/drive/file_system/download_operation.cc6
-rw-r--r--chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc6
-rw-r--r--chrome/browser/chromeos/drive/file_system/get_file_for_saving_operation.cc2
-rw-r--r--chrome/browser/chromeos/drive/file_system/move_operation.cc2
-rw-r--r--chrome/browser/chromeos/drive/file_system/open_file_operation.cc2
-rw-r--r--chrome/browser/chromeos/drive/file_system/open_file_operation_unittest.cc2
-rw-r--r--chrome/browser/chromeos/drive/file_system/operation_test_base.cc6
-rw-r--r--chrome/browser/chromeos/drive/file_system/remove_operation.cc6
-rw-r--r--chrome/browser/chromeos/drive/file_system/remove_operation_unittest.cc2
-rw-r--r--chrome/browser/chromeos/drive/file_system/search_operation.cc6
-rw-r--r--chrome/browser/chromeos/drive/file_system/set_property_operation.cc2
-rw-r--r--chrome/browser/chromeos/drive/file_system/touch_operation.cc2
-rw-r--r--chrome/browser/chromeos/drive/file_system/touch_operation_unittest.cc2
-rw-r--r--chrome/browser/chromeos/drive/file_system/truncate_operation.cc2
-rw-r--r--chrome/browser/chromeos/drive/file_system/truncate_operation_unittest.cc2
-rw-r--r--chrome/browser/chromeos/drive/file_system_interface.h2
-rw-r--r--chrome/browser/chromeos/drive/file_system_unittest.cc4
-rw-r--r--chrome/browser/chromeos/drive/file_system_util.cc38
-rw-r--r--chrome/browser/chromeos/drive/file_system_util.h12
-rw-r--r--chrome/browser/chromeos/drive/file_system_util_unittest.cc39
-rw-r--r--chrome/browser/chromeos/drive/file_write_watcher.h2
-rw-r--r--chrome/browser/chromeos/drive/fileapi/fileapi_worker.cc2
-rw-r--r--chrome/browser/chromeos/drive/fileapi/webkit_file_stream_reader_impl_unittest.cc2
-rw-r--r--chrome/browser/chromeos/drive/fileapi/webkit_file_stream_writer_impl.cc2
-rw-r--r--chrome/browser/chromeos/drive/remove_stale_cache_files.cc4
-rw-r--r--chrome/browser/chromeos/drive/remove_stale_cache_files_unittest.cc6
-rw-r--r--chrome/browser/chromeos/drive/search_metadata.cc2
-rw-r--r--chrome/browser/chromeos/drive/search_metadata_unittest.cc6
-rw-r--r--chrome/browser/chromeos/drive/sync/entry_revert_performer.cc4
-rw-r--r--chrome/browser/chromeos/drive/sync/entry_revert_performer_unittest.cc4
-rw-r--r--chrome/browser/chromeos/drive/sync/entry_update_performer.cc6
-rw-r--r--chrome/browser/chromeos/drive/sync/entry_update_performer_unittest.cc4
-rw-r--r--chrome/browser/chromeos/drive/sync/remove_performer.cc6
-rw-r--r--chrome/browser/chromeos/drive/sync/remove_performer_unittest.cc4
-rw-r--r--chrome/browser/chromeos/drive/sync_client.cc4
-rw-r--r--chrome/browser/chromeos/drive/sync_client.h2
-rw-r--r--chrome/browser/chromeos/drive/sync_client_unittest.cc10
-rw-r--r--chrome/browser/chromeos/drive/write_on_cache_file.cc2
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/job_event_router.cc2
-rw-r--r--chrome/browser/chromeos/file_manager/file_browser_handlers.cc2
-rw-r--r--chrome/browser/chromeos/file_manager/file_tasks.cc2
-rw-r--r--chrome/browser/chromeos/file_manager/fileapi_util.cc2
-rw-r--r--chrome/browser/chromeos/file_manager/filesystem_api_util.cc2
-rw-r--r--chrome/browser/chromeos/file_manager/open_with_browser.cc2
-rw-r--r--chrome/browser/chromeos/file_manager/path_util.cc2
-rw-r--r--chrome/browser/chromeos/file_manager/volume_manager.cc2
-rw-r--r--chrome/browser/chromeos/fileapi/external_file_url_request_job.cc2
-rw-r--r--chrome/browser/chromeos/fileapi/external_file_url_util_unittest.cc2
-rw-r--r--chrome/browser/chromeos/preferences.cc2
-rw-r--r--chrome/browser/download/chrome_download_manager_delegate.cc2
-rw-r--r--chrome/browser/download/download_dir_policy_handler.cc2
-rw-r--r--chrome/browser/download/download_dir_policy_handler_unittest.cc2
-rw-r--r--chrome/browser/download/save_package_file_picker.cc2
-rw-r--r--chrome/browser/extensions/webstore_installer.cc2
-rw-r--r--chrome/browser/ui/ash/chrome_screenshot_grabber.cc1
-rw-r--r--chrome/chrome_browser_chromeos.gypi10
-rw-r--r--chrome/chrome_tests_unit.gypi12
-rw-r--r--components/drive.gypi17
-rw-r--r--components/drive/BUILD.gn14
-rw-r--r--components/drive/DEPS11
-rw-r--r--components/drive/fake_free_disk_space_getter.cc (renamed from chrome/browser/chromeos/drive/fake_free_disk_space_getter.cc)2
-rw-r--r--components/drive/fake_free_disk_space_getter.h (renamed from chrome/browser/chromeos/drive/fake_free_disk_space_getter.h)8
-rw-r--r--components/drive/file_cache.cc (renamed from chrome/browser/chromeos/drive/file_cache.cc)21
-rw-r--r--components/drive/file_cache.h (renamed from chrome/browser/chromeos/drive/file_cache.h)8
-rw-r--r--components/drive/file_cache_unittest.cc (renamed from chrome/browser/chromeos/drive/file_cache_unittest.cc)8
-rw-r--r--components/drive/file_system_core_util.cc (renamed from chrome/browser/chromeos/drive/file_system_core_util.cc)40
-rw-r--r--components/drive/file_system_core_util.h (renamed from chrome/browser/chromeos/drive/file_system_core_util.h)18
-rw-r--r--components/drive/file_system_core_util_unittest.cc (renamed from chrome/browser/chromeos/drive/file_system_core_util_unittest.cc)49
-rw-r--r--components/drive/resource_entry_conversion.cc (renamed from chrome/browser/chromeos/drive/resource_entry_conversion.cc)4
-rw-r--r--components/drive/resource_entry_conversion.h (renamed from chrome/browser/chromeos/drive/resource_entry_conversion.h)6
-rw-r--r--components/drive/resource_entry_conversion_unittest.cc (renamed from chrome/browser/chromeos/drive/resource_entry_conversion_unittest.cc)2
-rw-r--r--components/drive/resource_metadata.cc (renamed from chrome/browser/chromeos/drive/resource_metadata.cc)8
-rw-r--r--components/drive/resource_metadata.h (renamed from chrome/browser/chromeos/drive/resource_metadata.h)8
-rw-r--r--components/drive/resource_metadata_storage.cc (renamed from chrome/browser/chromeos/drive/resource_metadata_storage.cc)2
-rw-r--r--components/drive/resource_metadata_storage.h (renamed from chrome/browser/chromeos/drive/resource_metadata_storage.h)6
-rw-r--r--components/drive/resource_metadata_storage_unittest.cc (renamed from chrome/browser/chromeos/drive/resource_metadata_storage_unittest.cc)2
-rw-r--r--components/drive/resource_metadata_unittest.cc (renamed from chrome/browser/chromeos/drive/resource_metadata_unittest.cc)8
94 files changed, 306 insertions, 286 deletions
diff --git a/chrome/browser/chromeos/drive/change_list_loader.cc b/chrome/browser/chromeos/drive/change_list_loader.cc
index 02a5575..5e9eace 100644
--- a/chrome/browser/chromeos/drive/change_list_loader.cc
+++ b/chrome/browser/chromeos/drive/change_list_loader.cc
@@ -15,10 +15,10 @@
#include "base/time/time.h"
#include "chrome/browser/chromeos/drive/change_list_loader_observer.h"
#include "chrome/browser/chromeos/drive/change_list_processor.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/event_logger.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_metadata.h"
#include "google_apis/drive/drive_api_parser.h"
#include "url/gurl.h"
diff --git a/chrome/browser/chromeos/drive/change_list_loader_unittest.cc b/chrome/browser/chromeos/drive/change_list_loader_unittest.cc
index 0f77fe8..c4c515d 100644
--- a/chrome/browser/chromeos/drive/change_list_loader_unittest.cc
+++ b/chrome/browser/chromeos/drive/change_list_loader_unittest.cc
@@ -12,13 +12,13 @@
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/browser/chromeos/drive/change_list_loader_observer.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive_test_util.h"
#include "components/drive/event_logger.h"
+#include "components/drive/file_cache.h"
#include "components/drive/file_change.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_metadata.h"
#include "components/drive/service/fake_drive_service.h"
#include "components/drive/service/test_util.h"
#include "content/public/test/test_browser_thread_bundle.h"
diff --git a/chrome/browser/chromeos/drive/change_list_processor.cc b/chrome/browser/chromeos/drive/change_list_processor.cc
index 8580e0d..438c5a8 100644
--- a/chrome/browser/chromeos/drive/change_list_processor.cc
+++ b/chrome/browser/chromeos/drive/change_list_processor.cc
@@ -7,12 +7,12 @@
#include "base/metrics/histogram.h"
#include "base/strings/string_number_conversions.h"
#include "base/synchronization/cancellation_flag.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_entry_conversion.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive.pb.h"
#include "components/drive/drive_api_util.h"
#include "components/drive/file_change.h"
+#include "components/drive/file_system_core_util.h"
+#include "components/drive/resource_entry_conversion.h"
+#include "components/drive/resource_metadata.h"
#include "google_apis/drive/drive_api_parser.h"
namespace drive {
diff --git a/chrome/browser/chromeos/drive/change_list_processor_unittest.cc b/chrome/browser/chromeos/drive/change_list_processor_unittest.cc
index 8c867be..f41dc82 100644
--- a/chrome/browser/chromeos/drive/change_list_processor_unittest.cc
+++ b/chrome/browser/chromeos/drive/change_list_processor_unittest.cc
@@ -8,13 +8,13 @@
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "base/values.h"
-#include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive.pb.h"
#include "components/drive/drive_test_util.h"
+#include "components/drive/fake_free_disk_space_getter.h"
+#include "components/drive/file_cache.h"
#include "components/drive/file_change.h"
+#include "components/drive/file_system_core_util.h"
+#include "components/drive/resource_metadata.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "google_apis/drive/drive_api_parser.h"
#include "google_apis/drive/test_util.h"
diff --git a/chrome/browser/chromeos/drive/directory_loader.cc b/chrome/browser/chromeos/drive/directory_loader.cc
index 5d1f8df..824bb1e 100644
--- a/chrome/browser/chromeos/drive/directory_loader.cc
+++ b/chrome/browser/chromeos/drive/directory_loader.cc
@@ -12,10 +12,10 @@
#include "chrome/browser/chromeos/drive/change_list_loader.h"
#include "chrome/browser/chromeos/drive/change_list_loader_observer.h"
#include "chrome/browser/chromeos/drive/change_list_processor.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/event_logger.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_metadata.h"
#include "google_apis/drive/drive_api_parser.h"
#include "url/gurl.h"
diff --git a/chrome/browser/chromeos/drive/directory_loader_unittest.cc b/chrome/browser/chromeos/drive/directory_loader_unittest.cc
index 0531dc6..620379a 100644
--- a/chrome/browser/chromeos/drive/directory_loader_unittest.cc
+++ b/chrome/browser/chromeos/drive/directory_loader_unittest.cc
@@ -13,12 +13,12 @@
#include "base/thread_task_runner_handle.h"
#include "chrome/browser/chromeos/drive/change_list_loader.h"
#include "chrome/browser/chromeos/drive/change_list_loader_observer.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive_test_util.h"
#include "components/drive/event_logger.h"
+#include "components/drive/file_cache.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_metadata.h"
#include "components/drive/service/fake_drive_service.h"
#include "components/drive/service/test_util.h"
#include "content/public/test/test_browser_thread_bundle.h"
diff --git a/chrome/browser/chromeos/drive/download_handler_unittest.cc b/chrome/browser/chromeos/drive/download_handler_unittest.cc
index b8c7ff2..385c8c3 100644
--- a/chrome/browser/chromeos/drive/download_handler_unittest.cc
+++ b/chrome/browser/chromeos/drive/download_handler_unittest.cc
@@ -6,9 +6,9 @@
#include "base/files/scoped_temp_dir.h"
#include "chrome/browser/chromeos/drive/dummy_file_system.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/test/base/testing_profile.h"
+#include "components/drive/file_system_core_util.h"
#include "content/public/test/mock_download_item.h"
#include "content/public/test/mock_download_manager.h"
#include "content/public/test/test_browser_thread_bundle.h"
diff --git a/chrome/browser/chromeos/drive/drive_file_stream_reader_unittest.cc b/chrome/browser/chromeos/drive/drive_file_stream_reader_unittest.cc
index 4ce17d8..c175545 100644
--- a/chrome/browser/chromeos/drive/drive_file_stream_reader_unittest.cc
+++ b/chrome/browser/chromeos/drive/drive_file_stream_reader_unittest.cc
@@ -12,8 +12,8 @@
#include "base/run_loop.h"
#include "base/threading/thread.h"
#include "chrome/browser/chromeos/drive/fake_file_system.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "components/drive/drive_test_util.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/local_file_reader.h"
#include "components/drive/service/fake_drive_service.h"
#include "components/drive/service/test_util.h"
diff --git a/chrome/browser/chromeos/drive/drive_integration_service.cc b/chrome/browser/chromeos/drive/drive_integration_service.cc
index cef8159..c98cd19 100644
--- a/chrome/browser/chromeos/drive/drive_integration_service.cc
+++ b/chrome/browser/chromeos/drive/drive_integration_service.cc
@@ -14,11 +14,8 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/drive/debug_info_collector.h"
#include "chrome/browser/chromeos/drive/download_handler.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
#include "chrome/browser/chromeos/drive/file_system.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
-#include "chrome/browser/chromeos/drive/resource_metadata_storage.h"
#include "chrome/browser/chromeos/file_manager/path_util.h"
#include "chrome/browser/chromeos/profiles/profile_util.h"
#include "chrome/browser/download/download_prefs.h"
@@ -36,7 +33,10 @@
#include "components/drive/drive_notification_manager.h"
#include "components/drive/drive_pref_names.h"
#include "components/drive/event_logger.h"
+#include "components/drive/file_cache.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_metadata.h"
+#include "components/drive/resource_metadata_storage.h"
#include "components/drive/service/drive_api_service.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
diff --git a/chrome/browser/chromeos/drive/drive_integration_service.h b/chrome/browser/chromeos/drive/drive_integration_service.h
index 1ec42b0..1777f4e 100644
--- a/chrome/browser/chromeos/drive/drive_integration_service.h
+++ b/chrome/browser/chromeos/drive/drive_integration_service.h
@@ -10,9 +10,9 @@
#include "base/memory/singleton.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "components/drive/drive_notification_observer.h"
#include "components/drive/file_errors.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_scheduler.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
#include "components/keyed_service/core/keyed_service.h"
diff --git a/chrome/browser/chromeos/drive/fake_file_system.cc b/chrome/browser/chromeos/drive/fake_file_system.cc
index 10f27ef..e268a7e 100644
--- a/chrome/browser/chromeos/drive/fake_file_system.cc
+++ b/chrome/browser/chromeos/drive/fake_file_system.cc
@@ -10,10 +10,10 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_entry_conversion.h"
#include "components/drive/drive.pb.h"
#include "components/drive/file_errors.h"
+#include "components/drive/file_system_core_util.h"
+#include "components/drive/resource_entry_conversion.h"
#include "components/drive/service/drive_service_interface.h"
#include "content/public/browser/browser_thread.h"
#include "google_apis/drive/drive_api_parser.h"
diff --git a/chrome/browser/chromeos/drive/fake_file_system_unittest.cc b/chrome/browser/chromeos/drive/fake_file_system_unittest.cc
index cacec3a..cc2c736 100644
--- a/chrome/browser/chromeos/drive/fake_file_system_unittest.cc
+++ b/chrome/browser/chromeos/drive/fake_file_system_unittest.cc
@@ -6,7 +6,7 @@
#include "base/files/file_util.h"
#include "base/run_loop.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/service/fake_drive_service.h"
#include "components/drive/service/test_util.h"
#include "content/public/test/test_browser_thread_bundle.h"
diff --git a/chrome/browser/chromeos/drive/file_system.cc b/chrome/browser/chromeos/drive/file_system.cc
index 9deb3c4..ca6737d 100644
--- a/chrome/browser/chromeos/drive/file_system.cc
+++ b/chrome/browser/chromeos/drive/file_system.cc
@@ -9,7 +9,6 @@
#include "base/prefs/pref_service.h"
#include "chrome/browser/chromeos/drive/change_list_loader.h"
#include "chrome/browser/chromeos/drive/directory_loader.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
#include "chrome/browser/chromeos/drive/file_system/copy_operation.h"
#include "chrome/browser/chromeos/drive/file_system/create_directory_operation.h"
#include "chrome/browser/chromeos/drive/file_system/create_file_operation.h"
@@ -22,16 +21,17 @@
#include "chrome/browser/chromeos/drive/file_system/set_property_operation.h"
#include "chrome/browser/chromeos/drive/file_system/touch_operation.h"
#include "chrome/browser/chromeos/drive/file_system/truncate_operation.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "chrome/browser/chromeos/drive/file_system_observer.h"
#include "chrome/browser/chromeos/drive/remove_stale_cache_files.h"
-#include "chrome/browser/chromeos/drive/resource_entry_conversion.h"
#include "chrome/browser/chromeos/drive/search_metadata.h"
#include "chrome/browser/chromeos/drive/sync_client.h"
#include "components/drive/drive.pb.h"
#include "components/drive/drive_pref_names.h"
+#include "components/drive/file_cache.h"
#include "components/drive/file_change.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_entry_conversion.h"
#include "google_apis/drive/drive_api_parser.h"
namespace drive {
diff --git a/chrome/browser/chromeos/drive/file_system/copy_operation.cc b/chrome/browser/chromeos/drive/file_system/copy_operation.cc
index 9ab7beb..ace52a5 100644
--- a/chrome/browser/chromeos/drive/file_system/copy_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/copy_operation.cc
@@ -7,16 +7,16 @@
#include <string>
#include "base/task_runner_util.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
#include "chrome/browser/chromeos/drive/file_system/create_file_operation.h"
#include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_entry_conversion.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive.pb.h"
#include "components/drive/drive_api_util.h"
+#include "components/drive/file_cache.h"
#include "components/drive/file_change.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_entry_conversion.h"
+#include "components/drive/resource_metadata.h"
#include "google_apis/drive/drive_api_parser.h"
namespace drive {
diff --git a/chrome/browser/chromeos/drive/file_system/copy_operation_unittest.cc b/chrome/browser/chromeos/drive/file_system/copy_operation_unittest.cc
index 51ff128..d5c2ae4 100644
--- a/chrome/browser/chromeos/drive/file_system/copy_operation_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_system/copy_operation_unittest.cc
@@ -6,12 +6,12 @@
#include "base/files/file_util.h"
#include "base/task_runner_util.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
#include "chrome/browser/chromeos/drive/file_system/operation_test_base.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive_api_util.h"
+#include "components/drive/file_cache.h"
#include "components/drive/file_change.h"
+#include "components/drive/file_system_core_util.h"
+#include "components/drive/resource_metadata.h"
#include "components/drive/service/fake_drive_service.h"
#include "content/public/test/test_utils.h"
#include "google_apis/drive/drive_api_parser.h"
diff --git a/chrome/browser/chromeos/drive/file_system/create_directory_operation.cc b/chrome/browser/chromeos/drive/file_system/create_directory_operation.cc
index 533d219..49a18e0 100644
--- a/chrome/browser/chromeos/drive/file_system/create_directory_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/create_directory_operation.cc
@@ -5,11 +5,11 @@
#include "chrome/browser/chromeos/drive/file_system/create_directory_operation.h"
#include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive.pb.h"
#include "components/drive/file_change.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_metadata.h"
namespace drive {
namespace file_system {
diff --git a/chrome/browser/chromeos/drive/file_system/create_file_operation.cc b/chrome/browser/chromeos/drive/file_system/create_file_operation.cc
index 62c7b67..4827a55 100644
--- a/chrome/browser/chromeos/drive/file_system/create_file_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/create_file_operation.cc
@@ -8,10 +8,10 @@
#include "base/files/file_util.h"
#include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive.pb.h"
#include "components/drive/file_change.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_metadata.h"
#include "net/base/mime_util.h"
namespace drive {
diff --git a/chrome/browser/chromeos/drive/file_system/download_operation.cc b/chrome/browser/chromeos/drive/file_system/download_operation.cc
index 684d2d3..6f226ac 100644
--- a/chrome/browser/chromeos/drive/file_system/download_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/download_operation.cc
@@ -9,14 +9,14 @@
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/task_runner_util.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
#include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive.pb.h"
+#include "components/drive/file_cache.h"
#include "components/drive/file_change.h"
#include "components/drive/file_errors.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_metadata.h"
#include "google_apis/drive/drive_api_error_codes.h"
namespace drive {
diff --git a/chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc b/chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc
index def2f76..e94dadf 100644
--- a/chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc
@@ -6,11 +6,11 @@
#include "base/files/file_util.h"
#include "base/task_runner_util.h"
-#include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
#include "chrome/browser/chromeos/drive/file_system/operation_test_base.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
+#include "components/drive/fake_free_disk_space_getter.h"
+#include "components/drive/file_cache.h"
#include "components/drive/file_change.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_scheduler.h"
#include "components/drive/service/fake_drive_service.h"
#include "content/public/test/test_utils.h"
diff --git a/chrome/browser/chromeos/drive/file_system/get_file_for_saving_operation.cc b/chrome/browser/chromeos/drive/file_system/get_file_for_saving_operation.cc
index e467946..f3c6c4f 100644
--- a/chrome/browser/chromeos/drive/file_system/get_file_for_saving_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/get_file_for_saving_operation.cc
@@ -7,12 +7,12 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/callback_helpers.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
#include "chrome/browser/chromeos/drive/file_system/create_file_operation.h"
#include "chrome/browser/chromeos/drive/file_system/download_operation.h"
#include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
#include "chrome/browser/chromeos/drive/file_write_watcher.h"
#include "components/drive/event_logger.h"
+#include "components/drive/file_cache.h"
#include "components/drive/job_scheduler.h"
#include "content/public/browser/browser_thread.h"
diff --git a/chrome/browser/chromeos/drive/file_system/move_operation.cc b/chrome/browser/chromeos/drive/file_system/move_operation.cc
index 5217c8d..a4bb710 100644
--- a/chrome/browser/chromeos/drive/file_system/move_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/move_operation.cc
@@ -6,10 +6,10 @@
#include "base/sequenced_task_runner.h"
#include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive.pb.h"
#include "components/drive/file_change.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_metadata.h"
namespace drive {
namespace file_system {
diff --git a/chrome/browser/chromeos/drive/file_system/open_file_operation.cc b/chrome/browser/chromeos/drive/file_system/open_file_operation.cc
index 4a98576..a2ca4e4 100644
--- a/chrome/browser/chromeos/drive/file_system/open_file_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/open_file_operation.cc
@@ -11,11 +11,11 @@
#include "base/logging.h"
#include "base/task_runner_util.h"
#include "base/thread_task_runner_handle.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
#include "chrome/browser/chromeos/drive/file_system/create_file_operation.h"
#include "chrome/browser/chromeos/drive/file_system/download_operation.h"
#include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
#include "components/drive/drive.pb.h"
+#include "components/drive/file_cache.h"
#include "components/drive/file_errors.h"
#include "components/drive/job_scheduler.h"
diff --git a/chrome/browser/chromeos/drive/file_system/open_file_operation_unittest.cc b/chrome/browser/chromeos/drive/file_system/open_file_operation_unittest.cc
index df29a10..1829ba4 100644
--- a/chrome/browser/chromeos/drive/file_system/open_file_operation_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_system/open_file_operation_unittest.cc
@@ -10,9 +10,9 @@
#include "base/files/file_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/task_runner_util.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
#include "chrome/browser/chromeos/drive/file_system/operation_test_base.h"
#include "components/drive/drive.pb.h"
+#include "components/drive/file_cache.h"
#include "components/drive/file_change.h"
#include "components/drive/file_errors.h"
#include "content/public/test/test_utils.h"
diff --git a/chrome/browser/chromeos/drive/file_system/operation_test_base.cc b/chrome/browser/chromeos/drive/file_system/operation_test_base.cc
index 5c060309..6692e1f 100644
--- a/chrome/browser/chromeos/drive/file_system/operation_test_base.cc
+++ b/chrome/browser/chromeos/drive/file_system/operation_test_base.cc
@@ -7,13 +7,13 @@
#include "base/prefs/testing_pref_service.h"
#include "base/threading/sequenced_worker_pool.h"
#include "chrome/browser/chromeos/drive/change_list_loader.h"
-#include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
#include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/event_logger.h"
+#include "components/drive/fake_free_disk_space_getter.h"
+#include "components/drive/file_cache.h"
#include "components/drive/file_change.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_metadata.h"
#include "components/drive/service/fake_drive_service.h"
#include "components/drive/service/test_util.h"
#include "content/public/browser/browser_thread.h"
diff --git a/chrome/browser/chromeos/drive/file_system/remove_operation.cc b/chrome/browser/chromeos/drive/file_system/remove_operation.cc
index e6dcfa3..1249305 100644
--- a/chrome/browser/chromeos/drive/file_system/remove_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/remove_operation.cc
@@ -5,13 +5,13 @@
#include "chrome/browser/chromeos/drive/file_system/remove_operation.h"
#include "base/sequenced_task_runner.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
#include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive.pb.h"
+#include "components/drive/file_cache.h"
#include "components/drive/file_change.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_metadata.h"
namespace drive {
namespace file_system {
diff --git a/chrome/browser/chromeos/drive/file_system/remove_operation_unittest.cc b/chrome/browser/chromeos/drive/file_system/remove_operation_unittest.cc
index d4220bd..3bbba44 100644
--- a/chrome/browser/chromeos/drive/file_system/remove_operation_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_system/remove_operation_unittest.cc
@@ -5,8 +5,8 @@
#include "chrome/browser/chromeos/drive/file_system/remove_operation.h"
#include "chrome/browser/chromeos/drive/file_system/operation_test_base.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "components/drive/file_change.h"
+#include "components/drive/file_system_core_util.h"
#include "content/public/test/test_utils.h"
#include "google_apis/drive/test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/chromeos/drive/file_system/search_operation.cc b/chrome/browser/chromeos/drive/file_system/search_operation.cc
index 3added5..0eeea2a 100644
--- a/chrome/browser/chromeos/drive/file_system/search_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/search_operation.cc
@@ -12,11 +12,11 @@
#include "base/callback.h"
#include "base/task_runner_util.h"
#include "chrome/browser/chromeos/drive/change_list_loader.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_entry_conversion.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive_api_util.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_entry_conversion.h"
+#include "components/drive/resource_metadata.h"
#include "google_apis/drive/drive_api_parser.h"
#include "url/gurl.h"
diff --git a/chrome/browser/chromeos/drive/file_system/set_property_operation.cc b/chrome/browser/chromeos/drive/file_system/set_property_operation.cc
index b7bc45f..a70a723 100644
--- a/chrome/browser/chromeos/drive/file_system/set_property_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/set_property_operation.cc
@@ -8,10 +8,10 @@
#include "base/files/file_path.h"
#include "base/sequenced_task_runner.h"
#include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive.pb.h"
#include "components/drive/file_errors.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_metadata.h"
namespace drive {
namespace file_system {
diff --git a/chrome/browser/chromeos/drive/file_system/touch_operation.cc b/chrome/browser/chromeos/drive/file_system/touch_operation.cc
index c48e433..c7b0711 100644
--- a/chrome/browser/chromeos/drive/file_system/touch_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/touch_operation.cc
@@ -9,10 +9,10 @@
#include "base/sequenced_task_runner.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/file_change.h"
#include "components/drive/file_errors.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_metadata.h"
namespace drive {
namespace file_system {
diff --git a/chrome/browser/chromeos/drive/file_system/touch_operation_unittest.cc b/chrome/browser/chromeos/drive/file_system/touch_operation_unittest.cc
index ba19118..c4481ea 100644
--- a/chrome/browser/chromeos/drive/file_system/touch_operation_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_system/touch_operation_unittest.cc
@@ -7,9 +7,9 @@
#include "base/files/file_path.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/drive/file_system/operation_test_base.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive.pb.h"
#include "components/drive/file_errors.h"
+#include "components/drive/resource_metadata.h"
#include "google_apis/drive/test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/chromeos/drive/file_system/truncate_operation.cc b/chrome/browser/chromeos/drive/file_system/truncate_operation.cc
index 17ebc53..69e6434 100644
--- a/chrome/browser/chromeos/drive/file_system/truncate_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/truncate_operation.cc
@@ -12,10 +12,10 @@
#include "base/sequenced_task_runner.h"
#include "base/task_runner_util.h"
#include "base/thread_task_runner_handle.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
#include "chrome/browser/chromeos/drive/file_system/download_operation.h"
#include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
#include "components/drive/drive.pb.h"
+#include "components/drive/file_cache.h"
#include "components/drive/file_errors.h"
#include "components/drive/job_scheduler.h"
diff --git a/chrome/browser/chromeos/drive/file_system/truncate_operation_unittest.cc b/chrome/browser/chromeos/drive/file_system/truncate_operation_unittest.cc
index 77973a1..98ab826 100644
--- a/chrome/browser/chromeos/drive/file_system/truncate_operation_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_system/truncate_operation_unittest.cc
@@ -7,9 +7,9 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/task_runner_util.h"
-#include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h"
#include "chrome/browser/chromeos/drive/file_system/operation_test_base.h"
#include "components/drive/drive.pb.h"
+#include "components/drive/fake_free_disk_space_getter.h"
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/chromeos/drive/file_system_interface.h b/chrome/browser/chromeos/drive/file_system_interface.h
index c7f712d..4d539d5 100644
--- a/chrome/browser/chromeos/drive/file_system_interface.h
+++ b/chrome/browser/chromeos/drive/file_system_interface.h
@@ -10,8 +10,8 @@
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/chromeos/drive/file_system_metadata.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive.pb.h"
+#include "components/drive/resource_metadata.h"
#include "google_apis/drive/base_requests.h"
#include "google_apis/drive/drive_api_requests.h"
diff --git a/chrome/browser/chromeos/drive/file_system_unittest.cc b/chrome/browser/chromeos/drive/file_system_unittest.cc
index b618f63..49be6f3 100644
--- a/chrome/browser/chromeos/drive/file_system_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_system_unittest.cc
@@ -17,15 +17,15 @@
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/browser/chromeos/drive/change_list_loader.h"
-#include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "chrome/browser/chromeos/drive/file_system_observer.h"
#include "chrome/browser/chromeos/drive/sync_client.h"
#include "components/drive/drive.pb.h"
#include "components/drive/drive_api_util.h"
#include "components/drive/drive_test_util.h"
#include "components/drive/event_logger.h"
+#include "components/drive/fake_free_disk_space_getter.h"
#include "components/drive/file_change.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_scheduler.h"
#include "components/drive/service/fake_drive_service.h"
#include "components/drive/service/test_util.h"
diff --git a/chrome/browser/chromeos/drive/file_system_util.cc b/chrome/browser/chromeos/drive/file_system_util.cc
index 4beb637..cbb697a 100644
--- a/chrome/browser/chromeos/drive/file_system_util.cc
+++ b/chrome/browser/chromeos/drive/file_system_util.cc
@@ -24,7 +24,6 @@
#include "base/threading/sequenced_worker_pool.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/drive/drive_integration_service.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "chrome/browser/chromeos/drive/file_system_interface.h"
#include "chrome/browser/chromeos/drive/write_on_cache_file.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
@@ -36,9 +35,11 @@
#include "chromeos/chromeos_constants.h"
#include "components/drive/drive.pb.h"
#include "components/drive/drive_pref_names.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_list.h"
#include "components/user_manager/user_manager.h"
#include "content/public/browser/browser_thread.h"
+#include "net/base/escape.h"
#include "storage/browser/fileapi/file_system_url.h"
using content::BrowserThread;
@@ -78,6 +79,41 @@ base::FilePath GetDriveMountPointPath(Profile* profile) {
return GetDriveMountPointPathForUserIdHash(id);
}
+base::FilePath GetDriveMountPointPathForUserIdHash(
+ const std::string user_id_hash) {
+ static const base::FilePath::CharType kSpecialMountPointRoot[] =
+ FILE_PATH_LITERAL("/special");
+ static const char kDriveMountPointNameBase[] = "drive";
+ return base::FilePath(kSpecialMountPointRoot)
+ .AppendASCII(net::EscapeQueryParamValue(
+ kDriveMountPointNameBase +
+ (user_id_hash.empty() ? "" : "-" + user_id_hash),
+ false));
+}
+
+bool IsUnderDriveMountPoint(const base::FilePath& path) {
+ return !ExtractDrivePath(path).empty();
+}
+
+base::FilePath ExtractDrivePath(const base::FilePath& path) {
+ std::vector<base::FilePath::StringType> components;
+ path.GetComponents(&components);
+ if (components.size() < 3)
+ return base::FilePath();
+ if (components[0] != FILE_PATH_LITERAL("/"))
+ return base::FilePath();
+ if (components[1] != FILE_PATH_LITERAL("special"))
+ return base::FilePath();
+ static const base::FilePath::CharType kPrefix[] = FILE_PATH_LITERAL("drive");
+ if (components[2].compare(0, arraysize(kPrefix) - 1, kPrefix) != 0)
+ return base::FilePath();
+
+ base::FilePath drive_path = GetDriveGrandRootPath();
+ for (size_t i = 3; i < components.size(); ++i)
+ drive_path = drive_path.Append(components[i]);
+ return drive_path;
+}
+
FileSystemInterface* GetFileSystemByProfile(Profile* profile) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
diff --git a/chrome/browser/chromeos/drive/file_system_util.h b/chrome/browser/chromeos/drive/file_system_util.h
index 5e91b3c..370c752 100644
--- a/chrome/browser/chromeos/drive/file_system_util.h
+++ b/chrome/browser/chromeos/drive/file_system_util.h
@@ -29,6 +29,18 @@ namespace util {
// Returns the Drive mount point path, which looks like "/special/drive-<hash>".
base::FilePath GetDriveMountPointPath(Profile* profile);
+// Returns the Drive mount point path, which looks like
+// "/special/drive-<username_hash>", when provided with the |user_id_hash|.
+base::FilePath GetDriveMountPointPathForUserIdHash(std::string user_id_hash);
+
+// Returns true if the given path is under the Drive mount point.
+bool IsUnderDriveMountPoint(const base::FilePath& path);
+
+// Extracts the Drive path from the given path located under the Drive mount
+// point. Returns an empty path if |path| is not under the Drive mount point.
+// Examples: ExtractDrivePath("/special/drive-xxx/foo.txt") => "drive/foo.txt"
+base::FilePath ExtractDrivePath(const base::FilePath& path);
+
// Returns the FileSystem for the |profile|. If not available (not mounted
// or disabled), returns NULL.
FileSystemInterface* GetFileSystemByProfile(Profile* profile);
diff --git a/chrome/browser/chromeos/drive/file_system_util_unittest.cc b/chrome/browser/chromeos/drive/file_system_util_unittest.cc
index b471b5b..4d28834 100644
--- a/chrome/browser/chromeos/drive/file_system_util_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_system_util_unittest.cc
@@ -60,6 +60,45 @@ TEST_F(ProfileRelatedFileSystemUtilTest, GetDriveMountPointPath) {
GetDriveMountPointPath(profile));
}
+TEST_F(ProfileRelatedFileSystemUtilTest, IsUnderDriveMountPoint) {
+ EXPECT_FALSE(IsUnderDriveMountPoint(
+ base::FilePath::FromUTF8Unsafe("/wherever/foo.txt")));
+ EXPECT_FALSE(IsUnderDriveMountPoint(
+ base::FilePath::FromUTF8Unsafe("/special/foo.txt")));
+ EXPECT_FALSE(IsUnderDriveMountPoint(
+ base::FilePath::FromUTF8Unsafe("special/drive/foo.txt")));
+
+ EXPECT_TRUE(
+ IsUnderDriveMountPoint(base::FilePath::FromUTF8Unsafe("/special/drive")));
+ EXPECT_TRUE(IsUnderDriveMountPoint(
+ base::FilePath::FromUTF8Unsafe("/special/drive/foo.txt")));
+ EXPECT_TRUE(IsUnderDriveMountPoint(
+ base::FilePath::FromUTF8Unsafe("/special/drive/subdir/foo.txt")));
+ EXPECT_TRUE(IsUnderDriveMountPoint(
+ base::FilePath::FromUTF8Unsafe("/special/drive-xxx/foo.txt")));
+}
+
+TEST_F(ProfileRelatedFileSystemUtilTest, ExtractDrivePath) {
+ EXPECT_EQ(
+ base::FilePath(),
+ ExtractDrivePath(base::FilePath::FromUTF8Unsafe("/wherever/foo.txt")));
+ EXPECT_EQ(
+ base::FilePath(),
+ ExtractDrivePath(base::FilePath::FromUTF8Unsafe("/special/foo.txt")));
+
+ EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive"),
+ ExtractDrivePath(base::FilePath::FromUTF8Unsafe("/special/drive")));
+ EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/foo.txt"),
+ ExtractDrivePath(
+ base::FilePath::FromUTF8Unsafe("/special/drive/foo.txt")));
+ EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/subdir/foo.txt"),
+ ExtractDrivePath(base::FilePath::FromUTF8Unsafe(
+ "/special/drive/subdir/foo.txt")));
+ EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/foo.txt"),
+ ExtractDrivePath(
+ base::FilePath::FromUTF8Unsafe("/special/drive-xxx/foo.txt")));
+}
+
TEST_F(ProfileRelatedFileSystemUtilTest, ExtractProfileFromPath) {
Profile* profile1 = testing_profile_manager().CreateTestingProfile("user1");
Profile* profile2 = testing_profile_manager().CreateTestingProfile("user2");
diff --git a/chrome/browser/chromeos/drive/file_write_watcher.h b/chrome/browser/chromeos/drive/file_write_watcher.h
index f90bd75..747723d 100644
--- a/chrome/browser/chromeos/drive/file_write_watcher.h
+++ b/chrome/browser/chromeos/drive/file_write_watcher.h
@@ -8,7 +8,7 @@
#include "base/callback_forward.h"
#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
+#include "components/drive/file_system_core_util.h"
namespace base {
class FilePath;
diff --git a/chrome/browser/chromeos/drive/fileapi/fileapi_worker.cc b/chrome/browser/chromeos/drive/fileapi/fileapi_worker.cc
index 76c8b35..0d8b232 100644
--- a/chrome/browser/chromeos/drive/fileapi/fileapi_worker.cc
+++ b/chrome/browser/chromeos/drive/fileapi/fileapi_worker.cc
@@ -11,9 +11,9 @@
#include "base/threading/sequenced_worker_pool.h"
#include "chrome/browser/chromeos/drive/file_system_interface.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
-#include "chrome/browser/chromeos/drive/resource_entry_conversion.h"
#include "components/drive/drive.pb.h"
#include "components/drive/file_errors.h"
+#include "components/drive/resource_entry_conversion.h"
#include "content/public/browser/browser_thread.h"
#include "storage/browser/fileapi/file_system_url.h"
#include "storage/common/fileapi/directory_entry.h"
diff --git a/chrome/browser/chromeos/drive/fileapi/webkit_file_stream_reader_impl_unittest.cc b/chrome/browser/chromeos/drive/fileapi/webkit_file_stream_reader_impl_unittest.cc
index b6d349e..333b909 100644
--- a/chrome/browser/chromeos/drive/fileapi/webkit_file_stream_reader_impl_unittest.cc
+++ b/chrome/browser/chromeos/drive/fileapi/webkit_file_stream_reader_impl_unittest.cc
@@ -13,9 +13,9 @@
#include "base/threading/thread.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/drive/fake_file_system.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "chrome/browser/chromeos/drive/file_system_interface.h"
#include "components/drive/drive_test_util.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/service/fake_drive_service.h"
#include "components/drive/service/test_util.h"
#include "content/public/test/test_browser_thread_bundle.h"
diff --git a/chrome/browser/chromeos/drive/fileapi/webkit_file_stream_writer_impl.cc b/chrome/browser/chromeos/drive/fileapi/webkit_file_stream_writer_impl.cc
index 40a5c01..7d934a8 100644
--- a/chrome/browser/chromeos/drive/fileapi/webkit_file_stream_writer_impl.cc
+++ b/chrome/browser/chromeos/drive/fileapi/webkit_file_stream_writer_impl.cc
@@ -6,8 +6,8 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "chrome/browser/chromeos/drive/fileapi/fileapi_worker.h"
+#include "components/drive/file_system_core_util.h"
#include "content/public/browser/browser_thread.h"
#include "google_apis/drive/task_util.h"
#include "net/base/io_buffer.h"
diff --git a/chrome/browser/chromeos/drive/remove_stale_cache_files.cc b/chrome/browser/chromeos/drive/remove_stale_cache_files.cc
index be931c48..3193aac 100644
--- a/chrome/browser/chromeos/drive/remove_stale_cache_files.cc
+++ b/chrome/browser/chromeos/drive/remove_stale_cache_files.cc
@@ -5,9 +5,9 @@
#include "chrome/browser/chromeos/drive/remove_stale_cache_files.h"
#include "base/logging.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive.pb.h"
+#include "components/drive/file_cache.h"
+#include "components/drive/resource_metadata.h"
namespace drive {
namespace internal {
diff --git a/chrome/browser/chromeos/drive/remove_stale_cache_files_unittest.cc b/chrome/browser/chromeos/drive/remove_stale_cache_files_unittest.cc
index 2f628bc..ac0a9cd 100644
--- a/chrome/browser/chromeos/drive/remove_stale_cache_files_unittest.cc
+++ b/chrome/browser/chromeos/drive/remove_stale_cache_files_unittest.cc
@@ -10,12 +10,12 @@
#include "base/memory/scoped_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
-#include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "chrome/browser/chromeos/drive/remove_stale_cache_files.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive.pb.h"
#include "components/drive/drive_test_util.h"
+#include "components/drive/fake_free_disk_space_getter.h"
+#include "components/drive/file_system_core_util.h"
+#include "components/drive/resource_metadata.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "google_apis/drive/test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/chromeos/drive/search_metadata.cc b/chrome/browser/chromeos/drive/search_metadata.cc
index e057ce3..31b9e30 100644
--- a/chrome/browser/chromeos/drive/search_metadata.cc
+++ b/chrome/browser/chromeos/drive/search_metadata.cc
@@ -12,8 +12,8 @@
#include "base/metrics/histogram.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "components/drive/drive_api_util.h"
+#include "components/drive/file_system_core_util.h"
#include "net/base/escape.h"
namespace drive {
diff --git a/chrome/browser/chromeos/drive/search_metadata_unittest.cc b/chrome/browser/chromeos/drive/search_metadata_unittest.cc
index ef06bf9a..62b4e36 100644
--- a/chrome/browser/chromeos/drive/search_metadata_unittest.cc
+++ b/chrome/browser/chromeos/drive/search_metadata_unittest.cc
@@ -11,11 +11,11 @@
#include "base/single_thread_task_runner.h"
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
-#include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "components/drive/drive_api_util.h"
#include "components/drive/drive_test_util.h"
+#include "components/drive/fake_free_disk_space_getter.h"
+#include "components/drive/file_cache.h"
+#include "components/drive/file_system_core_util.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/chromeos/drive/sync/entry_revert_performer.cc b/chrome/browser/chromeos/drive/sync/entry_revert_performer.cc
index b196420..478ddfd 100644
--- a/chrome/browser/chromeos/drive/sync/entry_revert_performer.cc
+++ b/chrome/browser/chromeos/drive/sync/entry_revert_performer.cc
@@ -6,12 +6,12 @@
#include "chrome/browser/chromeos/drive/change_list_processor.h"
#include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
-#include "chrome/browser/chromeos/drive/resource_entry_conversion.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive.pb.h"
#include "components/drive/drive_api_util.h"
#include "components/drive/file_change.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_entry_conversion.h"
+#include "components/drive/resource_metadata.h"
#include "google_apis/drive/drive_api_parser.h"
namespace drive {
diff --git a/chrome/browser/chromeos/drive/sync/entry_revert_performer_unittest.cc b/chrome/browser/chromeos/drive/sync/entry_revert_performer_unittest.cc
index 86d6102..2ebd2f7 100644
--- a/chrome/browser/chromeos/drive/sync/entry_revert_performer_unittest.cc
+++ b/chrome/browser/chromeos/drive/sync/entry_revert_performer_unittest.cc
@@ -6,10 +6,10 @@
#include "base/task_runner_util.h"
#include "chrome/browser/chromeos/drive/file_system/operation_test_base.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/file_change.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_metadata.h"
#include "components/drive/service/fake_drive_service.h"
#include "content/public/test/test_utils.h"
#include "google_apis/drive/test_util.h"
diff --git a/chrome/browser/chromeos/drive/sync/entry_update_performer.cc b/chrome/browser/chromeos/drive/sync/entry_update_performer.cc
index d434b5b..8cf208d 100644
--- a/chrome/browser/chromeos/drive/sync/entry_update_performer.cc
+++ b/chrome/browser/chromeos/drive/sync/entry_update_performer.cc
@@ -9,15 +9,15 @@
#include "base/callback_helpers.h"
#include "base/files/file_util.h"
#include "chrome/browser/chromeos/drive/change_list_loader.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
#include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "chrome/browser/chromeos/drive/sync/entry_revert_performer.h"
#include "chrome/browser/chromeos/drive/sync/remove_performer.h"
#include "components/drive/drive.pb.h"
+#include "components/drive/file_cache.h"
#include "components/drive/file_change.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_metadata.h"
#include "google_apis/drive/drive_api_parser.h"
namespace drive {
diff --git a/chrome/browser/chromeos/drive/sync/entry_update_performer_unittest.cc b/chrome/browser/chromeos/drive/sync/entry_update_performer_unittest.cc
index 40de585..d174e56 100644
--- a/chrome/browser/chromeos/drive/sync/entry_update_performer_unittest.cc
+++ b/chrome/browser/chromeos/drive/sync/entry_update_performer_unittest.cc
@@ -8,12 +8,12 @@
#include "base/files/file_util.h"
#include "base/md5.h"
#include "base/task_runner_util.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
#include "chrome/browser/chromeos/drive/file_system/download_operation.h"
#include "chrome/browser/chromeos/drive/file_system/operation_test_base.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive_api_util.h"
+#include "components/drive/file_cache.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_metadata.h"
#include "components/drive/service/fake_drive_service.h"
#include "content/public/test/test_utils.h"
#include "google_apis/drive/drive_api_parser.h"
diff --git a/chrome/browser/chromeos/drive/sync/remove_performer.cc b/chrome/browser/chromeos/drive/sync/remove_performer.cc
index cf1db41..63245cd 100644
--- a/chrome/browser/chromeos/drive/sync/remove_performer.cc
+++ b/chrome/browser/chromeos/drive/sync/remove_performer.cc
@@ -6,13 +6,13 @@
#include "base/sequenced_task_runner.h"
#include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_entry_conversion.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "chrome/browser/chromeos/drive/sync/entry_revert_performer.h"
#include "components/drive/drive.pb.h"
#include "components/drive/drive_api_util.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_entry_conversion.h"
+#include "components/drive/resource_metadata.h"
#include "google_apis/drive/drive_api_parser.h"
namespace drive {
diff --git a/chrome/browser/chromeos/drive/sync/remove_performer_unittest.cc b/chrome/browser/chromeos/drive/sync/remove_performer_unittest.cc
index edc46c6..b6f3a81 100644
--- a/chrome/browser/chromeos/drive/sync/remove_performer_unittest.cc
+++ b/chrome/browser/chromeos/drive/sync/remove_performer_unittest.cc
@@ -6,9 +6,9 @@
#include "base/task_runner_util.h"
#include "chrome/browser/chromeos/drive/file_system/operation_test_base.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_metadata.h"
#include "components/drive/service/fake_drive_service.h"
#include "content/public/test/test_utils.h"
#include "google_apis/drive/drive_api_parser.h"
diff --git a/chrome/browser/chromeos/drive/sync_client.cc b/chrome/browser/chromeos/drive/sync_client.cc
index 19f9275..0807fe5 100644
--- a/chrome/browser/chromeos/drive/sync_client.cc
+++ b/chrome/browser/chromeos/drive/sync_client.cc
@@ -8,12 +8,12 @@
#include "base/bind.h"
#include "base/thread_task_runner_handle.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
#include "chrome/browser/chromeos/drive/file_system/download_operation.h"
#include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "chrome/browser/chromeos/drive/sync/entry_update_performer.h"
#include "components/drive/drive.pb.h"
+#include "components/drive/file_cache.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_scheduler.h"
#include "google_apis/drive/task_util.h"
diff --git a/chrome/browser/chromeos/drive/sync_client.h b/chrome/browser/chromeos/drive/sync_client.h
index 962d3d4..1aedc38 100644
--- a/chrome/browser/chromeos/drive/sync_client.h
+++ b/chrome/browser/chromeos/drive/sync_client.h
@@ -14,9 +14,9 @@
#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/file_errors.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_metadata.h"
namespace base {
class SequencedTaskRunner;
diff --git a/chrome/browser/chromeos/drive/sync_client_unittest.cc b/chrome/browser/chromeos/drive/sync_client_unittest.cc
index 7142d86..a59936a 100644
--- a/chrome/browser/chromeos/drive/sync_client_unittest.cc
+++ b/chrome/browser/chromeos/drive/sync_client_unittest.cc
@@ -14,19 +14,19 @@
#include "base/test/test_timeouts.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/browser/chromeos/drive/change_list_loader.h"
-#include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
#include "chrome/browser/chromeos/drive/file_system/move_operation.h"
#include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
#include "chrome/browser/chromeos/drive/file_system/remove_operation.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_entry_conversion.h"
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
#include "components/drive/drive.pb.h"
#include "components/drive/drive_test_util.h"
#include "components/drive/event_logger.h"
+#include "components/drive/fake_free_disk_space_getter.h"
+#include "components/drive/file_cache.h"
#include "components/drive/file_change.h"
+#include "components/drive/file_system_core_util.h"
#include "components/drive/job_scheduler.h"
+#include "components/drive/resource_entry_conversion.h"
+#include "components/drive/resource_metadata.h"
#include "components/drive/service/fake_drive_service.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "google_apis/drive/drive_api_parser.h"
diff --git a/chrome/browser/chromeos/drive/write_on_cache_file.cc b/chrome/browser/chromeos/drive/write_on_cache_file.cc
index 2a15a79..bcfb30a 100644
--- a/chrome/browser/chromeos/drive/write_on_cache_file.cc
+++ b/chrome/browser/chromeos/drive/write_on_cache_file.cc
@@ -7,8 +7,8 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/threading/sequenced_worker_pool.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "chrome/browser/chromeos/drive/file_system_interface.h"
+#include "components/drive/file_system_core_util.h"
#include "content/public/browser/browser_thread.h"
using content::BrowserThread;
diff --git a/chrome/browser/chromeos/extensions/file_manager/job_event_router.cc b/chrome/browser/chromeos/extensions/file_manager/job_event_router.cc
index e9fa583..a1a5aa1 100644
--- a/chrome/browser/chromeos/extensions/file_manager/job_event_router.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/job_event_router.cc
@@ -7,9 +7,9 @@
#include <cmath>
#include "base/thread_task_runner_handle.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "chrome/browser/chromeos/file_manager/app_id.h"
#include "chrome/browser/profiles/profile.h"
+#include "components/drive/file_system_core_util.h"
#include "content/public/browser/browser_thread.h"
using content::BrowserThread;
diff --git a/chrome/browser/chromeos/file_manager/file_browser_handlers.cc b/chrome/browser/chromeos/file_manager/file_browser_handlers.cc
index 9f80b3d..846adbd 100644
--- a/chrome/browser/chromeos/file_manager/file_browser_handlers.cc
+++ b/chrome/browser/chromeos/file_manager/file_browser_handlers.cc
@@ -12,7 +12,7 @@
#include "base/files/file_util.h"
#include "base/i18n/case_conversion.h"
#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
+#include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/chromeos/file_manager/app_id.h"
#include "chrome/browser/chromeos/file_manager/fileapi_util.h"
#include "chrome/browser/chromeos/file_manager/open_with_browser.h"
diff --git a/chrome/browser/chromeos/file_manager/file_tasks.cc b/chrome/browser/chromeos/file_manager/file_tasks.cc
index 4a01c08..66619f6 100644
--- a/chrome/browser/chromeos/file_manager/file_tasks.cc
+++ b/chrome/browser/chromeos/file_manager/file_tasks.cc
@@ -10,7 +10,7 @@
#include "base/prefs/scoped_user_pref_update.h"
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
+#include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/chromeos/drive/file_task_executor.h"
#include "chrome/browser/chromeos/file_manager/app_id.h"
#include "chrome/browser/chromeos/file_manager/file_browser_handlers.h"
diff --git a/chrome/browser/chromeos/file_manager/fileapi_util.cc b/chrome/browser/chromeos/file_manager/fileapi_util.cc
index a6c051d..3fd1505 100644
--- a/chrome/browser/chromeos/file_manager/fileapi_util.cc
+++ b/chrome/browser/chromeos/file_manager/fileapi_util.cc
@@ -6,12 +6,12 @@
#include "base/files/file.h"
#include "base/files/file_path.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/chromeos/file_manager/app_id.h"
#include "chrome/browser/chromeos/file_manager/filesystem_api_util.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profile.h"
+#include "components/drive/file_system_core_util.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/site_instance.h"
diff --git a/chrome/browser/chromeos/file_manager/filesystem_api_util.cc b/chrome/browser/chromeos/file_manager/filesystem_api_util.cc
index a5e352f..35382c0 100644
--- a/chrome/browser/chromeos/file_manager/filesystem_api_util.cc
+++ b/chrome/browser/chromeos/file_manager/filesystem_api_util.cc
@@ -8,7 +8,6 @@
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "chrome/browser/chromeos/drive/file_system_interface.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/chromeos/file_manager/app_id.h"
@@ -18,6 +17,7 @@
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profile.h"
#include "components/drive/file_errors.h"
+#include "components/drive/file_system_core_util.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
#include "google_apis/drive/task_util.h"
diff --git a/chrome/browser/chromeos/file_manager/open_with_browser.cc b/chrome/browser/chromeos/file_manager/open_with_browser.cc
index 7ac3e3d..5df5f42 100644
--- a/chrome/browser/chromeos/file_manager/open_with_browser.cc
+++ b/chrome/browser/chromeos/file_manager/open_with_browser.cc
@@ -10,7 +10,6 @@
#include "base/path_service.h"
#include "base/threading/sequenced_worker_pool.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "chrome/browser/chromeos/file_manager/filesystem_api_util.h"
#include "chrome/browser/chromeos/fileapi/external_file_url_util.h"
#include "chrome/browser/plugins/plugin_prefs.h"
@@ -24,6 +23,7 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "components/drive/drive_api_util.h"
+#include "components/drive/file_system_core_util.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/plugin_service.h"
#include "content/public/common/pepper_plugin_info.h"
diff --git a/chrome/browser/chromeos/file_manager/path_util.cc b/chrome/browser/chromeos/file_manager/path_util.cc
index 599ffb3..df315b0 100644
--- a/chrome/browser/chromeos/file_manager/path_util.cc
+++ b/chrome/browser/chromeos/file_manager/path_util.cc
@@ -7,10 +7,10 @@
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/sys_info.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/profiles/profile.h"
+#include "components/drive/file_system_core_util.h"
#include "components/user_manager/user.h"
#include "components/user_manager/user_manager.h"
#include "net/base/escape.h"
diff --git a/chrome/browser/chromeos/file_manager/volume_manager.cc b/chrome/browser/chromeos/file_manager/volume_manager.cc
index 69c7a3e..3a2cd56 100644
--- a/chrome/browser/chromeos/file_manager/volume_manager.cc
+++ b/chrome/browser/chromeos/file_manager/volume_manager.cc
@@ -16,7 +16,6 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/chromeos/drive/drive_integration_service.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "chrome/browser/chromeos/drive/file_system_interface.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/chromeos/file_manager/path_util.h"
@@ -30,6 +29,7 @@
#include "chrome/common/pref_names.h"
#include "chromeos/chromeos_switches.h"
#include "chromeos/disks/disk_mount_manager.h"
+#include "components/drive/file_system_core_util.h"
#include "components/storage_monitor/storage_monitor.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
diff --git a/chrome/browser/chromeos/fileapi/external_file_url_request_job.cc b/chrome/browser/chromeos/fileapi/external_file_url_request_job.cc
index cc5490e..2132113 100644
--- a/chrome/browser/chromeos/fileapi/external_file_url_request_job.cc
+++ b/chrome/browser/chromeos/fileapi/external_file_url_request_job.cc
@@ -11,11 +11,11 @@
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "chrome/browser/chromeos/file_manager/fileapi_util.h"
#include "chrome/browser/chromeos/fileapi/external_file_url_util.h"
#include "chrome/browser/extensions/api/file_handlers/mime_util.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "components/drive/file_system_core_util.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/url_constants.h"
diff --git a/chrome/browser/chromeos/fileapi/external_file_url_util_unittest.cc b/chrome/browser/chromeos/fileapi/external_file_url_util_unittest.cc
index 3e83358..e166c08 100644
--- a/chrome/browser/chromeos/fileapi/external_file_url_util_unittest.cc
+++ b/chrome/browser/chromeos/fileapi/external_file_url_util_unittest.cc
@@ -5,9 +5,9 @@
#include "chrome/browser/chromeos/fileapi/external_file_url_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile_manager.h"
+#include "components/drive/file_system_core_util.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "storage/browser/fileapi/file_system_url.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc
index 9be6ff3..602239a 100644
--- a/chrome/browser/chromeos/preferences.cc
+++ b/chrome/browser/chromeos/preferences.cc
@@ -21,7 +21,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/accessibility/magnification_manager.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
+#include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/chromeos/input_method/input_method_syncer.h"
#include "chrome/browser/chromeos/login/session/user_session_manager.h"
#include "chrome/browser/chromeos/net/wake_on_wifi_manager.h"
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc
index 29adec1..b1bae98 100644
--- a/chrome/browser/download/chrome_download_manager_delegate.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -56,7 +56,7 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/drive/download_handler.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
+#include "chrome/browser/chromeos/drive/file_system_util.h"
#endif
#if defined(ENABLE_EXTENSIONS)
diff --git a/chrome/browser/download/download_dir_policy_handler.cc b/chrome/browser/download/download_dir_policy_handler.cc
index cea2ba2..c027e44 100644
--- a/chrome/browser/download/download_dir_policy_handler.cc
+++ b/chrome/browser/download/download_dir_policy_handler.cc
@@ -20,7 +20,7 @@
#include "policy/policy_constants.h"
#if defined(OS_CHROMEOS)
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
+#include "chrome/browser/chromeos/drive/file_system_util.h"
#endif
namespace {
diff --git a/chrome/browser/download/download_dir_policy_handler_unittest.cc b/chrome/browser/download/download_dir_policy_handler_unittest.cc
index b451067..c0ad586 100644
--- a/chrome/browser/download/download_dir_policy_handler_unittest.cc
+++ b/chrome/browser/download/download_dir_policy_handler_unittest.cc
@@ -20,7 +20,7 @@
#include "policy/policy_constants.h"
#if defined(OS_CHROMEOS)
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
+#include "chrome/browser/chromeos/drive/file_system_util.h"
#endif
namespace {
diff --git a/chrome/browser/download/save_package_file_picker.cc b/chrome/browser/download/save_package_file_picker.cc
index 24f086c..cd70d40 100644
--- a/chrome/browser/download/save_package_file_picker.cc
+++ b/chrome/browser/download/save_package_file_picker.cc
@@ -26,7 +26,7 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/drive/download_handler.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
+#include "chrome/browser/chromeos/drive/file_system_util.h"
#endif
using content::RenderProcessHost;
diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc
index 6ab5475..891cec3 100644
--- a/chrome/browser/extensions/webstore_installer.cc
+++ b/chrome/browser/extensions/webstore_installer.cc
@@ -60,7 +60,7 @@
#include "url/gurl.h"
#if defined(OS_CHROMEOS)
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
+#include "chrome/browser/chromeos/drive/file_system_util.h"
#endif
using content::BrowserContext;
diff --git a/chrome/browser/ui/ash/chrome_screenshot_grabber.cc b/chrome/browser/ui/ash/chrome_screenshot_grabber.cc
index 1d20f9f..9642fc5 100644
--- a/chrome/browser/ui/ash/chrome_screenshot_grabber.cc
+++ b/chrome/browser/ui/ash/chrome_screenshot_grabber.cc
@@ -32,7 +32,6 @@
#include "ui/strings/grit/ui_strings.h"
#if defined(OS_CHROMEOS)
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "chrome/browser/chromeos/drive/file_system_interface.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/chromeos/file_manager/open_util.h"
diff --git a/chrome/chrome_browser_chromeos.gypi b/chrome/chrome_browser_chromeos.gypi
index b7a9b4b..f713c95 100644
--- a/chrome/chrome_browser_chromeos.gypi
+++ b/chrome/chrome_browser_chromeos.gypi
@@ -110,8 +110,6 @@
'browser/chromeos/drive/drive_file_stream_reader.h',
'browser/chromeos/drive/drive_integration_service.cc',
'browser/chromeos/drive/drive_integration_service.h',
- 'browser/chromeos/drive/file_cache.cc',
- 'browser/chromeos/drive/file_cache.h',
'browser/chromeos/drive/file_system.cc',
'browser/chromeos/drive/file_system.h',
'browser/chromeos/drive/file_system/copy_operation.cc',
@@ -140,8 +138,6 @@
'browser/chromeos/drive/file_system/touch_operation.h',
'browser/chromeos/drive/file_system/truncate_operation.cc',
'browser/chromeos/drive/file_system/truncate_operation.h',
- 'browser/chromeos/drive/file_system_core_util.cc',
- 'browser/chromeos/drive/file_system_core_util.h',
'browser/chromeos/drive/file_system_interface.cc',
'browser/chromeos/drive/file_system_interface.h',
'browser/chromeos/drive/file_system_metadata.cc',
@@ -165,12 +161,6 @@
'browser/chromeos/drive/fileapi/webkit_file_stream_writer_impl.h',
'browser/chromeos/drive/remove_stale_cache_files.cc',
'browser/chromeos/drive/remove_stale_cache_files.h',
- 'browser/chromeos/drive/resource_entry_conversion.cc',
- 'browser/chromeos/drive/resource_entry_conversion.h',
- 'browser/chromeos/drive/resource_metadata.cc',
- 'browser/chromeos/drive/resource_metadata.h',
- 'browser/chromeos/drive/resource_metadata_storage.cc',
- 'browser/chromeos/drive/resource_metadata_storage.h',
'browser/chromeos/drive/search_metadata.cc',
'browser/chromeos/drive/search_metadata.h',
'browser/chromeos/drive/sync/entry_revert_performer.cc',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index 0bee0ce..d52a918 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -1113,10 +1113,15 @@
],
'chrome_unit_tests_chromeos_sources': [
# TODO(lukasza): Move Drive tests outside of CrOS (crbug.com/498951).
+ '../components/drive/file_cache_unittest.cc',
'../components/drive/file_change_unittest.cc',
+ '../components/drive/file_system_core_util_unittest.cc',
'../components/drive/job_queue_unittest.cc',
'../components/drive/job_scheduler_unittest.cc',
'../components/drive/local_file_reader_unittest.cc',
+ '../components/drive/resource_entry_conversion_unittest.cc',
+ '../components/drive/resource_metadata_storage_unittest.cc',
+ '../components/drive/resource_metadata_unittest.cc',
'browser/chromeos/accessibility/magnification_manager_unittest.cc',
'browser/chromeos/accessibility/spoken_feedback_event_rewriter_unittest.cc',
'browser/chromeos/attestation/attestation_ca_client_unittest.cc',
@@ -1137,9 +1142,6 @@
'browser/chromeos/drive/fake_file_system.cc',
'browser/chromeos/drive/fake_file_system.h',
'browser/chromeos/drive/fake_file_system_unittest.cc',
- 'browser/chromeos/drive/fake_free_disk_space_getter.cc',
- 'browser/chromeos/drive/fake_free_disk_space_getter.h',
- 'browser/chromeos/drive/file_cache_unittest.cc',
'browser/chromeos/drive/file_system/copy_operation_unittest.cc',
'browser/chromeos/drive/file_system/create_directory_operation_unittest.cc',
'browser/chromeos/drive/file_system/create_file_operation_unittest.cc',
@@ -1154,7 +1156,6 @@
'browser/chromeos/drive/file_system/set_property_operation_unittest.cc',
'browser/chromeos/drive/file_system/touch_operation_unittest.cc',
'browser/chromeos/drive/file_system/truncate_operation_unittest.cc',
- 'browser/chromeos/drive/file_system_core_util_unittest.cc',
'browser/chromeos/drive/file_system_unittest.cc',
'browser/chromeos/drive/file_system_util_unittest.cc',
'browser/chromeos/drive/file_task_executor_unittest.cc',
@@ -1162,9 +1163,6 @@
'browser/chromeos/drive/fileapi/fileapi_worker_unittest.cc',
'browser/chromeos/drive/fileapi/webkit_file_stream_reader_impl_unittest.cc',
'browser/chromeos/drive/remove_stale_cache_files_unittest.cc',
- 'browser/chromeos/drive/resource_entry_conversion_unittest.cc',
- 'browser/chromeos/drive/resource_metadata_storage_unittest.cc',
- 'browser/chromeos/drive/resource_metadata_unittest.cc',
'browser/chromeos/drive/search_metadata_unittest.cc',
'browser/chromeos/drive/sync/entry_revert_performer_unittest.cc',
'browser/chromeos/drive/sync/entry_update_performer_unittest.cc',
diff --git a/components/drive.gypi b/components/drive.gypi
index 5750544..3f83bb4 100644
--- a/components/drive.gypi
+++ b/components/drive.gypi
@@ -23,6 +23,7 @@
'../net/net.gyp:net',
'../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation',
'../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_proto_cpp',
+ '../third_party/leveldatabase/leveldatabase.gyp:leveldatabase',
'../third_party/re2/re2.gyp:re2',
],
'sources': [
@@ -40,10 +41,14 @@
'drive/drive_uploader.h',
'drive/event_logger.cc',
'drive/event_logger.h',
+ 'drive/file_cache.cc',
+ 'drive/file_cache.h',
'drive/file_change.cc',
'drive/file_change.h',
'drive/file_errors.cc',
'drive/file_errors.h',
+ 'drive/file_system_core_util.cc',
+ 'drive/file_system_core_util.h',
'drive/job_list.cc',
'drive/job_list.h',
'drive/job_queue.cc',
@@ -52,6 +57,12 @@
'drive/job_scheduler.h',
'drive/local_file_reader.cc',
'drive/local_file_reader.h',
+ 'drive/resource_entry_conversion.cc',
+ 'drive/resource_entry_conversion.h',
+ 'drive/resource_metadata.cc',
+ 'drive/resource_metadata.h',
+ 'drive/resource_metadata_storage.cc',
+ 'drive/resource_metadata_storage.h',
'drive/service/drive_api_service.cc',
'drive/service/drive_api_service.h',
'drive/service/drive_service_interface.cc',
@@ -88,14 +99,16 @@
'../net/net.gyp:net',
],
'sources': [
+ "drive/drive_test_util.cc",
+ "drive/drive_test_util.h",
+ "drive/fake_free_disk_space_getter.cc",
+ "drive/fake_free_disk_space_getter.h",
"drive/service/dummy_drive_service.cc",
"drive/service/dummy_drive_service.h",
"drive/service/fake_drive_service.cc",
"drive/service/fake_drive_service.h",
"drive/service/test_util.cc",
"drive/service/test_util.h",
- "drive/drive_test_util.cc",
- "drive/drive_test_util.h",
],
},
diff --git a/components/drive/BUILD.gn b/components/drive/BUILD.gn
index 37193a3..08a9814 100644
--- a/components/drive/BUILD.gn
+++ b/components/drive/BUILD.gn
@@ -20,10 +20,14 @@ source_set("drive") {
"drive_uploader.h",
"event_logger.cc",
"event_logger.h",
+ "file_cache.cc",
+ "file_cache.h",
"file_change.cc",
"file_change.h",
"file_errors.cc",
"file_errors.h",
+ "file_system_core_util.cc",
+ "file_system_core_util.h",
"job_list.cc",
"job_list.h",
"job_queue.cc",
@@ -32,6 +36,12 @@ source_set("drive") {
"job_scheduler.h",
"local_file_reader.cc",
"local_file_reader.h",
+ "resource_entry_conversion.cc",
+ "resource_entry_conversion.h",
+ "resource_metadata.cc",
+ "resource_metadata.h",
+ "resource_metadata_storage.cc",
+ "resource_metadata_storage.h",
"service/drive_api_service.cc",
"service/drive_api_service.h",
"service/drive_service_interface.cc",
@@ -46,6 +56,8 @@ source_set("drive") {
"//google_apis:google_apis",
"//net:net",
+ "//third_party/cacheinvalidation:cacheinvalidation",
+ "//third_party/leveldatabase:leveldatabase",
"//third_party/re2:re2",
]
public_deps = [
@@ -64,6 +76,8 @@ source_set("test_support") {
sources = [
"drive_test_util.cc",
"drive_test_util.h",
+ "fake_free_disk_space_getter.cc",
+ "fake_free_disk_space_getter.h",
"service/dummy_drive_service.cc",
"service/dummy_drive_service.h",
"service/fake_drive_service.cc",
diff --git a/components/drive/DEPS b/components/drive/DEPS
index 2d849cf..7c978cd 100644
--- a/components/drive/DEPS
+++ b/components/drive/DEPS
@@ -4,6 +4,7 @@ include_rules = [
"+google_apis",
"+google/cacheinvalidation/types.pb.h",
"+net",
+ "+third_party/leveldatabase",
"+third_party/re2",
]
@@ -24,14 +25,20 @@ specific_include_rules = {
# The following test dependencies should be removed to fully componentize this
# directory. crbug.com/498951
- r"(job_scheduler_unittest.cc"
+ r"(file_cache_unittest.cc"
+ r"|file_system_core_util_unittest.cc"
+ r"|job_scheduler_unittest.cc"
+ r"|resource_metadata_storage_unittest.cc"
+ r"|resource_metadata_unittest.cc"
r")": [
"+content/public/test/test_browser_thread_bundle.h",
],
# The dependency below is ok and can stay here for the long-term, because it
# is guarded by #if defined(OS_CHROMEOS) in the source code.
- "drive_test_util\.h": [
+ r"(drive_test_util.h"
+ r"|file_cache.cc"
+ r")": [
"+third_party/cros_system_api/constants/cryptohome.h",
],
}
diff --git a/chrome/browser/chromeos/drive/fake_free_disk_space_getter.cc b/components/drive/fake_free_disk_space_getter.cc
index d2232d3..22df758 100644
--- a/chrome/browser/chromeos/drive/fake_free_disk_space_getter.cc
+++ b/components/drive/fake_free_disk_space_getter.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h"
+#include "components/drive/fake_free_disk_space_getter.h"
#include "components/drive/drive_test_util.h"
diff --git a/chrome/browser/chromeos/drive/fake_free_disk_space_getter.h b/components/drive/fake_free_disk_space_getter.h
index 642af5d..ba6dd3d 100644
--- a/chrome/browser/chromeos/drive/fake_free_disk_space_getter.h
+++ b/components/drive/fake_free_disk_space_getter.h
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FAKE_FREE_DISK_SPACE_GETTER_H_
-#define CHROME_BROWSER_CHROMEOS_DRIVE_FAKE_FREE_DISK_SPACE_GETTER_H_
+#ifndef COMPONENTS_DRIVE_FAKE_FREE_DISK_SPACE_GETTER_H_
+#define COMPONENTS_DRIVE_FAKE_FREE_DISK_SPACE_GETTER_H_
#include <list>
#include "base/basictypes.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
+#include "components/drive/file_cache.h"
namespace drive {
@@ -41,4 +41,4 @@ class FakeFreeDiskSpaceGetter : public internal::FreeDiskSpaceGetterInterface {
} // namespace drive
-#endif // CHROME_BROWSER_CHROMEOS_DRIVE_FAKE_FREE_DISK_SPACE_GETTER_H_
+#endif // COMPONENTS_DRIVE_FAKE_FREE_DISK_SPACE_GETTER_H_
diff --git a/chrome/browser/chromeos/drive/file_cache.cc b/components/drive/file_cache.cc
index 9ffd827..749dd8f 100644
--- a/chrome/browser/chromeos/drive/file_cache.cc
+++ b/components/drive/file_cache.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/drive/file_cache.h"
+#include "components/drive/file_cache.h"
#include <vector>
@@ -17,16 +17,17 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/sys_info.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_metadata_storage.h"
-#include "chromeos/chromeos_constants.h"
#include "components/drive/drive.pb.h"
#include "components/drive/drive_api_util.h"
+#include "components/drive/file_system_core_util.h"
+#include "components/drive/resource_metadata_storage.h"
#include "google_apis/drive/task_util.h"
#include "net/base/filename_util.h"
#include "net/base/mime_sniffer.h"
#include "net/base/mime_util.h"
+#if defined(OS_CHROMEOS)
#include "third_party/cros_system_api/constants/cryptohome.h"
+#endif
namespace drive {
namespace internal {
@@ -243,8 +244,10 @@ FileError FileCache::MarkAsMounted(const std::string& id,
if (mounted_files_.count(id))
return FILE_ERROR_INVALID_OPERATION;
- // Ensure the file is readable to cros_disks. See crbug.com/236994.
base::FilePath path = GetCacheFilePath(id);
+
+#if defined(OS_CHROMEOS)
+ // Ensure the file is readable to cros_disks. See crbug.com/236994.
if (!base::SetPosixFilePermissions(
path,
base::FILE_PERMISSION_READ_BY_USER |
@@ -252,6 +255,7 @@ FileError FileCache::MarkAsMounted(const std::string& id,
base::FILE_PERMISSION_READ_BY_GROUP |
base::FILE_PERMISSION_READ_BY_OTHERS))
return FILE_ERROR_FAILED;
+#endif
mounted_files_.insert(id);
@@ -559,7 +563,12 @@ bool FileCache::HasEnoughSpaceFor(int64 num_bytes,
free_space = base::SysInfo::AmountOfFreeDiskSpace(path);
// Subtract this as if this portion does not exist.
- free_space -= cryptohome::kMinFreeSpaceInBytes;
+#if defined(OS_CHROMEOS)
+ const int64 kMinFreeBytes = cryptohome::kMinFreeSpaceInBytes;
+#else
+ const int64 kMinFreeBytes = 512ull * 1024ull * 1024ull; // 512MB
+#endif
+ free_space -= kMinFreeBytes;
return (free_space >= num_bytes);
}
diff --git a/chrome/browser/chromeos/drive/file_cache.h b/components/drive/file_cache.h
index 8347b44..a523b41 100644
--- a/chrome/browser/chromeos/drive/file_cache.h
+++ b/components/drive/file_cache.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_H_
-#define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_H_
+#ifndef COMPONENTS_DRIVE_FILE_CACHE_H_
+#define COMPONENTS_DRIVE_FILE_CACHE_H_
#include <set>
#include <string>
@@ -13,8 +13,8 @@
#include "base/memory/weak_ptr.h"
#include "base/synchronization/cancellation_flag.h"
#include "base/threading/thread_checker.h"
-#include "chrome/browser/chromeos/drive/resource_metadata_storage.h"
#include "components/drive/file_errors.h"
+#include "components/drive/resource_metadata_storage.h"
namespace base {
class ScopedClosureRunner;
@@ -193,4 +193,4 @@ class FileCache {
} // namespace internal
} // namespace drive
-#endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_H_
+#endif // COMPONENTS_DRIVE_FILE_CACHE_H_
diff --git a/chrome/browser/chromeos/drive/file_cache_unittest.cc b/components/drive/file_cache_unittest.cc
index dbba973..c9ecc1c 100644
--- a/chrome/browser/chromeos/drive/file_cache_unittest.cc
+++ b/components/drive/file_cache_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/drive/file_cache.h"
+#include "components/drive/file_cache.h"
#include <string>
#include <vector>
@@ -15,11 +15,11 @@
#include "base/path_service.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
-#include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_metadata_storage.h"
#include "components/drive/drive.pb.h"
#include "components/drive/drive_test_util.h"
+#include "components/drive/fake_free_disk_space_getter.h"
+#include "components/drive/file_system_core_util.h"
+#include "components/drive/resource_metadata_storage.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "google_apis/drive/test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/chromeos/drive/file_system_core_util.cc b/components/drive/file_system_core_util.cc
index c50a1b9..1e9f00b 100644
--- a/chrome/browser/chromeos/drive/file_system_core_util.cc
+++ b/components/drive/file_system_core_util.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
+#include "components/drive/file_system_core_util.h"
#include <string>
#include <vector>
@@ -22,12 +22,9 @@
#include "base/strings/stringprintf.h"
#include "base/thread_task_runner_handle.h"
#include "base/threading/sequenced_worker_pool.h"
-#include "chrome/browser/chromeos/drive/file_system_interface.h"
-#include "chrome/browser/chromeos/drive/write_on_cache_file.h"
#include "components/drive/drive.pb.h"
#include "components/drive/drive_pref_names.h"
#include "components/drive/job_list.h"
-#include "net/base/escape.h"
namespace drive {
namespace util {
@@ -80,41 +77,6 @@ const base::FilePath& GetDriveMyDriveRootPath() {
return drive_root_path;
}
-base::FilePath GetDriveMountPointPathForUserIdHash(
- const std::string user_id_hash) {
- static const base::FilePath::CharType kSpecialMountPointRoot[] =
- FILE_PATH_LITERAL("/special");
- static const char kDriveMountPointNameBase[] = "drive";
- return base::FilePath(kSpecialMountPointRoot)
- .AppendASCII(net::EscapeQueryParamValue(
- kDriveMountPointNameBase +
- (user_id_hash.empty() ? "" : "-" + user_id_hash),
- false));
-}
-
-bool IsUnderDriveMountPoint(const base::FilePath& path) {
- return !ExtractDrivePath(path).empty();
-}
-
-base::FilePath ExtractDrivePath(const base::FilePath& path) {
- std::vector<base::FilePath::StringType> components;
- path.GetComponents(&components);
- if (components.size() < 3)
- return base::FilePath();
- if (components[0] != FILE_PATH_LITERAL("/"))
- return base::FilePath();
- if (components[1] != FILE_PATH_LITERAL("special"))
- return base::FilePath();
- static const base::FilePath::CharType kPrefix[] = FILE_PATH_LITERAL("drive");
- if (components[2].compare(0, arraysize(kPrefix) - 1, kPrefix) != 0)
- return base::FilePath();
-
- base::FilePath drive_path = GetDriveGrandRootPath();
- for (size_t i = 3; i < components.size(); ++i)
- drive_path = drive_path.Append(components[i]);
- return drive_path;
-}
-
std::string EscapeCacheFileName(const std::string& filename) {
// This is based on net/base/escape.cc: net::(anonymous namespace)::Escape
std::string escaped;
diff --git a/chrome/browser/chromeos/drive/file_system_core_util.h b/components/drive/file_system_core_util.h
index af73750..c273cbe 100644
--- a/chrome/browser/chromeos/drive/file_system_core_util.h
+++ b/components/drive/file_system_core_util.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CORE_UTIL_H_
-#define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CORE_UTIL_H_
+#ifndef COMPONENTS_DRIVE_FILE_SYSTEM_CORE_UTIL_H_
+#define COMPONENTS_DRIVE_FILE_SYSTEM_CORE_UTIL_H_
#include <string>
@@ -42,18 +42,6 @@ const base::FilePath& GetDriveGrandRootPath();
// Returns the path of the directory representing "My Drive".
const base::FilePath& GetDriveMyDriveRootPath();
-// Returns the Drive mount point path, which looks like
-// "/special/drive-<username_hash>", when provided with the |user_id_hash|.
-base::FilePath GetDriveMountPointPathForUserIdHash(std::string user_id_hash);
-
-// Returns true if the given path is under the Drive mount point.
-bool IsUnderDriveMountPoint(const base::FilePath& path);
-
-// Extracts the Drive path from the given path located under the Drive mount
-// point. Returns an empty path if |path| is not under the Drive mount point.
-// Examples: ExtractDrivePath("/special/drive-xxx/foo.txt") => "drive/foo.txt"
-base::FilePath ExtractDrivePath(const base::FilePath& path);
-
// Escapes a file name in Drive cache.
// Replaces percent ('%'), period ('.') and slash ('/') with %XX (hex)
std::string EscapeCacheFileName(const std::string& filename);
@@ -99,4 +87,4 @@ std::string ReadResourceIdFromGDocFile(const base::FilePath& file_path);
} // namespace util
} // namespace drive
-#endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_CORE_UTIL_H_
+#endif // COMPONENTS_DRIVE_FILE_SYSTEM_CORE_UTIL_H_
diff --git a/chrome/browser/chromeos/drive/file_system_core_util_unittest.cc b/components/drive/file_system_core_util_unittest.cc
index 31e30cc..663da28 100644
--- a/chrome/browser/chromeos/drive/file_system_core_util_unittest.cc
+++ b/components/drive/file_system_core_util_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
+#include "components/drive/file_system_core_util.h"
#include <vector>
@@ -12,16 +12,8 @@
#include "base/single_thread_task_runner.h"
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
-#include "chrome/browser/chromeos/drive/file_system_util.h"
-#include "chrome/test/base/testing_profile.h"
#include "content/public/test/test_browser_thread_bundle.h"
-#include "content/public/test/test_file_system_options.h"
#include "google_apis/drive/test_util.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/isolated_context.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace drive {
@@ -31,45 +23,6 @@ class FileSystemUtilTest : public testing::Test {
content::TestBrowserThreadBundle thread_bundle_;
};
-TEST_F(FileSystemUtilTest, IsUnderDriveMountPoint) {
- EXPECT_FALSE(IsUnderDriveMountPoint(
- base::FilePath::FromUTF8Unsafe("/wherever/foo.txt")));
- EXPECT_FALSE(IsUnderDriveMountPoint(
- base::FilePath::FromUTF8Unsafe("/special/foo.txt")));
- EXPECT_FALSE(IsUnderDriveMountPoint(
- base::FilePath::FromUTF8Unsafe("special/drive/foo.txt")));
-
- EXPECT_TRUE(
- IsUnderDriveMountPoint(base::FilePath::FromUTF8Unsafe("/special/drive")));
- EXPECT_TRUE(IsUnderDriveMountPoint(
- base::FilePath::FromUTF8Unsafe("/special/drive/foo.txt")));
- EXPECT_TRUE(IsUnderDriveMountPoint(
- base::FilePath::FromUTF8Unsafe("/special/drive/subdir/foo.txt")));
- EXPECT_TRUE(IsUnderDriveMountPoint(
- base::FilePath::FromUTF8Unsafe("/special/drive-xxx/foo.txt")));
-}
-
-TEST_F(FileSystemUtilTest, ExtractDrivePath) {
- EXPECT_EQ(
- base::FilePath(),
- ExtractDrivePath(base::FilePath::FromUTF8Unsafe("/wherever/foo.txt")));
- EXPECT_EQ(
- base::FilePath(),
- ExtractDrivePath(base::FilePath::FromUTF8Unsafe("/special/foo.txt")));
-
- EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive"),
- ExtractDrivePath(base::FilePath::FromUTF8Unsafe("/special/drive")));
- EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/foo.txt"),
- ExtractDrivePath(
- base::FilePath::FromUTF8Unsafe("/special/drive/foo.txt")));
- EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/subdir/foo.txt"),
- ExtractDrivePath(base::FilePath::FromUTF8Unsafe(
- "/special/drive/subdir/foo.txt")));
- EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/foo.txt"),
- ExtractDrivePath(
- base::FilePath::FromUTF8Unsafe("/special/drive-xxx/foo.txt")));
-}
-
TEST_F(FileSystemUtilTest, EscapeUnescapeCacheFileName) {
const std::string kUnescapedFileName(
"tmp:`~!@#$%^&*()-_=+[{|]}\\\\;\',<.>/?");
diff --git a/chrome/browser/chromeos/drive/resource_entry_conversion.cc b/components/drive/resource_entry_conversion.cc
index 4ea89e3..a4fa83d 100644
--- a/chrome/browser/chromeos/drive/resource_entry_conversion.cc
+++ b/components/drive/resource_entry_conversion.cc
@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/drive/resource_entry_conversion.h"
+#include "components/drive/resource_entry_conversion.h"
#include <string>
#include "base/logging.h"
#include "base/time/time.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "components/drive/drive.pb.h"
#include "components/drive/drive_api_util.h"
+#include "components/drive/file_system_core_util.h"
#include "google_apis/drive/drive_api_parser.h"
namespace drive {
diff --git a/chrome/browser/chromeos/drive/resource_entry_conversion.h b/components/drive/resource_entry_conversion.h
index e9d62c4..2de228e 100644
--- a/chrome/browser/chromeos/drive/resource_entry_conversion.h
+++ b/components/drive/resource_entry_conversion.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_ENTRY_CONVERSION_H_
-#define CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_ENTRY_CONVERSION_H_
+#ifndef COMPONENTS_DRIVE_RESOURCE_ENTRY_CONVERSION_H_
+#define COMPONENTS_DRIVE_RESOURCE_ENTRY_CONVERSION_H_
#include <string>
@@ -50,4 +50,4 @@ void ConvertResourceEntryToFileInfo(const ResourceEntry& entry,
} // namespace drive
-#endif // CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_ENTRY_CONVERSION_H_
+#endif // COMPONENTS_DRIVE_RESOURCE_ENTRY_CONVERSION_H_
diff --git a/chrome/browser/chromeos/drive/resource_entry_conversion_unittest.cc b/components/drive/resource_entry_conversion_unittest.cc
index db6b22d..b3fe252 100644
--- a/chrome/browser/chromeos/drive/resource_entry_conversion_unittest.cc
+++ b/components/drive/resource_entry_conversion_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/drive/resource_entry_conversion.h"
+#include "components/drive/resource_entry_conversion.h"
#include "base/time/time.h"
#include "components/drive/drive.pb.h"
diff --git a/chrome/browser/chromeos/drive/resource_metadata.cc b/components/drive/resource_metadata.cc
index 1842fe5..25250ff 100644
--- a/chrome/browser/chromeos/drive/resource_metadata.cc
+++ b/components/drive/resource_metadata.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
+#include "components/drive/resource_metadata.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
@@ -12,10 +12,10 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/sys_info.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
-#include "chrome/browser/chromeos/drive/resource_metadata_storage.h"
#include "components/drive/drive.pb.h"
+#include "components/drive/file_cache.h"
+#include "components/drive/file_system_core_util.h"
+#include "components/drive/resource_metadata_storage.h"
namespace drive {
namespace internal {
diff --git a/chrome/browser/chromeos/drive/resource_metadata.h b/components/drive/resource_metadata.h
index 32b91b6..3fe2751 100644
--- a/chrome/browser/chromeos/drive/resource_metadata.h
+++ b/components/drive/resource_metadata.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_H_
-#define CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_H_
+#ifndef COMPONENTS_DRIVE_RESOURCE_METADATA_H_
+#define COMPONENTS_DRIVE_RESOURCE_METADATA_H_
#include <set>
#include <string>
@@ -12,8 +12,8 @@
#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
-#include "chrome/browser/chromeos/drive/resource_metadata_storage.h"
#include "components/drive/file_errors.h"
+#include "components/drive/resource_metadata_storage.h"
namespace base {
class SequencedTaskRunner;
@@ -143,4 +143,4 @@ class ResourceMetadata {
} // namespace internal
} // namespace drive
-#endif // CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_H_
+#endif // COMPONENTS_DRIVE_RESOURCE_METADATA_H_
diff --git a/chrome/browser/chromeos/drive/resource_metadata_storage.cc b/components/drive/resource_metadata_storage.cc
index d64adee..fbba7a9 100644
--- a/chrome/browser/chromeos/drive/resource_metadata_storage.cc
+++ b/components/drive/resource_metadata_storage.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/drive/resource_metadata_storage.h"
+#include "components/drive/resource_metadata_storage.h"
#include <map>
#include <set>
diff --git a/chrome/browser/chromeos/drive/resource_metadata_storage.h b/components/drive/resource_metadata_storage.h
index 931037c..8f8c695c 100644
--- a/chrome/browser/chromeos/drive/resource_metadata_storage.h
+++ b/components/drive/resource_metadata_storage.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_STORAGE_H_
-#define CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_STORAGE_H_
+#ifndef COMPONENTS_DRIVE_RESOURCE_METADATA_STORAGE_H_
+#define COMPONENTS_DRIVE_RESOURCE_METADATA_STORAGE_H_
#include <string>
#include <vector>
@@ -169,4 +169,4 @@ class ResourceMetadataStorage {
} // namespace internal
} // namespace drive
-#endif // CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_STORAGE_H_
+#endif // COMPONENTS_DRIVE_RESOURCE_METADATA_STORAGE_H_
diff --git a/chrome/browser/chromeos/drive/resource_metadata_storage_unittest.cc b/components/drive/resource_metadata_storage_unittest.cc
index e6b3860..5596938 100644
--- a/chrome/browser/chromeos/drive/resource_metadata_storage_unittest.cc
+++ b/components/drive/resource_metadata_storage_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/drive/resource_metadata_storage.h"
+#include "components/drive/resource_metadata_storage.h"
#include <algorithm>
diff --git a/chrome/browser/chromeos/drive/resource_metadata_unittest.cc b/components/drive/resource_metadata_unittest.cc
index 0858620..15beb4d 100644
--- a/chrome/browser/chromeos/drive/resource_metadata_unittest.cc
+++ b/components/drive/resource_metadata_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/drive/resource_metadata.h"
+#include "components/drive/resource_metadata.h"
#include <algorithm>
#include <string>
@@ -12,11 +12,11 @@
#include "base/single_thread_task_runner.h"
#include "base/strings/stringprintf.h"
#include "base/thread_task_runner_handle.h"
-#include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h"
-#include "chrome/browser/chromeos/drive/file_cache.h"
-#include "chrome/browser/chromeos/drive/file_system_core_util.h"
#include "components/drive/drive.pb.h"
#include "components/drive/drive_test_util.h"
+#include "components/drive/fake_free_disk_space_getter.h"
+#include "components/drive/file_cache.h"
+#include "components/drive/file_system_core_util.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"