diff options
Diffstat (limited to 'chrome/browser/chromeos')
133 files changed, 1636 insertions, 1561 deletions
diff --git a/chrome/browser/chromeos/accessibility/accessibility_util.cc b/chrome/browser/chromeos/accessibility/accessibility_util.cc index 778b1cb..c74c655 100644 --- a/chrome/browser/chromeos/accessibility/accessibility_util.cc +++ b/chrome/browser/chromeos/accessibility/accessibility_util.cc @@ -168,7 +168,7 @@ void EnableSpokenFeedback(bool enabled, ProfileManager::GetDefaultProfile(); ExtensionService* extension_service = extensions::ExtensionSystem::Get(profile)->extension_service(); - FilePath path = FilePath(extension_misc::kChromeVoxExtensionPath); + base::FilePath path = base::FilePath(extension_misc::kChromeVoxExtensionPath); if (enabled) { // Load ChromeVox std::string extension_id = extension_service->component_loader()->Add(IDR_CHROMEVOX_MANIFEST, diff --git a/chrome/browser/chromeos/boot_times_loader.cc b/chrome/browser/chromeos/boot_times_loader.cc index 027d722..8e522d4 100644 --- a/chrome/browser/chromeos/boot_times_loader.cc +++ b/chrome/browser/chromeos/boot_times_loader.cc @@ -89,23 +89,24 @@ namespace chromeos { #define FPL(value) FILE_PATH_LITERAL(value) // Dir uptime & disk logs are located in. -static const FilePath::CharType kLogPath[] = FPL("/tmp"); +static const base::FilePath::CharType kLogPath[] = FPL("/tmp"); // Dir log{in,out} logs are located in. -static const FilePath::CharType kLoginLogPath[] = FPL("/home/chronos/user"); +static const base::FilePath::CharType kLoginLogPath[] = + FPL("/home/chronos/user"); // Prefix for the time measurement files. -static const FilePath::CharType kUptimePrefix[] = FPL("uptime-"); +static const base::FilePath::CharType kUptimePrefix[] = FPL("uptime-"); // Prefix for the disk usage files. -static const FilePath::CharType kDiskPrefix[] = FPL("disk-"); +static const base::FilePath::CharType kDiskPrefix[] = FPL("disk-"); // Name of the time that Chrome's main() is called. -static const FilePath::CharType kChromeMain[] = FPL("chrome-main"); +static const base::FilePath::CharType kChromeMain[] = FPL("chrome-main"); // Delay in milliseconds between file read attempts. static const int64 kReadAttemptDelayMs = 250; // Delay in milliseconds before writing the login times to disk. static const int64 kLoginTimeWriteDelayMs = 3000; // Names of login stats files. -static const FilePath::CharType kLoginSuccess[] = FPL("login-success"); -static const FilePath::CharType kChromeFirstRender[] = +static const base::FilePath::CharType kLoginSuccess[] = FPL("login-success"); +static const base::FilePath::CharType kChromeFirstRender[] = FPL("chrome-first-render"); // Names of login UMA values. @@ -115,7 +116,7 @@ static const char kUmaLogout[] = "ShutdownTime.Logout"; static const char kUmaLogoutPrefix[] = "ShutdownTime."; // Name of file collecting login times. -static const FilePath::CharType kLoginTimes[] = FPL("login-times"); +static const base::FilePath::CharType kLoginTimes[] = FPL("login-times"); // Name of file collecting logout times. static const char kLogoutTimes[] = "logout-times"; @@ -169,9 +170,9 @@ CancelableTaskTracker::TaskId BootTimesLoader::GetBootTimes( // Extracts the uptime value from files located in /tmp, returning the // value as a double in value. -static bool GetTime(const FilePath::StringType& log, double* value) { - FilePath log_dir(kLogPath); - FilePath log_file = log_dir.Append(log); +static bool GetTime(const base::FilePath::StringType& log, double* value) { + base::FilePath log_dir(kLogPath); + base::FilePath log_file = log_dir.Append(log); std::string contents; *value = 0.0; if (file_util::ReadFileToString(log_file, &contents)) { @@ -196,9 +197,9 @@ static void SendBootTimesToUMA(const BootTimesLoader::BootTimes& boot_times) { // Checks if the times for the most recent boot event have been // reported already to avoid sending boot time histogram samples // every time the user logs out. - static const FilePath::CharType kBootTimesSent[] = + static const base::FilePath::CharType kBootTimesSent[] = FPL("/tmp/boot-times-sent"); - FilePath sent(kBootTimesSent); + base::FilePath sent(kBootTimesSent); if (file_util::PathExists(sent)) return; @@ -238,17 +239,19 @@ void BootTimesLoader::Backend::GetBootTimesAndRunCallback( if (is_canceled_cb.Run()) return; - const FilePath::CharType kFirmwareBootTime[] = FPL("firmware-boot-time"); - const FilePath::CharType kPreStartup[] = FPL("pre-startup"); - const FilePath::CharType kChromeExec[] = FPL("chrome-exec"); - const FilePath::CharType kChromeMain[] = FPL("chrome-main"); - const FilePath::CharType kXStarted[] = FPL("x-started"); - const FilePath::CharType kLoginPromptReady[] = FPL("login-prompt-ready"); - const FilePath::StringType uptime_prefix = kUptimePrefix; + const base::FilePath::CharType kFirmwareBootTime[] = + FPL("firmware-boot-time"); + const base::FilePath::CharType kPreStartup[] = FPL("pre-startup"); + const base::FilePath::CharType kChromeExec[] = FPL("chrome-exec"); + const base::FilePath::CharType kChromeMain[] = FPL("chrome-main"); + const base::FilePath::CharType kXStarted[] = FPL("x-started"); + const base::FilePath::CharType kLoginPromptReady[] = + FPL("login-prompt-ready"); + const base::FilePath::StringType uptime_prefix = kUptimePrefix; // Wait until firmware-boot-time file exists by reposting. - FilePath log_dir(kLogPath); - FilePath log_file = log_dir.Append(kFirmwareBootTime); + base::FilePath log_dir(kLogPath); + base::FilePath log_file = log_dir.Append(kFirmwareBootTime); if (!file_util::PathExists(log_file)) { BrowserThread::PostDelayedTask( BrowserThread::FILE, @@ -284,7 +287,7 @@ void BootTimesLoader::Backend::GetBootTimesAndRunCallback( // Appends the given buffer into the file. Returns the number of bytes // written, or -1 on error. // TODO(satorux): Move this to file_util. -static int AppendFile(const FilePath& file_path, +static int AppendFile(const base::FilePath& file_path, const char* data, int size) { FILE* file = file_util::OpenFile(file_path, "a"); @@ -296,13 +299,14 @@ static int AppendFile(const FilePath& file_path, return num_bytes_written; } -static void RecordStatsDelayed(const FilePath::StringType& name, +static void RecordStatsDelayed(const base::FilePath::StringType& name, const std::string& uptime, const std::string& disk) { - const FilePath log_path(kLogPath); - const FilePath uptime_output = - log_path.Append(FilePath(kUptimePrefix + name)); - const FilePath disk_output = log_path.Append(FilePath(kDiskPrefix + name)); + const base::FilePath log_path(kLogPath); + const base::FilePath uptime_output = + log_path.Append(base::FilePath(kUptimePrefix + name)); + const base::FilePath disk_output = + log_path.Append(base::FilePath(kDiskPrefix + name)); // Append numbers to the files. AppendFile(uptime_output, uptime.data(), uptime.size()); @@ -318,7 +322,7 @@ void BootTimesLoader::WriteTimes( const int kMinTimeMillis = 1; const int kMaxTimeMillis = 30000; const int kNumBuckets = 100; - const FilePath log_path(kLoginLogPath); + const base::FilePath log_path(kLoginLogPath); // Need to sort by time since the entries may have been pushed onto the // vector (on the UI thread) in a different order from which they were @@ -412,8 +416,8 @@ void BootTimesLoader::RecordStats(const std::string& name, const Stats& stats) { } BootTimesLoader::Stats BootTimesLoader::GetCurrentStats() { - const FilePath kProcUptime(FPL("/proc/uptime")); - const FilePath kDiskStat(FPL("/sys/block/sda/stat")); + const base::FilePath kProcUptime(FPL("/proc/uptime")); + const base::FilePath kDiskStat(FPL("/sys/block/sda/stat")); Stats stats; base::ThreadRestrictions::ScopedAllowIO allow_io; file_util::ReadFileToString(kProcUptime, &stats.uptime); diff --git a/chrome/browser/chromeos/camera_detector.cc b/chrome/browser/chromeos/camera_detector.cc index 54615ee..dd85767 100644 --- a/chrome/browser/chromeos/camera_detector.cc +++ b/chrome/browser/chromeos/camera_detector.cc @@ -68,9 +68,9 @@ bool CameraDetector::CheckPresence() { // device may trigger costly device initialization. using file_util::FileEnumerator; FileEnumerator file_enum( - FilePath(kV4LSubsystemDir), false /* not recursive */, + base::FilePath(kV4LSubsystemDir), false /* not recursive */, FileEnumerator::FILES | FileEnumerator::SHOW_SYM_LINKS); - for (FilePath path = file_enum.Next(); !path.empty(); + for (base::FilePath path = file_enum.Next(); !path.empty(); path = file_enum.Next()) { std::string v4l_capabilities; if (chrome::GetUdevDevicePropertyValueByPath( diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc index 2636cf9..7df0c70 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc @@ -770,7 +770,7 @@ void ChromeBrowserMainPartsChromeos::SetupLowMemoryHeadroomFieldTrial() { void ChromeBrowserMainPartsChromeos::SetupZramFieldTrial() { // The dice for this experiment have been thrown at boot. The selected group // number is stored in a file. - const FilePath kZramGroupPath("/home/chronos/.swap_exp_enrolled"); + const base::FilePath kZramGroupPath("/home/chronos/.swap_exp_enrolled"); std::string zram_file_content; // If the file does not exist, the experiment has not started. if (!file_util::ReadFileToString(kZramGroupPath, &zram_file_content)) diff --git a/chrome/browser/chromeos/contacts/contact_database.cc b/chrome/browser/chromeos/contacts/contact_database.cc index 0de9835..d727a30 100644 --- a/chrome/browser/chromeos/contacts/contact_database.cc +++ b/chrome/browser/chromeos/contacts/contact_database.cc @@ -70,7 +70,7 @@ void ContactDatabase::DestroyOnUIThread() { base::Unretained(this))); } -void ContactDatabase::Init(const FilePath& database_dir, +void ContactDatabase::Init(const base::FilePath& database_dir, InitCallback callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); bool* success = new bool(false); @@ -168,7 +168,7 @@ void ContactDatabase::RunLoadCallback( callback.Run(*success, contacts.Pass(), metadata.Pass()); } -void ContactDatabase::InitFromTaskRunner(const FilePath& database_dir, +void ContactDatabase::InitFromTaskRunner(const base::FilePath& database_dir, bool* success) { DCHECK(IsRunByTaskRunner()); DCHECK(success); diff --git a/chrome/browser/chromeos/contacts/contact_database.h b/chrome/browser/chromeos/contacts/contact_database.h index e74e7ef..053f8da 100644 --- a/chrome/browser/chromeos/contacts/contact_database.h +++ b/chrome/browser/chromeos/contacts/contact_database.h @@ -48,7 +48,8 @@ class ContactDatabaseInterface { // Asynchronously initializes the object. |callback| will be invoked on the // UI thread when complete. - virtual void Init(const FilePath& database_dir, InitCallback callback) = 0; + virtual void Init(const base::FilePath& database_dir, + InitCallback callback) = 0; // Asynchronously saves |contacts_to_save| and |metadata| to the database and // removes contacts with IDs contained in |contact_ids_to_delete|. If @@ -76,7 +77,7 @@ class ContactDatabase : public ContactDatabaseInterface { // ContactDatabaseInterface implementation. virtual void DestroyOnUIThread() OVERRIDE; - virtual void Init(const FilePath& database_dir, + virtual void Init(const base::FilePath& database_dir, InitCallback callback) OVERRIDE; virtual void SaveContacts(scoped_ptr<ContactPointers> contacts_to_save, scoped_ptr<ContactIds> contact_ids_to_delete, @@ -107,7 +108,7 @@ class ContactDatabase : public ContactDatabaseInterface { scoped_ptr<UpdateMetadata> metadata); // Initializes the database in |database_dir| and updates |success|. - void InitFromTaskRunner(const FilePath& database_dir, bool* success); + void InitFromTaskRunner(const base::FilePath& database_dir, bool* success); // Saves data to disk and updates |success|. void SaveContactsFromTaskRunner(scoped_ptr<ContactPointers> contacts_to_save, diff --git a/chrome/browser/chromeos/contacts/contact_database_unittest.cc b/chrome/browser/chromeos/contacts/contact_database_unittest.cc index 08e09cd..96e2768 100644 --- a/chrome/browser/chromeos/contacts/contact_database_unittest.cc +++ b/chrome/browser/chromeos/contacts/contact_database_unittest.cc @@ -27,7 +27,7 @@ namespace test { // Name of the directory created within a temporary directory to store the // contacts database. -const FilePath::CharType kDatabaseDirectoryName[] = +const base::FilePath::CharType kDatabaseDirectoryName[] = FILE_PATH_LITERAL("contacts"); class ContactDatabaseTest : public testing::Test { @@ -52,7 +52,7 @@ class ContactDatabaseTest : public testing::Test { } protected: - FilePath database_path() const { + base::FilePath database_path() const { return temp_dir_.path().Append(kDatabaseDirectoryName); } @@ -316,7 +316,7 @@ TEST_F(ContactDatabaseTest, DeleteWhenCorrupt) { // Overwrite all of the files in the database with a space character. file_util::FileEnumerator enumerator( database_path(), false, file_util::FileEnumerator::FILES); - for (FilePath path = enumerator.Next(); !path.empty(); + for (base::FilePath path = enumerator.Next(); !path.empty(); path = enumerator.Next()) { file_util::WriteFile(path, " ", 1); } diff --git a/chrome/browser/chromeos/contacts/fake_contact_database.cc b/chrome/browser/chromeos/contacts/fake_contact_database.cc index 0ce9aab..00b30b8 100644 --- a/chrome/browser/chromeos/contacts/fake_contact_database.cc +++ b/chrome/browser/chromeos/contacts/fake_contact_database.cc @@ -19,7 +19,7 @@ FakeContactDatabase::FakeContactDatabase() DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); } -void FakeContactDatabase::Init(const FilePath& database_dir, +void FakeContactDatabase::Init(const base::FilePath& database_dir, InitCallback callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); callback.Run(init_success_); diff --git a/chrome/browser/chromeos/contacts/fake_contact_database.h b/chrome/browser/chromeos/contacts/fake_contact_database.h index bcadc4e..9263ef6 100644 --- a/chrome/browser/chromeos/contacts/fake_contact_database.h +++ b/chrome/browser/chromeos/contacts/fake_contact_database.h @@ -34,7 +34,7 @@ class FakeContactDatabase : public ContactDatabaseInterface { // ContactDatabaseInterface implementation. virtual void DestroyOnUIThread() OVERRIDE; - virtual void Init(const FilePath& database_dir, + virtual void Init(const base::FilePath& database_dir, InitCallback callback) OVERRIDE; virtual void SaveContacts(scoped_ptr<ContactPointers> contacts_to_save, scoped_ptr<ContactIds> contact_ids_to_delete, diff --git a/chrome/browser/chromeos/contacts/google_contact_store.cc b/chrome/browser/chromeos/contacts/google_contact_store.cc index 43b6a71..ee46ac1 100644 --- a/chrome/browser/chromeos/contacts/google_contact_store.cc +++ b/chrome/browser/chromeos/contacts/google_contact_store.cc @@ -27,7 +27,7 @@ namespace { // Name of the directory within the profile directory where the contact database // is stored. -const FilePath::CharType kDatabaseDirectoryName[] = +const base::FilePath::CharType kDatabaseDirectoryName[] = FILE_PATH_LITERAL("Google Contacts"); // We wait this long after the last update has completed successfully before @@ -125,7 +125,7 @@ void GoogleContactStore::Init() { gdata_service_->Initialize(); } - FilePath db_path = profile_->GetPath().Append(kDatabaseDirectoryName); + base::FilePath db_path = profile_->GetPath().Append(kDatabaseDirectoryName); VLOG(1) << "Initializing contact database \"" << db_path.value() << "\" for " << profile_->GetProfileName(); db_->Init(db_path, diff --git a/chrome/browser/chromeos/cros/burn_library.cc b/chrome/browser/chromeos/cros/burn_library.cc index 24213c61..30da2af 100644 --- a/chrome/browser/chromeos/cros/burn_library.cc +++ b/chrome/browser/chromeos/cros/burn_library.cc @@ -20,7 +20,7 @@ namespace { // Unzips |source_zip_file| and sets the filename of the unzipped image to // |source_image_file|. -void UnzipImage(const FilePath& source_zip_file, +void UnzipImage(const base::FilePath& source_zip_file, const std::string& image_name, scoped_refptr<base::RefCountedString> source_image_file) { if (zip::Unzip(source_zip_file, source_zip_file.DirName())) { @@ -37,10 +37,10 @@ class BurnLibraryImpl : public BurnLibrary { // BurnLibrary implementation. virtual void AddObserver(Observer* observer) OVERRIDE; virtual void RemoveObserver(Observer* observer) OVERRIDE; - virtual void DoBurn(const FilePath& source_path, + virtual void DoBurn(const base::FilePath& source_path, const std::string& image_name, - const FilePath& target_file_path, - const FilePath& target_device_path) OVERRIDE; + const base::FilePath& target_file_path, + const base::FilePath& target_device_path) OVERRIDE; virtual void CancelBurnImage() OVERRIDE; void OnImageUnzipped(scoped_refptr<base::RefCountedString> source_image_file); @@ -112,10 +112,10 @@ void BurnLibraryImpl::CancelBurnImage() { cancelled_ = true; } -void BurnLibraryImpl::DoBurn(const FilePath& source_path, +void BurnLibraryImpl::DoBurn(const base::FilePath& source_path, const std::string& image_name, - const FilePath& target_file_path, - const FilePath& target_device_path) { + const base::FilePath& target_file_path, + const base::FilePath& target_device_path) { if (unzipping_) { // We have unzip in progress, maybe it was "cancelled" before and did not // finish yet. In that case, let's pretend cancel did not happen. @@ -230,10 +230,10 @@ class BurnLibraryStubImpl : public BurnLibrary { virtual void Init() OVERRIDE {} virtual void AddObserver(Observer* observer) OVERRIDE {} virtual void RemoveObserver(Observer* observer) OVERRIDE {} - virtual void DoBurn(const FilePath& source_path, + virtual void DoBurn(const base::FilePath& source_path, const std::string& image_name, - const FilePath& target_file_path, - const FilePath& target_device_path) OVERRIDE { + const base::FilePath& target_file_path, + const base::FilePath& target_device_path) OVERRIDE { } virtual void CancelBurnImage() OVERRIDE {} diff --git a/chrome/browser/chromeos/cros/burn_library.h b/chrome/browser/chromeos/cros/burn_library.h index b617aa4..202178e 100644 --- a/chrome/browser/chromeos/cros/burn_library.h +++ b/chrome/browser/chromeos/cros/burn_library.h @@ -51,10 +51,10 @@ class BurnLibrary { virtual void RemoveObserver(Observer* observer) = 0; // Example values: // DoBurn(image.bin.zip, image.bin, /dev/sdb, /sys/devices/pci..../block.sdb). - virtual void DoBurn(const FilePath& source_path, + virtual void DoBurn(const base::FilePath& source_path, const std::string& image_name, - const FilePath& target_file_path, - const FilePath& target_device_path) = 0; + const base::FilePath& target_file_path, + const base::FilePath& target_device_path) = 0; virtual void CancelBurnImage() = 0; // Factory function, creates a new instance and returns ownership. diff --git a/chrome/browser/chromeos/customization_document.cc b/chrome/browser/chromeos/customization_document.cc index 052ef2a..bad0dc9 100644 --- a/chrome/browser/chromeos/customization_document.cc +++ b/chrome/browser/chromeos/customization_document.cc @@ -80,7 +80,7 @@ CustomizationDocument::CustomizationDocument( CustomizationDocument::~CustomizationDocument() {} bool CustomizationDocument::LoadManifestFromFile( - const FilePath& manifest_path) { + const base::FilePath& manifest_path) { std::string manifest; if (!file_util::ReadFileToString(manifest_path, &manifest)) return false; @@ -146,7 +146,7 @@ StartupCustomizationDocument::StartupCustomizationDocument() // Loading manifest causes us to do blocking IO on UI thread. // Temporarily allow it until we fix http://crosbug.com/11103 base::ThreadRestrictions::ScopedAllowIO allow_io; - LoadManifestFromFile(FilePath(kStartupCustomizationManifestPath)); + LoadManifestFromFile(base::FilePath(kStartupCustomizationManifestPath)); } Init(chromeos::system::StatisticsProvider::GetInstance()); } @@ -270,13 +270,14 @@ void ServicesCustomizationDocument::StartFetching() { BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(&ServicesCustomizationDocument::ReadFileInBackground, base::Unretained(this), // this class is a singleton. - FilePath(url_.path()))); + base::FilePath(url_.path()))); } else { StartFileFetch(); } } -void ServicesCustomizationDocument::ReadFileInBackground(const FilePath& file) { +void ServicesCustomizationDocument::ReadFileInBackground( + const base::FilePath& file) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); std::string manifest; diff --git a/chrome/browser/chromeos/drive/drive_cache.cc b/chrome/browser/chromeos/drive/drive_cache.cc index 8c33b79..3ea0a62 100644 --- a/chrome/browser/chromeos/drive/drive_cache.cc +++ b/chrome/browser/chromeos/drive/drive_cache.cc @@ -27,21 +27,23 @@ using content::BrowserThread; namespace drive { namespace { -const FilePath::CharType kDriveCacheVersionDir[] = FILE_PATH_LITERAL("v1"); -const FilePath::CharType kDriveCacheMetaDir[] = FILE_PATH_LITERAL("meta"); -const FilePath::CharType kDriveCachePinnedDir[] = FILE_PATH_LITERAL("pinned"); -const FilePath::CharType kDriveCacheOutgoingDir[] = +const base::FilePath::CharType kDriveCacheVersionDir[] = + FILE_PATH_LITERAL("v1"); +const base::FilePath::CharType kDriveCacheMetaDir[] = FILE_PATH_LITERAL("meta"); +const base::FilePath::CharType kDriveCachePinnedDir[] = + FILE_PATH_LITERAL("pinned"); +const base::FilePath::CharType kDriveCacheOutgoingDir[] = FILE_PATH_LITERAL("outgoing"); -const FilePath::CharType kDriveCachePersistentDir[] = +const base::FilePath::CharType kDriveCachePersistentDir[] = FILE_PATH_LITERAL("persistent"); -const FilePath::CharType kDriveCacheTmpDir[] = FILE_PATH_LITERAL("tmp"); -const FilePath::CharType kDriveCacheTmpDownloadsDir[] = +const base::FilePath::CharType kDriveCacheTmpDir[] = FILE_PATH_LITERAL("tmp"); +const base::FilePath::CharType kDriveCacheTmpDownloadsDir[] = FILE_PATH_LITERAL("tmp/downloads"); -const FilePath::CharType kDriveCacheTmpDocumentsDir[] = +const base::FilePath::CharType kDriveCacheTmpDocumentsDir[] = FILE_PATH_LITERAL("tmp/documents"); // Create cache directory paths and set permissions. -bool InitCachePaths(const std::vector<FilePath>& cache_paths) { +bool InitCachePaths(const std::vector<base::FilePath>& cache_paths) { if (cache_paths.size() < DriveCache::NUM_CACHE_TYPES) { NOTREACHED(); LOG(ERROR) << "Size of cache_paths is invalid."; @@ -65,12 +67,12 @@ bool InitCachePaths(const std::vector<FilePath>& cache_paths) { // Remove all files under the given directory, non-recursively. // Do not remove recursively as we don't want to touch <gcache>/tmp/downloads, // which is used for user initiated downloads like "Save As" -void RemoveAllFiles(const FilePath& directory) { +void RemoveAllFiles(const base::FilePath& directory) { using file_util::FileEnumerator; FileEnumerator enumerator(directory, false /* recursive */, FileEnumerator::FILES); - for (FilePath file_path = enumerator.Next(); !file_path.empty(); + for (base::FilePath file_path = enumerator.Next(); !file_path.empty(); file_path = enumerator.Next()) { DVLOG(1) << "Removing " << file_path.value(); if (!file_util::Delete(file_path, false /* recursive */)) @@ -79,7 +81,7 @@ void RemoveAllFiles(const FilePath& directory) { } // Deletes the symlink. -void DeleteSymlink(const FilePath& symlink_path) { +void DeleteSymlink(const base::FilePath& symlink_path) { // We try to save one file operation by not checking if link exists before // deleting it, so unlink may return error if link doesn't exist, but it // doesn't really matter to us. @@ -87,8 +89,8 @@ void DeleteSymlink(const FilePath& symlink_path) { } // Creates a symlink. -bool CreateSymlink(const FilePath& cache_file_path, - const FilePath& symlink_path) { +bool CreateSymlink(const base::FilePath& cache_file_path, + const base::FilePath& symlink_path) { // Remove symlink because creating a link will not overwrite an existing one. DeleteSymlink(symlink_path); @@ -102,7 +104,8 @@ bool CreateSymlink(const FilePath& cache_file_path, } // Moves the file. -bool MoveFile(const FilePath& source_path, const FilePath& dest_path) { +bool MoveFile(const base::FilePath& source_path, + const base::FilePath& dest_path) { if (!file_util::Move(source_path, dest_path)) { LOG(ERROR) << "Failed to move " << source_path.value() << " to " << dest_path.value(); @@ -113,7 +116,8 @@ bool MoveFile(const FilePath& source_path, const FilePath& dest_path) { } // Copies the file. -bool CopyFile(const FilePath& source_path, const FilePath& dest_path) { +bool CopyFile(const base::FilePath& source_path, + const base::FilePath& dest_path) { if (!file_util::CopyFile(source_path, dest_path)) { LOG(ERROR) << "Failed to copy " << source_path.value() << " to " << dest_path.value(); @@ -127,8 +131,8 @@ bool CopyFile(const FilePath& source_path, const FilePath& dest_path) { // |path_to_keep| on blocking pool. // If |path_to_keep| is empty, all files in |path_to_delete_pattern| are // deleted. -void DeleteFilesSelectively(const FilePath& path_to_delete_pattern, - const FilePath& path_to_keep) { +void DeleteFilesSelectively(const base::FilePath& path_to_delete_pattern, + const base::FilePath& path_to_keep) { // Enumerate all files in directory of |path_to_delete_pattern| that match // base name of |path_to_delete_pattern|. // If a file is not |path_to_keep|, delete it. @@ -138,7 +142,7 @@ void DeleteFilesSelectively(const FilePath& path_to_delete_pattern, file_util::FileEnumerator::FILES | file_util::FileEnumerator::SHOW_SYM_LINKS, path_to_delete_pattern.BaseName().value()); - for (FilePath current = enumerator.Next(); !current.empty(); + for (base::FilePath current = enumerator.Next(); !current.empty(); current = enumerator.Next()) { // If |path_to_keep| is not empty and same as current, don't delete it. if (!path_to_keep.empty() && current == path_to_keep) @@ -156,7 +160,7 @@ void DeleteFilesSelectively(const FilePath& path_to_delete_pattern, // Used to implement GetFile, MarkAsMounted. void RunGetFileFromCacheCallback( const GetFileFromCacheCallback& callback, - scoped_ptr<std::pair<DriveFileError, FilePath> > result) { + scoped_ptr<std::pair<DriveFileError, base::FilePath> > result) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); DCHECK(result.get()); @@ -176,7 +180,7 @@ void RunGetCacheEntryCallback(const GetCacheEntryCallback& callback, } // namespace -DriveCache::DriveCache(const FilePath& cache_root_path, +DriveCache::DriveCache(const base::FilePath& cache_root_path, base::SequencedTaskRunner* blocking_task_runner, FreeDiskSpaceGetterInterface* free_disk_space_getter) : cache_root_path_(cache_root_path), @@ -194,17 +198,18 @@ DriveCache::~DriveCache() { AssertOnSequencedWorkerPool(); } -FilePath DriveCache::GetCacheDirectoryPath( +base::FilePath DriveCache::GetCacheDirectoryPath( CacheSubDirectoryType sub_dir_type) const { DCHECK_LE(0, sub_dir_type); DCHECK_GT(NUM_CACHE_TYPES, sub_dir_type); return cache_paths_[sub_dir_type]; } -FilePath DriveCache::GetCacheFilePath(const std::string& resource_id, - const std::string& md5, - CacheSubDirectoryType sub_dir_type, - CachedFileOrigin file_origin) const { +base::FilePath DriveCache::GetCacheFilePath( + const std::string& resource_id, + const std::string& md5, + CacheSubDirectoryType sub_dir_type, + CachedFileOrigin file_origin) const { DCHECK(sub_dir_type != CACHE_TYPE_META); // Runs on any thread. @@ -213,17 +218,17 @@ FilePath DriveCache::GetCacheFilePath(const std::string& resource_id, std::string base_name = util::EscapeCacheFileName(resource_id); if (file_origin == CACHED_FILE_LOCALLY_MODIFIED) { DCHECK(sub_dir_type == CACHE_TYPE_PERSISTENT); - base_name += FilePath::kExtensionSeparator; + base_name += base::FilePath::kExtensionSeparator; base_name += util::kLocallyModifiedFileExtension; } else if (!md5.empty()) { - base_name += FilePath::kExtensionSeparator; + base_name += base::FilePath::kExtensionSeparator; base_name += util::EscapeCacheFileName(md5); } // For mounted archives the filename is formatted as resource_id.md5.mounted, // i.e. resource_id.md5 is the base name and ".mounted" is the extension if (file_origin == CACHED_FILE_MOUNTED) { DCHECK(sub_dir_type == CACHE_TYPE_PERSISTENT); - base_name += FilePath::kExtensionSeparator; + base_name += base::FilePath::kExtensionSeparator; base_name += util::kMountedArchiveFileExtension; } return GetCacheDirectoryPath(sub_dir_type).Append(base_name); @@ -234,7 +239,7 @@ void DriveCache::AssertOnSequencedWorkerPool() { blocking_task_runner_->RunsTasksOnCurrentThread()); } -bool DriveCache::IsUnderDriveCacheDirectory(const FilePath& path) const { +bool DriveCache::IsUnderDriveCacheDirectory(const base::FilePath& path) const { return cache_root_path_ == path || cache_root_path_.IsParent(path); } @@ -309,7 +314,7 @@ void DriveCache::GetFile(const std::string& resource_id, void DriveCache::Store(const std::string& resource_id, const std::string& md5, - const FilePath& source_path, + const base::FilePath& source_path, FileOperationType file_operation_type, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -368,7 +373,7 @@ void DriveCache::MarkAsMounted(const std::string& resource_id, base::Bind(RunGetFileFromCacheCallback, callback)); } -void DriveCache::MarkAsUnmounted(const FilePath& file_path, +void DriveCache::MarkAsUnmounted(const base::FilePath& file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -574,7 +579,7 @@ scoped_ptr<DriveCache::GetFileResult> DriveCache::GetFileOnBlockingPool( DriveFileError DriveCache::StoreOnBlockingPool( const std::string& resource_id, const std::string& md5, - const FilePath& source_path, + const base::FilePath& source_path, FileOperationType file_operation_type) { AssertOnSequencedWorkerPool(); @@ -590,7 +595,7 @@ DriveFileError DriveCache::StoreOnBlockingPool( return DRIVE_FILE_ERROR_NO_SPACE; } - FilePath symlink_path; + base::FilePath symlink_path; CacheSubDirectoryType sub_dir_type = CACHE_TYPE_TMP; // If file was previously pinned, store it in persistent dir. @@ -610,7 +615,7 @@ DriveFileError DriveCache::StoreOnBlockingPool( sub_dir_type = CACHE_TYPE_PERSISTENT; } - FilePath dest_path = GetCacheFilePath(resource_id, md5, sub_dir_type, + base::FilePath dest_path = GetCacheFilePath(resource_id, md5, sub_dir_type, CACHED_FILE_FROM_SERVER); bool success = false; switch (file_operation_type) { @@ -626,7 +631,7 @@ DriveFileError DriveCache::StoreOnBlockingPool( // Create symlink in pinned directory if the file is pinned. if (success && cache_entry.is_pinned()) { - FilePath symlink_path = GetCacheFilePath(resource_id, std::string(), + base::FilePath symlink_path = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_PINNED, CACHED_FILE_FROM_SERVER); success = CreateSymlink(dest_path, symlink_path); @@ -634,7 +639,7 @@ DriveFileError DriveCache::StoreOnBlockingPool( // Determine search pattern for stale filenames corresponding to resource_id, // either "<resource_id>*" or "<resource_id>.*". - FilePath stale_filenames_pattern; + base::FilePath stale_filenames_pattern; if (md5.empty()) { // No md5 means no extension, append '*' after base name, i.e. // "<resource_id>*". @@ -642,7 +647,8 @@ DriveFileError DriveCache::StoreOnBlockingPool( // if base name of |dest_path| (i.e. escaped resource_id) contains the // extension separator '.', ReplaceExtension will remove it and everything // after it. The result will be nothing like the escaped resource_id. - stale_filenames_pattern = FilePath(dest_path.value() + util::kWildCard); + stale_filenames_pattern = + base::FilePath(dest_path.value() + util::kWildCard); } else { // Replace md5 extension with '*' i.e. "<resource_id>.*". // Note that ReplaceExtension automatically prefixes the extension with the @@ -668,7 +674,7 @@ DriveFileError DriveCache::PinOnBlockingPool(const std::string& resource_id, const std::string& md5) { AssertOnSequencedWorkerPool(); - FilePath dest_path; + base::FilePath dest_path; CacheSubDirectoryType sub_dir_type = CACHE_TYPE_PERSISTENT; DriveCacheEntry cache_entry; @@ -676,7 +682,7 @@ DriveFileError DriveCache::PinOnBlockingPool(const std::string& resource_id, // Entry does not exist in cache. Set |dest_path| to /dev/null, so that // symlinks to /dev/null will be picked up by DriveSyncClient to download // pinned files that don't exist in cache. - dest_path = FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull); + dest_path = base::FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull); // Set sub_dir_type to TMP. The file will be first downloaded in 'tmp', // then moved to 'persistent'. @@ -701,7 +707,7 @@ DriveFileError DriveCache::PinOnBlockingPool(const std::string& resource_id, } // File exists, move it to persistent dir. // Gets the current path of the file in cache. - FilePath source_path = GetCacheFilePath(resource_id, + base::FilePath source_path = GetCacheFilePath(resource_id, md5, GetSubDirectoryType(cache_entry), CACHED_FILE_FROM_SERVER); @@ -715,7 +721,7 @@ DriveFileError DriveCache::PinOnBlockingPool(const std::string& resource_id, } // Create symlink in pinned dir. - FilePath symlink_path = GetCacheFilePath(resource_id, + base::FilePath symlink_path = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_PINNED, CACHED_FILE_FROM_SERVER); @@ -755,12 +761,12 @@ DriveFileError DriveCache::UnpinOnBlockingPool(const std::string& resource_id, // don't need to move the file. if (cache_entry.is_present()) { // Gets the current path of the file in cache. - FilePath source_path = GetCacheFilePath(resource_id, + base::FilePath source_path = GetCacheFilePath(resource_id, md5, GetSubDirectoryType(cache_entry), CACHED_FILE_FROM_SERVER); // File exists, move it to tmp dir. - FilePath dest_path = GetCacheFilePath(resource_id, + base::FilePath dest_path = GetCacheFilePath(resource_id, md5, CACHE_TYPE_TMP, CACHED_FILE_FROM_SERVER); @@ -771,7 +777,7 @@ DriveFileError DriveCache::UnpinOnBlockingPool(const std::string& resource_id, // If file was pinned, remove the symlink in pinned dir. if (cache_entry.is_pinned()) { - FilePath symlink_path = GetCacheFilePath(resource_id, + base::FilePath symlink_path = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_PINNED, CACHED_FILE_FROM_SERVER); @@ -813,12 +819,12 @@ scoped_ptr<DriveCache::GetFileResult> DriveCache::MarkAsMountedOnBlockingPool( // Get the subdir type and path for the unmounted state. CacheSubDirectoryType unmounted_subdir = cache_entry.is_pinned() ? CACHE_TYPE_PERSISTENT : CACHE_TYPE_TMP; - FilePath unmounted_path = GetCacheFilePath( + base::FilePath unmounted_path = GetCacheFilePath( resource_id, md5, unmounted_subdir, CACHED_FILE_FROM_SERVER); // Get the subdir type and path for the mounted state. CacheSubDirectoryType mounted_subdir = CACHE_TYPE_PERSISTENT; - FilePath mounted_path = GetCacheFilePath( + base::FilePath mounted_path = GetCacheFilePath( resource_id, md5, mounted_subdir, CACHED_FILE_MOUNTED); // Move cache file. @@ -837,7 +843,7 @@ scoped_ptr<DriveCache::GetFileResult> DriveCache::MarkAsMountedOnBlockingPool( } DriveFileError DriveCache::MarkAsUnmountedOnBlockingPool( - const FilePath& file_path) { + const base::FilePath& file_path) { AssertOnSequencedWorkerPool(); // Parse file path to obtain resource_id, md5 and extra_extension. @@ -859,12 +865,12 @@ DriveFileError DriveCache::MarkAsUnmountedOnBlockingPool( // Get the subdir type and path for the unmounted state. CacheSubDirectoryType unmounted_subdir = cache_entry.is_pinned() ? CACHE_TYPE_PERSISTENT : CACHE_TYPE_TMP; - FilePath unmounted_path = GetCacheFilePath( + base::FilePath unmounted_path = GetCacheFilePath( resource_id, md5, unmounted_subdir, CACHED_FILE_FROM_SERVER); // Get the subdir type and path for the mounted state. CacheSubDirectoryType mounted_subdir = CACHE_TYPE_PERSISTENT; - FilePath mounted_path = GetCacheFilePath( + base::FilePath mounted_path = GetCacheFilePath( resource_id, md5, mounted_subdir, CACHED_FILE_MOUNTED); // Move cache file. @@ -911,7 +917,7 @@ DriveFileError DriveCache::MarkDirtyOnBlockingPool( DCHECK(cache_entry.is_persistent()); // Determine symlink path in outgoing dir, so as to remove it. - FilePath symlink_path = GetCacheFilePath(resource_id, + base::FilePath symlink_path = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_OUTGOING, CACHED_FILE_FROM_SERVER); @@ -923,13 +929,13 @@ DriveFileError DriveCache::MarkDirtyOnBlockingPool( // Move file to persistent dir with new .local extension. // Get the current path of the file in cache. - FilePath source_path = GetCacheFilePath(resource_id, + base::FilePath source_path = GetCacheFilePath(resource_id, md5, GetSubDirectoryType(cache_entry), CACHED_FILE_FROM_SERVER); // Determine destination path. const CacheSubDirectoryType sub_dir_type = CACHE_TYPE_PERSISTENT; - FilePath cache_file_path = GetCacheFilePath(resource_id, + base::FilePath cache_file_path = GetCacheFilePath(resource_id, md5, sub_dir_type, CACHED_FILE_LOCALLY_MODIFIED); @@ -938,7 +944,7 @@ DriveFileError DriveCache::MarkDirtyOnBlockingPool( // If file is pinned, update symlink in pinned dir. if (success && cache_entry.is_pinned()) { - FilePath symlink_path = GetCacheFilePath(resource_id, + base::FilePath symlink_path = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_PINNED, CACHED_FILE_FROM_SERVER); @@ -989,13 +995,13 @@ DriveFileError DriveCache::CommitDirtyOnBlockingPool( DCHECK(cache_entry.is_persistent()); // Create symlink in outgoing dir. - FilePath symlink_path = GetCacheFilePath(resource_id, + base::FilePath symlink_path = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_OUTGOING, CACHED_FILE_FROM_SERVER); // Get target path of symlink i.e. current path of the file in cache. - FilePath target_path = GetCacheFilePath(resource_id, + base::FilePath target_path = GetCacheFilePath(resource_id, md5, GetSubDirectoryType(cache_entry), CACHED_FILE_LOCALLY_MODIFIED); @@ -1036,7 +1042,7 @@ DriveFileError DriveCache::ClearDirtyOnBlockingPool( DCHECK(cache_entry.is_persistent()); // Get the current path of the file in cache. - FilePath source_path = GetCacheFilePath(resource_id, + base::FilePath source_path = GetCacheFilePath(resource_id, md5, GetSubDirectoryType(cache_entry), CACHED_FILE_LOCALLY_MODIFIED); @@ -1046,7 +1052,7 @@ DriveFileError DriveCache::ClearDirtyOnBlockingPool( // otherwise, move it to tmp dir with .md5 extension. const CacheSubDirectoryType sub_dir_type = cache_entry.is_pinned() ? CACHE_TYPE_PERSISTENT : CACHE_TYPE_TMP; - FilePath dest_path = GetCacheFilePath(resource_id, + base::FilePath dest_path = GetCacheFilePath(resource_id, md5, sub_dir_type, CACHED_FILE_FROM_SERVER); @@ -1055,7 +1061,7 @@ DriveFileError DriveCache::ClearDirtyOnBlockingPool( if (success) { // Delete symlink in outgoing dir. - FilePath symlink_path = GetCacheFilePath(resource_id, + base::FilePath symlink_path = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_OUTGOING, CACHED_FILE_FROM_SERVER); @@ -1064,7 +1070,7 @@ DriveFileError DriveCache::ClearDirtyOnBlockingPool( // If file is pinned, update symlink in pinned dir. if (success && cache_entry.is_pinned()) { - FilePath symlink_path = GetCacheFilePath(resource_id, + base::FilePath symlink_path = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_PINNED, CACHED_FILE_FROM_SERVER); @@ -1106,7 +1112,7 @@ DriveFileError DriveCache::RemoveOnBlockingPool( // Determine paths to delete all cache versions of |resource_id| in // persistent, tmp and pinned directories. - std::vector<FilePath> paths_to_delete; + std::vector<base::FilePath> paths_to_delete; // For files in persistent and tmp dirs, delete files that match // "<resource_id>.*". @@ -1129,7 +1135,7 @@ DriveFileError DriveCache::RemoveOnBlockingPool( // Don't delete locally modified (i.e. dirty and possibly outgoing) files. // Since we're not deleting outgoing symlinks, we don't need to append // outgoing path to |paths_to_delete|. - FilePath path_to_keep = GetCacheFilePath(resource_id, + base::FilePath path_to_keep = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_PERSISTENT, CACHED_FILE_LOCALLY_MODIFIED); @@ -1212,7 +1218,8 @@ void DriveCache::OnCommitDirty(const std::string& resource_id, OnCacheCommitted(resource_id)); } -bool DriveCache::HasEnoughSpaceFor(int64 num_bytes, const FilePath& path) { +bool DriveCache::HasEnoughSpaceFor(int64 num_bytes, + const base::FilePath& path) { int64 free_space = 0; if (free_disk_space_getter_) free_space = free_disk_space_getter_->AmountOfFreeDiskSpace(); @@ -1225,18 +1232,18 @@ bool DriveCache::HasEnoughSpaceFor(int64 num_bytes, const FilePath& path) { } // static -FilePath DriveCache::GetCacheRootPath(Profile* profile) { - FilePath cache_base_path; +base::FilePath DriveCache::GetCacheRootPath(Profile* profile) { + base::FilePath cache_base_path; chrome::GetUserCacheDirectory(profile->GetPath(), &cache_base_path); - FilePath cache_root_path = + base::FilePath cache_root_path = cache_base_path.Append(chrome::kDriveCacheDirname); return cache_root_path.Append(kDriveCacheVersionDir); } // static -std::vector<FilePath> DriveCache::GetCachePaths( - const FilePath& cache_root_path) { - std::vector<FilePath> cache_paths; +std::vector<base::FilePath> DriveCache::GetCachePaths( + const base::FilePath& cache_root_path) { + std::vector<base::FilePath> cache_paths; // The order should match DriveCache::CacheSubDirectoryType enum. cache_paths.push_back(cache_root_path.Append(kDriveCacheMetaDir)); cache_paths.push_back(cache_root_path.Append(kDriveCachePinnedDir)); @@ -1250,7 +1257,7 @@ std::vector<FilePath> DriveCache::GetCachePaths( // static bool DriveCache::CreateCacheDirectories( - const std::vector<FilePath>& paths_to_create) { + const std::vector<base::FilePath>& paths_to_create) { bool success = true; for (size_t i = 0; i < paths_to_create.size(); ++i) { diff --git a/chrome/browser/chromeos/drive/drive_cache.h b/chrome/browser/chromeos/drive/drive_cache.h index b3a4302..d3c867c 100644 --- a/chrome/browser/chromeos/drive/drive_cache.h +++ b/chrome/browser/chromeos/drive/drive_cache.h @@ -32,7 +32,7 @@ class DriveCacheObserver; // Callback for GetFileFromCache. typedef base::Callback<void(DriveFileError error, - const FilePath& cache_file_path)> + const base::FilePath& cache_file_path)> GetFileFromCacheCallback; // Callback for GetCacheEntry. @@ -101,7 +101,7 @@ class DriveCache { // // |free_disk_space_getter| is used to inject a custom free disk space // getter for testing. NULL must be passed for production code. - DriveCache(const FilePath& cache_root_path, + DriveCache(const base::FilePath& cache_root_path, base::SequencedTaskRunner* blocking_task_runner, FreeDiskSpaceGetterInterface* free_disk_space_getter); @@ -109,12 +109,13 @@ class DriveCache { // directory type. Example: <user_profile_dir>/GCache/v1/tmp // // Can be called on any thread. - FilePath GetCacheDirectoryPath(CacheSubDirectoryType sub_dir_type) const; + base::FilePath GetCacheDirectoryPath( + CacheSubDirectoryType sub_dir_type) const; // Returns absolute path of the file if it were cached or to be cached. // // Can be called on any thread. - FilePath GetCacheFilePath(const std::string& resource_id, + base::FilePath GetCacheFilePath(const std::string& resource_id, const std::string& md5, CacheSubDirectoryType sub_dir_type, CachedFileOrigin file_origin) const; @@ -123,7 +124,7 @@ class DriveCache { // <user_profile_dir>/GCache/v1 // // Can be called on any thread. - bool IsUnderDriveCacheDirectory(const FilePath& path) const; + bool IsUnderDriveCacheDirectory(const base::FilePath& path) const; // Adds observer. void AddObserver(DriveCacheObserver* observer); @@ -168,7 +169,7 @@ class DriveCache { // |callback| must not be null. void Store(const std::string& resource_id, const std::string& md5, - const FilePath& source_path, + const base::FilePath& source_path, FileOperationType file_operation_type, const FileOperationCallback& callback); @@ -199,7 +200,7 @@ class DriveCache { // Set the state of the cache entry corresponding to file_path as unmounted. // |callback| must not be null. - void MarkAsUnmounted(const FilePath& file_path, + void MarkAsUnmounted(const base::FilePath& file_path, const FileOperationCallback& callback); // Modifies cache state, which involves the following: @@ -259,25 +260,26 @@ class DriveCache { // Gets the cache root path (i.e. <user_profile_dir>/GCache/v1) from the // profile. // TODO(satorux): Write a unit test for this. - static FilePath GetCacheRootPath(Profile* profile); + static base::FilePath GetCacheRootPath(Profile* profile); // Returns file paths for all the cache sub directories under // |cache_root_path|. - static std::vector<FilePath> GetCachePaths(const FilePath& cache_root_path); + static std::vector<base::FilePath> GetCachePaths( + const base::FilePath& cache_root_path); // Creates cache directory and its sub-directories if they don't exist. // TODO(glotov): take care of this when the setup and cleanup part is // landed, noting that these directories need to be created for development // in linux box and unittest. (http://crosbug.com/27577) static bool CreateCacheDirectories( - const std::vector<FilePath>& paths_to_create); + const std::vector<base::FilePath>& paths_to_create); // Returns the type of the sub directory where the cache file is stored. static CacheSubDirectoryType GetSubDirectoryType( const DriveCacheEntry& cache_entry); private: - typedef std::pair<DriveFileError, FilePath> GetFileResult; + typedef std::pair<DriveFileError, base::FilePath> GetFileResult; virtual ~DriveCache(); @@ -315,7 +317,7 @@ class DriveCache { // Used to implement Store. DriveFileError StoreOnBlockingPool(const std::string& resource_id, const std::string& md5, - const FilePath& source_path, + const base::FilePath& source_path, FileOperationType file_operation_type); // Used to implement Pin. @@ -332,7 +334,7 @@ class DriveCache { const std::string& md5); // Used to implement MarkAsUnmounted. - DriveFileError MarkAsUnmountedOnBlockingPool(const FilePath& file_path); + DriveFileError MarkAsUnmountedOnBlockingPool(const base::FilePath& file_path); // Used to implement MarkDirty. DriveFileError MarkDirtyOnBlockingPool(const std::string& resource_id, @@ -371,13 +373,13 @@ class DriveCache { // Returns true if we have sufficient space to store the given number of // bytes, while keeping kMinFreeSpace bytes on the disk. - bool HasEnoughSpaceFor(int64 num_bytes, const FilePath& path); + bool HasEnoughSpaceFor(int64 num_bytes, const base::FilePath& path); // The root directory of the cache (i.e. <user_profile_dir>/GCache/v1). - const FilePath cache_root_path_; + const base::FilePath cache_root_path_; // Paths for all subdirectories of GCache, one for each // DriveCache::CacheSubDirectoryType enum. - const std::vector<FilePath> cache_paths_; + const std::vector<base::FilePath> cache_paths_; scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; // The cache state data. This member must be access only on the blocking pool. diff --git a/chrome/browser/chromeos/drive/drive_cache_metadata.cc b/chrome/browser/chromeos/drive/drive_cache_metadata.cc index 27fc7dc..2e0d1fb 100644 --- a/chrome/browser/chromeos/drive/drive_cache_metadata.cc +++ b/chrome/browser/chromeos/drive/drive_cache_metadata.cc @@ -27,18 +27,18 @@ enum DBOpenStatus { }; // A map table of resource ID to file path. -typedef std::map<std::string, FilePath> ResourceIdToFilePathMap; +typedef std::map<std::string, base::FilePath> ResourceIdToFilePathMap; // Returns true if |file_path| is a valid symbolic link as |sub_dir_type|. // Otherwise, returns false with the reason. -bool IsValidSymbolicLink(const FilePath& file_path, +bool IsValidSymbolicLink(const base::FilePath& file_path, DriveCache::CacheSubDirectoryType sub_dir_type, - const std::vector<FilePath>& cache_paths, + const std::vector<base::FilePath>& cache_paths, std::string* reason) { DCHECK(sub_dir_type == DriveCache::CACHE_TYPE_PINNED || sub_dir_type == DriveCache::CACHE_TYPE_OUTGOING); - FilePath destination; + base::FilePath destination; if (!file_util::ReadSymbolicLink(file_path, &destination)) { *reason = "failed to read the symlink (maybe not a symlink)"; return false; @@ -51,7 +51,7 @@ bool IsValidSymbolicLink(const FilePath& file_path, // pinned-but-not-fetched files are symlinks to kSymLinkToDevNull. if (sub_dir_type == DriveCache::CACHE_TYPE_PINNED && - destination == FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull)) { + destination == base::FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull)) { return true; } @@ -80,7 +80,7 @@ void RemoveInvalidFilesFromPersistentDirectory( persistent_file_map.begin(); iter != persistent_file_map.end(); ++iter) { const std::string& resource_id = iter->first; - const FilePath& file_path = iter->second; + const base::FilePath& file_path = iter->second; DriveCacheMetadata::CacheMap::iterator cache_map_iter = cache_map->find(resource_id); @@ -111,7 +111,7 @@ void RemoveInvalidFilesFromPersistentDirectory( // The resource IDs and file paths of discovered files are collected as a // ResourceIdToFilePathMap, if these are processed properly. void ScanCacheDirectory( - const std::vector<FilePath>& cache_paths, + const std::vector<base::FilePath>& cache_paths, DriveCache::CacheSubDirectoryType sub_dir_type, DriveCacheMetadata::CacheMap* cache_map, ResourceIdToFilePathMap* processed_file_map) { @@ -123,7 +123,7 @@ void ScanCacheDirectory( file_util::FileEnumerator::FILES | file_util::FileEnumerator::SHOW_SYM_LINKS, util::kWildCard); - for (FilePath current = enumerator.Next(); !current.empty(); + for (base::FilePath current = enumerator.Next(); !current.empty(); current = enumerator.Next()) { // Extract resource_id and md5 from filename. std::string resource_id; @@ -224,7 +224,7 @@ void ScanCacheDirectory( } } -void ScanCachePaths(const std::vector<FilePath>& cache_paths, +void ScanCachePaths(const std::vector<base::FilePath>& cache_paths, DriveCacheMetadata::CacheMap* cache_map) { DVLOG(1) << "Scanning directories"; @@ -304,7 +304,8 @@ class FakeDriveCacheMetadata : public DriveCacheMetadata { virtual ~FakeDriveCacheMetadata(); // DriveCacheMetadata overrides: - virtual bool Initialize(const std::vector<FilePath>& cache_paths) OVERRIDE; + virtual bool Initialize( + const std::vector<base::FilePath>& cache_paths) OVERRIDE; virtual void AddOrUpdateCacheEntry( const std::string& resource_id, const DriveCacheEntry& cache_entry) OVERRIDE; @@ -331,7 +332,7 @@ FakeDriveCacheMetadata::~FakeDriveCacheMetadata() { } bool FakeDriveCacheMetadata::Initialize( - const std::vector<FilePath>& cache_paths) { + const std::vector<base::FilePath>& cache_paths) { AssertOnSequencedWorkerPool(); ScanCachePaths(cache_paths, &cache_map_); @@ -418,7 +419,8 @@ class DriveCacheMetadataDB : public DriveCacheMetadata { virtual ~DriveCacheMetadataDB(); // DriveCacheMetadata overrides: - virtual bool Initialize(const std::vector<FilePath>& cache_paths) OVERRIDE; + virtual bool Initialize( + const std::vector<base::FilePath>& cache_paths) OVERRIDE; virtual void AddOrUpdateCacheEntry( const std::string& resource_id, const DriveCacheEntry& cache_entry) OVERRIDE; @@ -448,10 +450,10 @@ DriveCacheMetadataDB::~DriveCacheMetadataDB() { } bool DriveCacheMetadataDB::Initialize( - const std::vector<FilePath>& cache_paths) { + const std::vector<base::FilePath>& cache_paths) { AssertOnSequencedWorkerPool(); - const FilePath db_path = + const base::FilePath db_path = cache_paths[DriveCache::CACHE_TYPE_META].Append( kDriveCacheMetadataDBPath); DVLOG(1) << "db path=" << db_path.value(); @@ -588,7 +590,7 @@ void DriveCacheMetadataDB::Iterate(const CacheIterateCallback& callback) { } // namespace // static -const FilePath::CharType* DriveCacheMetadata::kDriveCacheMetadataDBPath = +const base::FilePath::CharType* DriveCacheMetadata::kDriveCacheMetadataDBPath = FILE_PATH_LITERAL("cache_metadata.db"); diff --git a/chrome/browser/chromeos/drive/drive_cache_metadata.h b/chrome/browser/chromeos/drive/drive_cache_metadata.h index d5c52c7..ec6471b 100644 --- a/chrome/browser/chromeos/drive/drive_cache_metadata.h +++ b/chrome/browser/chromeos/drive/drive_cache_metadata.h @@ -39,7 +39,7 @@ class DriveCacheMetadata { typedef std::map<std::string, DriveCacheEntry> CacheMap; // Database path. - static const FilePath::CharType* kDriveCacheMetadataDBPath; + static const base::FilePath::CharType* kDriveCacheMetadataDBPath; virtual ~DriveCacheMetadata(); @@ -53,7 +53,7 @@ class DriveCacheMetadata { base::SequencedTaskRunner* blocking_task_runner); // Initialize the cache metadata store. Returns true on success. - virtual bool Initialize(const std::vector<FilePath>& cache_paths) = 0; + virtual bool Initialize(const std::vector<base::FilePath>& cache_paths) = 0; // Adds a new cache entry corresponding to |resource_id| if it doesn't // exist, otherwise update the existing entry. virtual void AddOrUpdateCacheEntry(const std::string& resource_id, diff --git a/chrome/browser/chromeos/drive/drive_cache_metadata_unittest.cc b/chrome/browser/chromeos/drive/drive_cache_metadata_unittest.cc index fe597f5..357d39b 100644 --- a/chrome/browser/chromeos/drive/drive_cache_metadata_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_cache_metadata_unittest.cc @@ -55,7 +55,7 @@ class DriveCacheMetadataTest : public testing::Test { CreateFile(persistent_directory_.AppendASCII("id_bad.md5bad")); // "id_symlink" is invalid, as symlink is not allowed here. This should // be removed. - CreateSymbolicLink(FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull), + CreateSymbolicLink(base::FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull), persistent_directory_.AppendASCII("id_symlink")); // Create some files in tmp directory. @@ -65,7 +65,7 @@ class DriveCacheMetadataTest : public testing::Test { CreateFile(tmp_directory_.AppendASCII("id_quux.local")); // "id_symlink_tmp" is invalid, as symlink is not allowed here. This // should be removed. - CreateSymbolicLink(FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull), + CreateSymbolicLink(base::FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull), tmp_directory_.AppendASCII("id_symlink_tmp")); // Create symbolic links in pinned directory. @@ -75,7 +75,7 @@ class DriveCacheMetadataTest : public testing::Test { pinned_directory_.AppendASCII("id_foo")); // "id_corge" is pinned, but not present locally. It's properly pointing // to /dev/null. - CreateSymbolicLink(FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull), + CreateSymbolicLink(base::FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull), pinned_directory_.AppendASCII("id_corge")); // "id_dangling" is pointing to a non-existent file. The symlink should // be removed. @@ -99,14 +99,15 @@ class DriveCacheMetadataTest : public testing::Test { } // Create a file at |file_path|. - void CreateFile(const FilePath& file_path) { + void CreateFile(const base::FilePath& file_path) { const std::string kFoo = "foo"; ASSERT_TRUE(file_util::WriteFile(file_path, kFoo.data(), kFoo.size())) << ": " << file_path.value(); } // Create an symlink to |target| at |symlink|. - void CreateSymbolicLink(const FilePath& target, const FilePath& symlink) { + void CreateSymbolicLink(const base::FilePath& target, + const base::FilePath& symlink) { ASSERT_TRUE(file_util::CreateSymbolicLink(target, symlink)) << ": " << target.value() << ": " << symlink.value(); } @@ -131,11 +132,11 @@ class DriveCacheMetadataTest : public testing::Test { base::ScopedTempDir temp_dir_; scoped_ptr<DriveCacheMetadata> metadata_; - std::vector<FilePath> cache_paths_; - FilePath persistent_directory_; - FilePath tmp_directory_; - FilePath pinned_directory_; - FilePath outgoing_directory_; + std::vector<base::FilePath> cache_paths_; + base::FilePath persistent_directory_; + base::FilePath tmp_directory_; + base::FilePath pinned_directory_; + base::FilePath outgoing_directory_; }; // Test all the methods of DriveCacheMetadata except for @@ -392,8 +393,9 @@ TEST_F(DriveCacheMetadataTest, RemoveTemporaryFiles) { TEST_F(DriveCacheMetadataTest, CorruptDB) { SetUpCacheWithVariousFiles(); - const FilePath db_path = cache_paths_[DriveCache::CACHE_TYPE_META].Append( - DriveCacheMetadata::kDriveCacheMetadataDBPath); + const base::FilePath db_path = + cache_paths_[DriveCache::CACHE_TYPE_META].Append( + DriveCacheMetadata::kDriveCacheMetadataDBPath); // Write a bogus file. std::string text("Hello world"); @@ -413,9 +415,9 @@ TEST_F(DriveCacheMetadataTest, CorruptDB) { TEST(DriveCacheMetadataExtraTest, CannotOpenDB) { // Create nonexistent cache paths, so the initialization fails due to the // failure of opening the DB. - std::vector<FilePath> cache_paths = + std::vector<base::FilePath> cache_paths = DriveCache::GetCachePaths( - FilePath::FromUTF8Unsafe("/somewhere/nonexistent")); + base::FilePath::FromUTF8Unsafe("/somewhere/nonexistent")); scoped_ptr<DriveCacheMetadata> metadata = DriveCacheMetadata::CreateDriveCacheMetadata(NULL); diff --git a/chrome/browser/chromeos/drive/drive_cache_unittest.cc b/chrome/browser/chromeos/drive/drive_cache_unittest.cc index d5831c5..cc9c90e 100644 --- a/chrome/browser/chromeos/drive/drive_cache_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_cache_unittest.cc @@ -62,14 +62,14 @@ struct TestCacheResource { const int64 kLotsOfSpace = kMinFreeSpace * 10; struct PathToVerify { - PathToVerify(const FilePath& in_path_to_scan, - const FilePath& in_expected_existing_path) : + PathToVerify(const base::FilePath& in_path_to_scan, + const base::FilePath& in_expected_existing_path) : path_to_scan(in_path_to_scan), expected_existing_path(in_expected_existing_path) { } - FilePath path_to_scan; - FilePath expected_existing_path; + base::FilePath path_to_scan; + base::FilePath expected_existing_path; }; // Copies results from Iterate(). @@ -141,7 +141,7 @@ class DriveCacheTest : public testing::Test { const struct TestCacheResource& resource = test_cache_resources[i]; // Copy file from data dir to cache. if (!std::string(resource.source_file).empty()) { - FilePath source_path = + base::FilePath source_path = google_apis::test_util::GetTestFilePath(resource.source_file); DriveFileError error = DRIVE_FILE_OK; @@ -198,7 +198,7 @@ class DriveCacheTest : public testing::Test { DriveFileError expected_error, const std::string& expected_file_extension) { DriveFileError error = DRIVE_FILE_OK; - FilePath cache_file_path; + base::FilePath cache_file_path; cache_->GetFile( resource_id, md5, base::Bind(&test_util::CopyResultsFromGetFileFromCacheCallback, @@ -208,9 +208,9 @@ class DriveCacheTest : public testing::Test { EXPECT_EQ(expected_error, error); if (error == DRIVE_FILE_OK) { // Verify filename of |cache_file_path|. - FilePath base_name = cache_file_path.BaseName(); + base::FilePath base_name = cache_file_path.BaseName(); EXPECT_EQ(util::EscapeCacheFileName(resource_id) + - FilePath::kExtensionSeparator + + base::FilePath::kExtensionSeparator + util::EscapeCacheFileName( expected_file_extension.empty() ? md5 : expected_file_extension), @@ -223,7 +223,7 @@ class DriveCacheTest : public testing::Test { void TestStoreToCache( const std::string& resource_id, const std::string& md5, - const FilePath& source_path, + const base::FilePath& source_path, DriveFileError expected_error, int expected_cache_state, DriveCache::CacheSubDirectoryType expected_sub_dir_type) { @@ -271,19 +271,19 @@ class DriveCacheTest : public testing::Test { paths_to_verify.push_back( // Index 0: CACHE_TYPE_TMP. PathToVerify(cache_->GetCacheFilePath(resource_id, "*", DriveCache::CACHE_TYPE_TMP, - DriveCache::CACHED_FILE_FROM_SERVER), FilePath())); + DriveCache::CACHED_FILE_FROM_SERVER), base::FilePath())); paths_to_verify.push_back( // Index 1: CACHE_TYPE_PERSISTENT. PathToVerify(cache_->GetCacheFilePath(resource_id, "*", DriveCache::CACHE_TYPE_PERSISTENT, - DriveCache::CACHED_FILE_FROM_SERVER), FilePath())); + DriveCache::CACHED_FILE_FROM_SERVER), base::FilePath())); paths_to_verify.push_back( // Index 2: CACHE_TYPE_TMP, but STATE_PINNED. PathToVerify(cache_->GetCacheFilePath(resource_id, "", DriveCache::CACHE_TYPE_PINNED, - DriveCache::CACHED_FILE_FROM_SERVER), FilePath())); + DriveCache::CACHED_FILE_FROM_SERVER), base::FilePath())); paths_to_verify.push_back( // Index 3: CACHE_TYPE_OUTGOING. PathToVerify(cache_->GetCacheFilePath(resource_id, "", DriveCache::CACHE_TYPE_OUTGOING, - DriveCache::CACHED_FILE_FROM_SERVER), FilePath())); + DriveCache::CACHED_FILE_FROM_SERVER), base::FilePath())); if (!cache_entry_found) { for (size_t i = 0; i < paths_to_verify.size(); ++i) { file_util::FileEnumerator enumerator( @@ -332,7 +332,7 @@ class DriveCacheTest : public testing::Test { file_util::FileEnumerator::SHOW_SYM_LINKS, verify.path_to_scan.BaseName().value()); size_t num_files_found = 0; - for (FilePath current = enumerator.Next(); !current.empty(); + for (base::FilePath current = enumerator.Next(); !current.empty(); current = enumerator.Next()) { ++num_files_found; EXPECT_EQ(verify.expected_existing_path, current); @@ -401,7 +401,7 @@ class DriveCacheTest : public testing::Test { // Verify filename. if (error == DRIVE_FILE_OK) { - FilePath cache_file_path; + base::FilePath cache_file_path; cache_->GetFile( resource_id, md5, base::Bind(&test_util::CopyResultsFromGetFileFromCacheCallback, @@ -409,9 +409,9 @@ class DriveCacheTest : public testing::Test { google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - FilePath base_name = cache_file_path.BaseName(); + base::FilePath base_name = cache_file_path.BaseName(); EXPECT_EQ(util::EscapeCacheFileName(resource_id) + - FilePath::kExtensionSeparator + + base::FilePath::kExtensionSeparator + "local", base_name.value()); } @@ -467,7 +467,7 @@ class DriveCacheTest : public testing::Test { expect_outgoing_symlink_ = false; DriveFileError error = DRIVE_FILE_OK; - FilePath cache_file_path; + base::FilePath cache_file_path; cache_->MarkAsMounted( resource_id, md5, @@ -486,7 +486,7 @@ class DriveCacheTest : public testing::Test { void TestMarkAsUnmounted( const std::string& resource_id, const std::string& md5, - const FilePath& file_path, + const base::FilePath& file_path, DriveFileError expected_error, int expected_cache_state, DriveCache::CacheSubDirectoryType expected_sub_dir_type) { @@ -501,7 +501,7 @@ class DriveCacheTest : public testing::Test { base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); google_apis::test_util::RunBlockingPoolTask(); - FilePath cache_file_path; + base::FilePath cache_file_path; cache_->GetFile( resource_id, md5, base::Bind(&test_util::CopyResultsFromGetFileFromCacheCallback, @@ -539,7 +539,7 @@ class DriveCacheTest : public testing::Test { } // Verify actual cache file. - FilePath dest_path = cache_->GetCacheFilePath( + base::FilePath dest_path = cache_->GetCacheFilePath( resource_id, md5, test_util::ToCacheEntry(expected_cache_state_).is_pinned() || @@ -556,7 +556,7 @@ class DriveCacheTest : public testing::Test { EXPECT_FALSE(exists); // Verify symlink in pinned dir. - FilePath symlink_path = cache_->GetCacheFilePath( + base::FilePath symlink_path = cache_->GetCacheFilePath( resource_id, std::string(), DriveCache::CACHE_TYPE_PINNED, @@ -565,7 +565,7 @@ class DriveCacheTest : public testing::Test { exists = file_util::IsLink(symlink_path); if (test_util::ToCacheEntry(expected_cache_state_).is_pinned()) { EXPECT_TRUE(exists); - FilePath target_path; + base::FilePath target_path; EXPECT_TRUE(file_util::ReadSymbolicLink(symlink_path, &target_path)); if (test_util::ToCacheEntry(expected_cache_state_).is_present()) EXPECT_EQ(dest_path, target_path); @@ -586,7 +586,7 @@ class DriveCacheTest : public testing::Test { if (expect_outgoing_symlink_ && test_util::ToCacheEntry(expected_cache_state_).is_dirty()) { EXPECT_TRUE(exists); - FilePath target_path; + base::FilePath target_path; EXPECT_TRUE(file_util::ReadSymbolicLink(symlink_path, &target_path)); EXPECT_TRUE(target_path.value() != kSymLinkToDevNull); if (test_util::ToCacheEntry(expected_cache_state_).is_present()) @@ -596,7 +596,7 @@ class DriveCacheTest : public testing::Test { } } - FilePath GetCacheFilePath(const std::string& resource_id, + base::FilePath GetCacheFilePath(const std::string& resource_id, const std::string& md5, DriveCache::CacheSubDirectoryType sub_dir_type, DriveCache::CachedFileOrigin file_origin) { @@ -627,19 +627,19 @@ class DriveCacheTest : public testing::Test { void TestGetCacheFilePath(const std::string& resource_id, const std::string& md5, const std::string& expected_filename) { - FilePath actual_path = cache_->GetCacheFilePath( + base::FilePath actual_path = cache_->GetCacheFilePath( resource_id, md5, DriveCache::CACHE_TYPE_TMP, DriveCache::CACHED_FILE_FROM_SERVER); - FilePath expected_path = + base::FilePath expected_path = cache_->GetCacheDirectoryPath(DriveCache::CACHE_TYPE_TMP); expected_path = expected_path.Append(expected_filename); EXPECT_EQ(expected_path, actual_path); - FilePath base_name = actual_path.BaseName(); + base::FilePath base_name = actual_path.BaseName(); - // FilePath::Extension returns ".", so strip it. + // base::FilePath::Extension returns ".", so strip it. std::string unescaped_md5 = util::UnescapeCacheFileName( base_name.Extension().substr(1)); EXPECT_EQ(md5, unescaped_md5); @@ -652,7 +652,7 @@ class DriveCacheTest : public testing::Test { // that they have the <md5>. This should return 1 or 0. size_t CountCacheFiles(const std::string& resource_id, const std::string& md5) { - FilePath path = GetCacheFilePath( + base::FilePath path = GetCacheFilePath( resource_id, "*", (test_util::ToCacheEntry(expected_cache_state_).is_pinned() ? DriveCache::CACHE_TYPE_PERSISTENT : @@ -662,11 +662,11 @@ class DriveCacheTest : public testing::Test { file_util::FileEnumerator::FILES, path.BaseName().value()); size_t num_files_found = 0; - for (FilePath current = enumerator.Next(); !current.empty(); + for (base::FilePath current = enumerator.Next(); !current.empty(); current = enumerator.Next()) { ++num_files_found; EXPECT_EQ(util::EscapeCacheFileName(resource_id) + - FilePath::kExtensionSeparator + + base::FilePath::kExtensionSeparator + util::EscapeCacheFileName(md5), current.BaseName().value()); } @@ -697,7 +697,7 @@ TEST_F(DriveCacheTest, GetCacheFilePath) { std::string resource_id("pdf:1a2b"); std::string md5("abcdef0123456789"); TestGetCacheFilePath(resource_id, md5, - resource_id + FilePath::kExtensionSeparator + md5); + resource_id + base::FilePath::kExtensionSeparator + md5); // Use non-alphanumeric characters for resource id, including '.' which is an // extension separator, to test that the characters are escaped and unescaped @@ -705,9 +705,9 @@ TEST_F(DriveCacheTest, GetCacheFilePath) { resource_id = "pdf:`~!@#$%^&*()-_=+[{|]}\\;',<.>/?"; std::string escaped_resource_id = util::EscapeCacheFileName(resource_id); std::string escaped_md5 = util::EscapeCacheFileName(md5); - TestGetCacheFilePath(resource_id, md5, - escaped_resource_id + FilePath::kExtensionSeparator + - escaped_md5); + TestGetCacheFilePath( + resource_id, md5, escaped_resource_id + + base::FilePath::kExtensionSeparator + escaped_md5); } TEST_F(DriveCacheTest, StoreToCacheSimple) { @@ -724,7 +724,7 @@ TEST_F(DriveCacheTest, StoreToCacheSimple) { DriveCache::CACHE_TYPE_TMP); // Store a non-existent file to the same |resource_id| and |md5|. - TestStoreToCache(resource_id, md5, FilePath("./non_existent.json"), + TestStoreToCache(resource_id, md5, base::FilePath("./non_existent.json"), DRIVE_FILE_ERROR_FAILED, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); @@ -884,7 +884,7 @@ TEST_F(DriveCacheTest, StoreToCachePinned) { DriveCache::CACHE_TYPE_PERSISTENT); // Store a non-existent file to a previously pinned and stored file. - TestStoreToCache(resource_id, md5, FilePath("./non_existent.json"), + TestStoreToCache(resource_id, md5, base::FilePath("./non_existent.json"), DRIVE_FILE_ERROR_FAILED, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | @@ -1066,7 +1066,7 @@ TEST_F(DriveCacheTest, PinAndUnpinDirtyCache) { DriveCache::CACHE_TYPE_PERSISTENT); // Verifies dirty file exists. - FilePath dirty_path = GetCacheFilePath( + base::FilePath dirty_path = GetCacheFilePath( resource_id, md5, DriveCache::CACHE_TYPE_PERSISTENT, @@ -1259,7 +1259,7 @@ TEST_F(DriveCacheTest, RemoveFromDirtyCache) { TEST_F(DriveCacheTest, MountUnmount) { fake_free_disk_space_getter_->set_fake_free_disk_space(kLotsOfSpace); - FilePath file_path; + base::FilePath file_path; std::string resource_id("pdf:1a2b"); std::string md5("abcdef0123456789"); @@ -1379,7 +1379,7 @@ TEST(DriveCacheExtraTest, InitializationFailure) { // Set the cache root to a non existent path, so the initialization fails. DriveCache* cache = new DriveCache( - FilePath::FromUTF8Unsafe("/somewhere/nonexistent/blah/blah"), + base::FilePath::FromUTF8Unsafe("/somewhere/nonexistent/blah/blah"), pool->GetSequencedTaskRunner(pool->GetSequenceToken()), NULL /* free_disk_space_getter */); diff --git a/chrome/browser/chromeos/drive/drive_download_handler.cc b/chrome/browser/chromeos/drive/drive_download_handler.cc index 046b00c..a10c2b9 100644 --- a/chrome/browser/chromeos/drive/drive_download_handler.cc +++ b/chrome/browser/chromeos/drive/drive_download_handler.cc @@ -27,16 +27,16 @@ const char kDrivePathKey[] = "DrivePath"; // User Data stored in DownloadItem for drive path. class DriveUserData : public base::SupportsUserData::Data { public: - explicit DriveUserData(const FilePath& path) : file_path_(path), + explicit DriveUserData(const base::FilePath& path) : file_path_(path), is_complete_(false) {} virtual ~DriveUserData() {} - const FilePath& file_path() const { return file_path_; } + const base::FilePath& file_path() const { return file_path_; } bool is_complete() const { return is_complete_; } void set_complete() { is_complete_ = true; } private: - const FilePath file_path_; + const base::FilePath file_path_; bool is_complete_; }; @@ -53,11 +53,12 @@ DriveUserData* GetDriveUserData(DownloadItem* download) { // Creates a temporary file |drive_tmp_download_path| in // |drive_tmp_download_dir|. Must be called on a thread that allows file // operations. -FilePath GetDriveTempDownloadPath(const FilePath& drive_tmp_download_dir) { +base::FilePath GetDriveTempDownloadPath( + const base::FilePath& drive_tmp_download_dir) { bool created = file_util::CreateDirectory(drive_tmp_download_dir); DCHECK(created) << "Can not create temp download directory at " << drive_tmp_download_dir.value(); - FilePath drive_tmp_download_path; + base::FilePath drive_tmp_download_path; created = file_util::CreateTemporaryFileInDir(drive_tmp_download_dir, &drive_tmp_download_path); DCHECK(created) << "Temporary download file creation failed"; @@ -65,9 +66,9 @@ FilePath GetDriveTempDownloadPath(const FilePath& drive_tmp_download_dir) { } // Moves downloaded file to Drive. -void MoveDownloadedFile(const FilePath& downloaded_file, +void MoveDownloadedFile(const base::FilePath& downloaded_file, DriveFileError error, - const FilePath& dest_path) { + const base::FilePath& dest_path) { if (error != DRIVE_FILE_OK) return; file_util::Move(downloaded_file, dest_path); @@ -83,7 +84,7 @@ void ContinueCheckingForFileExistence( // Returns true if |download| is a Drive download created from data persisted // on the download history DB. -bool IsPersistedDriveDownload(const FilePath& drive_tmp_download_path, +bool IsPersistedDriveDownload(const base::FilePath& drive_tmp_download_path, DownloadItem* download) { // Persisted downloads are not in IN_PROGRESS state when created, while newly // created downloads are. @@ -113,7 +114,7 @@ DriveDownloadHandler* DriveDownloadHandler::GetForProfile(Profile* profile) { void DriveDownloadHandler::Initialize( DownloadManager* download_manager, - const FilePath& drive_tmp_download_path) { + const base::FilePath& drive_tmp_download_path) { DCHECK(!drive_tmp_download_path.empty()); drive_tmp_download_path_ = drive_tmp_download_path; @@ -131,7 +132,7 @@ void DriveDownloadHandler::Initialize( } void DriveDownloadHandler::SubstituteDriveDownloadPath( - const FilePath& drive_path, + const base::FilePath& drive_path, content::DownloadItem* download, const SubstituteDriveDownloadPathCallback& callback) { DVLOG(1) << "SubstituteDriveDownloadPath " << drive_path.value(); @@ -144,7 +145,7 @@ void DriveDownloadHandler::SubstituteDriveDownloadPath( // DriveFileSystem::GetEntryInfoByPath // OnEntryFound calls DriveFileSystem::CreateDirectory (if necessary) // OnCreateDirectory calls SubstituteDriveDownloadPathInternal - const FilePath drive_dir_path = + const base::FilePath drive_dir_path = util::ExtractDrivePath(drive_path.DirName()); // Ensure the directory exists. This also forces DriveFileSystem to // initialize DriveRootDirectory. @@ -159,7 +160,7 @@ void DriveDownloadHandler::SubstituteDriveDownloadPath( } } -void DriveDownloadHandler::SetDownloadParams(const FilePath& drive_path, +void DriveDownloadHandler::SetDownloadParams(const base::FilePath& drive_path, DownloadItem* download) { if (!download || (download->GetState() != DownloadItem::IN_PROGRESS)) return; @@ -172,16 +173,17 @@ void DriveDownloadHandler::SetDownloadParams(const FilePath& drive_path, // /drive, and the user has now changed the download target to a local // folder. download->SetUserData(&kDrivePathKey, NULL); - download->SetDisplayName(FilePath()); + download->SetDisplayName(base::FilePath()); } } -FilePath DriveDownloadHandler::GetTargetPath(const DownloadItem* download) { +base::FilePath DriveDownloadHandler::GetTargetPath( + const DownloadItem* download) { const DriveUserData* data = GetDriveUserData(download); // If data is NULL, we've somehow lost the drive path selected by the file // picker. DCHECK(data); - return data ? data->file_path() : FilePath(); + return data ? data->file_path() : base::FilePath(); } bool DriveDownloadHandler::IsDriveDownload(const DownloadItem* download) { @@ -253,7 +255,7 @@ void DriveDownloadHandler::OnDownloadUpdated( } void DriveDownloadHandler::OnEntryFound( - const FilePath& drive_dir_path, + const base::FilePath& drive_dir_path, const SubstituteDriveDownloadPathCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -271,7 +273,7 @@ void DriveDownloadHandler::OnEntryFound( } else { LOG(WARNING) << "Failed to get entry info for path: " << drive_dir_path.value() << ", error = " << error; - callback.Run(FilePath()); + callback.Run(base::FilePath()); } } @@ -287,7 +289,7 @@ void DriveDownloadHandler::OnCreateDirectory( callback); } else { LOG(WARNING) << "Failed to create directory, error = " << error; - callback.Run(FilePath()); + callback.Run(base::FilePath()); } } diff --git a/chrome/browser/chromeos/drive/drive_download_handler.h b/chrome/browser/chromeos/drive/drive_download_handler.h index 3420ebb..c80d8e0 100644 --- a/chrome/browser/chromeos/drive/drive_download_handler.h +++ b/chrome/browser/chromeos/drive/drive_download_handler.h @@ -37,26 +37,26 @@ class DriveDownloadHandler : public AllDownloadItemNotifier::Observer { // Become an observer of DownloadManager. void Initialize(content::DownloadManager* download_manager, - const FilePath& drive_tmp_download_path); + const base::FilePath& drive_tmp_download_path); // Callback used to return results from SubstituteDriveDownloadPath. // TODO(hashimoto): Report error with a DriveFileError. crbug.com/171345 - typedef base::Callback<void(const FilePath&)> + typedef base::Callback<void(const base::FilePath&)> SubstituteDriveDownloadPathCallback; void SubstituteDriveDownloadPath( - const FilePath& drive_path, + const base::FilePath& drive_path, content::DownloadItem* download, const SubstituteDriveDownloadPathCallback& callback); // Sets drive path, for example, '/special/drive/MyFolder/MyFile', // to external data in |download|. Also sets display name and // makes |download| a temporary. - void SetDownloadParams(const FilePath& drive_path, + void SetDownloadParams(const base::FilePath& drive_path, content::DownloadItem* download); // Gets the target drive path from external data in |download|. - FilePath GetTargetPath(const content::DownloadItem* download); + base::FilePath GetTargetPath(const content::DownloadItem* download); // Checks if there is a Drive upload associated with |download| bool IsDriveDownload(const content::DownloadItem* download); @@ -78,7 +78,7 @@ class DriveDownloadHandler : public AllDownloadItemNotifier::Observer { // Callback for DriveFileSystem::GetEntryInfoByPath(). // Used to implement SubstituteDriveDownloadPath(). - void OnEntryFound(const FilePath& drive_dir_path, + void OnEntryFound(const base::FilePath& drive_dir_path, const SubstituteDriveDownloadPathCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); @@ -98,7 +98,7 @@ class DriveDownloadHandler : public AllDownloadItemNotifier::Observer { scoped_ptr<AllDownloadItemNotifier> notifier_; // Temporary download location directory. - FilePath drive_tmp_download_path_; + base::FilePath drive_tmp_download_path_; // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed. diff --git a/chrome/browser/chromeos/drive/drive_feed_loader.cc b/chrome/browser/chromeos/drive/drive_feed_loader.cc index b13b04c..301b746 100644 --- a/chrome/browser/chromeos/drive/drive_feed_loader.cc +++ b/chrome/browser/chromeos/drive/drive_feed_loader.cc @@ -31,9 +31,9 @@ namespace drive { namespace { -const FilePath::CharType kFilesystemProtoFile[] = +const base::FilePath::CharType kFilesystemProtoFile[] = FILE_PATH_LITERAL("file_system.pb"); -const FilePath::CharType kResourceMetadataDBFile[] = +const base::FilePath::CharType kResourceMetadataDBFile[] = FILE_PATH_LITERAL("resource_metadata.db"); // Update the fetch progress UI per every this number of feeds. @@ -61,7 +61,7 @@ SerializationTimetable kSerializeTimetable[] = { // Loads the file at |path| into the string |serialized_proto| on a blocking // thread. -DriveFileError LoadProtoOnBlockingPool(const FilePath& path, +DriveFileError LoadProtoOnBlockingPool(const base::FilePath& path, base::Time* last_modified, std::string* serialized_proto) { base::PlatformFileInfo info; @@ -93,7 +93,7 @@ bool ShouldSerializeFileSystemNow(size_t serialized_size, } // Saves the string |serialized_proto| to a file at |path| on a blocking thread. -void SaveProtoOnBlockingPool(const FilePath& path, +void SaveProtoOnBlockingPool(const base::FilePath& path, scoped_ptr<std::string> serialized_proto) { const int file_size = static_cast<int>(serialized_proto->length()); if (file_util::WriteFile(path, serialized_proto->data(), file_size) != @@ -555,7 +555,8 @@ void DriveFeedLoader::LoadFromCache(const FileOperationCallback& callback) { refreshing_ = true; LoadRootFeedParams* params = new LoadRootFeedParams(callback); - FilePath path = cache_->GetCacheDirectoryPath(DriveCache::CACHE_TYPE_META); + base::FilePath path = + cache_->GetCacheDirectoryPath(DriveCache::CACHE_TYPE_META); if (UseLevelDB()) { path = path.Append(kResourceMetadataDBFile); resource_metadata_->InitFromDB(path, blocking_task_runner_, @@ -622,7 +623,7 @@ void DriveFeedLoader::SaveFileSystem() { if (UseLevelDB()) { resource_metadata_->SaveToDB(); } else { - const FilePath path = + const base::FilePath path = cache_->GetCacheDirectoryPath(DriveCache::CACHE_TYPE_META).Append( kFilesystemProtoFile); scoped_ptr<std::string> serialized_proto(new std::string()); @@ -667,7 +668,7 @@ void DriveFeedLoader::NotifyDirectoryChanged( DCHECK(!update_finished_callback.is_null()); if (should_notify_changed_directories) { - for (std::set<FilePath>::iterator dir_iter = + for (std::set<base::FilePath>::iterator dir_iter = feed_processor_->changed_dirs().begin(); dir_iter != feed_processor_->changed_dirs().end(); ++dir_iter) { diff --git a/chrome/browser/chromeos/drive/drive_feed_processor.cc b/chrome/browser/chromeos/drive/drive_feed_processor.cc index 22746ea..dde43bc 100644 --- a/chrome/browser/chromeos/drive/drive_feed_processor.cc +++ b/chrome/browser/chromeos/drive/drive_feed_processor.cc @@ -93,7 +93,7 @@ void DriveFeedProcessor::ApplyEntryProtoMap(bool is_delta_feed) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!is_delta_feed) { // Full update. - changed_dirs_.insert(FilePath(kDriveRootDirectory)); + changed_dirs_.insert(base::FilePath(kDriveRootDirectory)); resource_metadata_->RemoveAll( base::Bind(&DriveFeedProcessor::ApplyNextEntryProtoAsync, weak_ptr_factory_.GetWeakPtr())); @@ -162,7 +162,7 @@ void DriveFeedProcessor::ApplyEntryProto(const DriveEntryProto& entry_proto) { void DriveFeedProcessor::ContinueApplyEntryProto( const DriveEntryProto& entry_proto, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, scoped_ptr<DriveEntryProto> old_entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -193,9 +193,10 @@ void DriveFeedProcessor::AddEntryToParent(const DriveEntryProto& entry_proto) { entry_proto.file_info().is_directory())); } -void DriveFeedProcessor::NotifyForAddEntryToParent(bool is_directory, - DriveFileError error, - const FilePath& file_path) { +void DriveFeedProcessor::NotifyForAddEntryToParent( + bool is_directory, + DriveFileError error, + const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DVLOG(1) << "NotifyForAddEntryToParent " << file_path.value(); @@ -213,13 +214,13 @@ void DriveFeedProcessor::NotifyForAddEntryToParent(bool is_directory, void DriveFeedProcessor::RemoveEntryFromParent( const DriveEntryProto& entry_proto, - const FilePath& file_path) { + const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!file_path.empty()); if (!entry_proto.file_info().is_directory()) { // No children if entry is a file. - OnGetChildrenForRemove(entry_proto, file_path, std::set<FilePath>()); + OnGetChildrenForRemove(entry_proto, file_path, std::set<base::FilePath>()); } else { // If entry is a directory, notify its children. resource_metadata_->GetChildDirectories( @@ -233,8 +234,8 @@ void DriveFeedProcessor::RemoveEntryFromParent( void DriveFeedProcessor::OnGetChildrenForRemove( const DriveEntryProto& entry_proto, - const FilePath& file_path, - const std::set<FilePath>& child_directories) { + const base::FilePath& file_path, + const std::set<base::FilePath>& child_directories) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!file_path.empty()); @@ -249,10 +250,10 @@ void DriveFeedProcessor::OnGetChildrenForRemove( void DriveFeedProcessor::NotifyForRemoveEntryFromParent( bool is_directory, - const FilePath& file_path, - const std::set<FilePath>& child_directories, + const base::FilePath& file_path, + const std::set<base::FilePath>& child_directories, DriveFileError error, - const FilePath& parent_path) { + const base::FilePath& parent_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DVLOG(1) << "NotifyForRemoveEntryFromParent " << file_path.value(); @@ -274,7 +275,7 @@ void DriveFeedProcessor::NotifyForRemoveEntryFromParent( } void DriveFeedProcessor::RefreshEntry(const DriveEntryProto& entry_proto, - const FilePath& file_path) { + const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); resource_metadata_->RefreshEntry( @@ -285,9 +286,9 @@ void DriveFeedProcessor::RefreshEntry(const DriveEntryProto& entry_proto, } void DriveFeedProcessor::NotifyForRefreshEntry( - const FilePath& old_file_path, + const base::FilePath& old_file_path, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -361,7 +362,7 @@ void DriveFeedProcessor::UpdateRootUploadUrl() { DCHECK(root_upload_url_.is_valid()); resource_metadata_->GetEntryInfoByPath( - FilePath(kDriveRootDirectory), + base::FilePath(kDriveRootDirectory), base::Bind(&DriveFeedProcessor::OnGetRootEntryProto, weak_ptr_factory_.GetWeakPtr())); } @@ -387,7 +388,7 @@ void DriveFeedProcessor::OnGetRootEntryProto( void DriveFeedProcessor::OnUpdateRootUploadUrl( DriveFileError error, - const FilePath& /* root_path */, + const base::FilePath& /* root_path */, scoped_ptr<DriveEntryProto> /* root_proto */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); LOG_IF(WARNING, error != DRIVE_FILE_OK) << "Failed to refresh root directory"; diff --git a/chrome/browser/chromeos/drive/drive_feed_processor.h b/chrome/browser/chromeos/drive/drive_feed_processor.h index 6057017..54a9353 100644 --- a/chrome/browser/chromeos/drive/drive_feed_processor.h +++ b/chrome/browser/chromeos/drive/drive_feed_processor.h @@ -69,7 +69,7 @@ class DriveFeedProcessor { const DriveEntryProtoMap& entry_proto_map() const { return entry_proto_map_; } // The set of changed directories as a result of feed processing. - const std::set<FilePath>& changed_dirs() const { return changed_dirs_; } + const std::set<base::FilePath>& changed_dirs() const { return changed_dirs_; } private: // Applies the pre-processed feed from entry_proto_map_ onto the filesystem. @@ -88,7 +88,7 @@ class DriveFeedProcessor { void ContinueApplyEntryProto( const DriveEntryProto& entry_proto, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, scoped_ptr<DriveEntryProto> old_entry_proto); // Apply the DriveEntryProto pointed to by |it| to resource_metadata_. @@ -101,39 +101,39 @@ class DriveFeedProcessor { // Callback for DriveResourceMetadata::AddEntryToParent. void NotifyForAddEntryToParent(bool is_directory, DriveFileError error, - const FilePath& file_path); + const base::FilePath& file_path); // Removes entry pointed to by |resource_id| from its parent. Updates // changed_dirs_ as a side effect. void RemoveEntryFromParent( const DriveEntryProto& entry_proto, - const FilePath& file_path); + const base::FilePath& file_path); // Continues RemoveEntryFromParent after // DriveResourceMetadata::GetChildDirectories. void OnGetChildrenForRemove( const DriveEntryProto& entry_proto, - const FilePath& file_path, - const std::set<FilePath>& child_directories); + const base::FilePath& file_path, + const std::set<base::FilePath>& child_directories); // Callback for DriveResourceMetadata::RemoveEntryFromParent. void NotifyForRemoveEntryFromParent( bool is_directory, - const FilePath& file_path, - const std::set<FilePath>& child_directories, + const base::FilePath& file_path, + const std::set<base::FilePath>& child_directories, DriveFileError error, - const FilePath& parent_path); + const base::FilePath& parent_path); // Refreshes DriveResourceMetadata entry that has the same resource_id as // |entry_proto| with |entry_proto|. Updates changed_dirs_ as a side effect. void RefreshEntry(const DriveEntryProto& entry_proto, - const FilePath& file_path); + const base::FilePath& file_path); // Callback for DriveResourceMetadata::RefreshEntry. void NotifyForRefreshEntry( - const FilePath& old_file_path, + const base::FilePath& old_file_path, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, scoped_ptr<DriveEntryProto> entry_proto); // Updates the upload url of the root directory with root_upload_url_. @@ -147,7 +147,7 @@ class DriveFeedProcessor { // Callback for DriveResourceMetadata::RefreshEntry after the root upload // url is set. void OnUpdateRootUploadUrl(DriveFileError error, - const FilePath& root_path, + const base::FilePath& root_path, scoped_ptr<DriveEntryProto> root_proto); // Runs after all entries have been processed. @@ -159,7 +159,7 @@ class DriveFeedProcessor { DriveResourceMetadata* resource_metadata_; // Not owned. DriveEntryProtoMap entry_proto_map_; - std::set<FilePath> changed_dirs_; + std::set<base::FilePath> changed_dirs_; GURL root_upload_url_; int64 largest_changestamp_; base::Closure on_complete_callback_; diff --git a/chrome/browser/chromeos/drive/drive_file_system.cc b/chrome/browser/chromeos/drive/drive_file_system.cc index 59694b9..c5d1d9f 100644 --- a/chrome/browser/chromeos/drive/drive_file_system.cc +++ b/chrome/browser/chromeos/drive/drive_file_system.cc @@ -54,7 +54,7 @@ const int kSlowPollingIntervalInSec = 300; // Runs GetFileCallback with pointers dereferenced. // Used for PostTaskAndReply(). void RunGetFileCallbackHelper(const GetFileCallback& callback, - FilePath* file_path, + base::FilePath* file_path, const std::string& mime_type, DriveFileType file_type, DriveFileError error) { @@ -117,10 +117,10 @@ void EmptyFileOperationCallback(DriveFileError error) {} // Creates a temporary JSON file representing a document with |edit_url| // and |resource_id| under |document_dir| on blocking pool. DriveFileError CreateDocumentJsonFileOnBlockingPool( - const FilePath& document_dir, + const base::FilePath& document_dir, const GURL& edit_url, const std::string& resource_id, - FilePath* temp_file_path) { + base::FilePath* temp_file_path) { DCHECK(temp_file_path); DriveFileError error = DRIVE_FILE_ERROR_FAILED; @@ -145,7 +145,7 @@ DriveFileError CreateDocumentJsonFileOnBlockingPool( // create GetEntryInfoCallback. void RunGetEntryInfoWithFilePathCallback( const GetEntryInfoWithFilePathCallback& callback, - const FilePath& path, + const base::FilePath& path, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(!callback.is_null()); @@ -189,8 +189,8 @@ DriveFileSystem::GetFileCompleteForOpenParams::GetFileCompleteForOpenParams( // DriveFileSystem::GetFileFromCacheParams struct implementation. struct DriveFileSystem::GetFileFromCacheParams { GetFileFromCacheParams( - const FilePath& virtual_file_path, - const FilePath& local_tmp_path, + const base::FilePath& virtual_file_path, + const base::FilePath& local_tmp_path, const std::string& resource_id, const std::string& md5, const std::string& mime_type, @@ -205,9 +205,9 @@ struct DriveFileSystem::GetFileFromCacheParams { get_content_callback(get_content_callback) { } - FilePath virtual_file_path; - FilePath local_tmp_path; - FilePath cache_file_path; + base::FilePath virtual_file_path; + base::FilePath local_tmp_path; + base::FilePath cache_file_path; std::string resource_id; std::string md5; std::string mime_type; @@ -217,7 +217,7 @@ struct DriveFileSystem::GetFileFromCacheParams { // DriveFileSystem::AddUploadedFileParams implementation. struct DriveFileSystem::AddUploadedFileParams { - AddUploadedFileParams(const FilePath& file_content_path, + AddUploadedFileParams(const base::FilePath& file_content_path, const FileOperationCallback& callback, const std::string& resource_id, const std::string& md5) @@ -227,7 +227,7 @@ struct DriveFileSystem::AddUploadedFileParams { md5(md5) { } - FilePath file_content_path; + base::FilePath file_content_path; FileOperationCallback callback; std::string resource_id; std::string md5; @@ -401,13 +401,13 @@ void DriveFileSystem::GetEntryInfoByResourceId( void DriveFileSystem::GetEntryInfoByResourceIdAfterGetEntry( const GetEntryInfoWithFilePathCallback& callback, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); if (error != DRIVE_FILE_OK) { - callback.Run(error, FilePath(), scoped_ptr<DriveEntryProto>()); + callback.Run(error, base::FilePath(), scoped_ptr<DriveEntryProto>()); return; } DCHECK(entry_proto.get()); @@ -449,8 +449,8 @@ void DriveFileSystem::LoadFeedIfNeeded(const FileOperationCallback& callback) { } void DriveFileSystem::TransferFileFromRemoteToLocal( - const FilePath& remote_src_file_path, - const FilePath& local_dest_file_path, + const base::FilePath& remote_src_file_path, + const base::FilePath& local_dest_file_path, const FileOperationCallback& callback) { drive_operations_.TransferFileFromRemoteToLocal(remote_src_file_path, @@ -459,8 +459,8 @@ void DriveFileSystem::TransferFileFromRemoteToLocal( } void DriveFileSystem::TransferFileFromLocalToRemote( - const FilePath& local_src_file_path, - const FilePath& remote_dest_file_path, + const base::FilePath& local_src_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback) { drive_operations_.TransferFileFromLocalToRemote(local_src_file_path, @@ -468,23 +468,23 @@ void DriveFileSystem::TransferFileFromLocalToRemote( callback); } -void DriveFileSystem::Copy(const FilePath& src_file_path, - const FilePath& dest_file_path, +void DriveFileSystem::Copy(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); drive_operations_.Copy(src_file_path, dest_file_path, callback); } -void DriveFileSystem::Move(const FilePath& src_file_path, - const FilePath& dest_file_path, +void DriveFileSystem::Move(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); drive_operations_.Move(src_file_path, dest_file_path, callback); } -void DriveFileSystem::Remove(const FilePath& file_path, +void DriveFileSystem::Remove(const base::FilePath& file_path, bool is_recursive, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -493,7 +493,7 @@ void DriveFileSystem::Remove(const FilePath& file_path, } void DriveFileSystem::CreateDirectory( - const FilePath& directory_path, + const base::FilePath& directory_path, bool is_exclusive, bool is_recursive, const FileOperationCallback& callback) { @@ -504,7 +504,7 @@ void DriveFileSystem::CreateDirectory( directory_path, is_exclusive, is_recursive, callback); } -void DriveFileSystem::CreateFile(const FilePath& file_path, +void DriveFileSystem::CreateFile(const base::FilePath& file_path, bool is_exclusive, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -521,7 +521,7 @@ void DriveFileSystem::CreateFile(const FilePath& file_path, } void DriveFileSystem::OnGetEntryInfoForCreateFile( - const FilePath& file_path, + const base::FilePath& file_path, bool is_exclusive, const FileOperationCallback& callback, DriveFileError result, @@ -556,12 +556,12 @@ void DriveFileSystem::OnGetEntryInfoForCreateFile( // No entry found at |file_path|. Let's create a brand new file. // For now, it is implemented by uploading an empty file (/dev/null). // TODO(kinaba): http://crbug.com/135143. Implement in a nicer way. - drive_operations_.TransferRegularFile(FilePath(kEmptyFilePath), + drive_operations_.TransferRegularFile(base::FilePath(kEmptyFilePath), file_path, callback); } -void DriveFileSystem::GetFileByPath(const FilePath& file_path, +void DriveFileSystem::GetFileByPath(const base::FilePath& file_path, const GetFileCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -575,7 +575,7 @@ void DriveFileSystem::GetFileByPath(const FilePath& file_path, } void DriveFileSystem::OnGetEntryInfoCompleteForGetFileByPath( - const FilePath& file_path, + const base::FilePath& file_path, const GetFileCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -583,7 +583,7 @@ void DriveFileSystem::OnGetEntryInfoCompleteForGetFileByPath( DCHECK(!callback.is_null()); if (error != DRIVE_FILE_OK) { - callback.Run(error, FilePath(), std::string(), REGULAR_FILE); + callback.Run(error, base::FilePath(), std::string(), REGULAR_FILE); return; } DCHECK(entry_proto.get()); @@ -595,7 +595,7 @@ void DriveFileSystem::OnGetEntryInfoCompleteForGetFileByPath( } void DriveFileSystem::GetResolvedFileByPath( - const FilePath& file_path, + const base::FilePath& file_path, const GetFileCallback& get_file_callback, const google_apis::GetContentCallback& get_content_callback, scoped_ptr<DriveEntryProto> entry_proto) { @@ -605,7 +605,7 @@ void DriveFileSystem::GetResolvedFileByPath( if (!entry_proto->has_file_specific_info()) { get_file_callback.Run(DRIVE_FILE_ERROR_NOT_FOUND, - FilePath(), + base::FilePath(), std::string(), REGULAR_FILE); return; @@ -616,7 +616,7 @@ void DriveFileSystem::GetResolvedFileByPath( // formats. The JSON file contains the edit URL and resource ID of the // document. if (entry_proto->file_specific_info().is_hosted_document()) { - FilePath* temp_file_path = new FilePath; + base::FilePath* temp_file_path = new base::FilePath; const std::string mime_type = kMimeTypeJson; const DriveFileType file_type = HOSTED_DOCUMENT; base::PostTaskAndReplyWithResult( @@ -637,7 +637,7 @@ void DriveFileSystem::GetResolvedFileByPath( } // Returns absolute path of the file if it were cached or to be cached. - FilePath local_tmp_path = cache_->GetCacheFilePath( + base::FilePath local_tmp_path = cache_->GetCacheFilePath( entry_proto->resource_id(), entry_proto->file_specific_info().file_md5(), DriveCache::CACHE_TYPE_TMP, @@ -676,14 +676,14 @@ void DriveFileSystem::GetFileByResourceIdAfterGetEntry( const GetFileCallback& get_file_callback, const google_apis::GetContentCallback& get_content_callback, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!get_file_callback.is_null()); if (error != DRIVE_FILE_OK) { get_file_callback.Run(DRIVE_FILE_ERROR_NOT_FOUND, - FilePath(), + base::FilePath(), std::string(), REGULAR_FILE); return; @@ -698,7 +698,7 @@ void DriveFileSystem::GetFileByResourceIdAfterGetEntry( void DriveFileSystem::OnGetFileFromCache( const GetFileFromCacheParams& in_params, DriveFileError error, - const FilePath& cache_file_path) { + const base::FilePath& cache_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!in_params.get_file_callback.is_null()); @@ -779,7 +779,7 @@ void DriveFileSystem::CheckForSpaceBeforeDownload( int64 file_size, const GURL& download_url, DriveFileError error, - const FilePath& /* drive_file_path */, + const base::FilePath& /* drive_file_path */, scoped_ptr<DriveEntryProto> /* entry_proto */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!params.get_file_callback.is_null()); @@ -804,7 +804,7 @@ void DriveFileSystem::CheckForSpaceBeforeDownload( void DriveFileSystem::StartDownloadFileIfEnoughSpace( const GetFileFromCacheParams& params, const GURL& download_url, - const FilePath& cache_file_path, + const base::FilePath& cache_file_path, bool has_enough_space) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!params.get_file_callback.is_null()); @@ -829,7 +829,7 @@ void DriveFileSystem::StartDownloadFileIfEnoughSpace( params.get_content_callback); } -void DriveFileSystem::GetEntryInfoByPath(const FilePath& file_path, +void DriveFileSystem::GetEntryInfoByPath(const base::FilePath& file_path, const GetEntryInfoCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -842,7 +842,7 @@ void DriveFileSystem::GetEntryInfoByPath(const FilePath& file_path, } void DriveFileSystem::GetEntryInfoByPathAfterLoad( - const FilePath& file_path, + const base::FilePath& file_path, const GetEntryInfoCallback& callback, DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -877,7 +877,7 @@ void DriveFileSystem::GetEntryInfoByPathAfterGetEntry( } void DriveFileSystem::ReadDirectoryByPath( - const FilePath& directory_path, + const base::FilePath& directory_path, const ReadDirectoryWithSettingCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -889,7 +889,7 @@ void DriveFileSystem::ReadDirectoryByPath( } void DriveFileSystem::ReadDirectoryByPathAfterLoad( - const FilePath& directory_path, + const base::FilePath& directory_path, const ReadDirectoryWithSettingCallback& callback, DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -927,7 +927,8 @@ void DriveFileSystem::ReadDirectoryByPathAfterRead( callback.Run(DRIVE_FILE_OK, hide_hosted_docs_, entries.Pass()); } -void DriveFileSystem::RequestDirectoryRefresh(const FilePath& directory_path) { +void DriveFileSystem::RequestDirectoryRefresh( + const base::FilePath& directory_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // Make sure the destination directory exists. @@ -939,7 +940,7 @@ void DriveFileSystem::RequestDirectoryRefresh(const FilePath& directory_path) { } void DriveFileSystem::RequestDirectoryRefreshAfterGetEntryInfo( - const FilePath& directory_path, + const base::FilePath& directory_path, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -960,7 +961,7 @@ void DriveFileSystem::RequestDirectoryRefreshAfterGetEntryInfo( void DriveFileSystem::OnRequestDirectoryRefresh( const std::string& directory_resource_id, - const FilePath& directory_path, + const base::FilePath& directory_path, const ScopedVector<google_apis::ResourceList>& feed_list, DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -1080,7 +1081,7 @@ void DriveFileSystem::OnSearch( } else { entry_info_callback.Run( DRIVE_FILE_OK, - FilePath::FromUTF8Unsafe(entry_proto.base_name()), + base::FilePath::FromUTF8Unsafe(entry_proto.base_name()), scoped_ptr<DriveEntryProto>(new DriveEntryProto(entry_proto))); } } @@ -1091,7 +1092,7 @@ void DriveFileSystem::AddToSearchResults( bool should_run_callback, const base::Closure& callback, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(entry_proto.get()); @@ -1132,11 +1133,11 @@ void DriveFileSystem::Search(const std::string& search_query, } void DriveFileSystem::OnDirectoryChangedByOperation( - const FilePath& directory_path) { + const base::FilePath& directory_path) { OnDirectoryChanged(directory_path); } -void DriveFileSystem::OnDirectoryChanged(const FilePath& directory_path) { +void DriveFileSystem::OnDirectoryChanged(const base::FilePath& directory_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); FOR_EACH_OBSERVER(DriveFileSystemObserver, observers_, @@ -1167,7 +1168,7 @@ void DriveFileSystem::LoadRootFeedFromCacheForTesting( void DriveFileSystem::OnFileDownloaded( const GetFileFromCacheParams& params, google_apis::GDataErrorCode status, - const FilePath& downloaded_file_path) { + const base::FilePath& downloaded_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!params.get_file_callback.is_null()); @@ -1214,7 +1215,7 @@ void DriveFileSystem::UnpinIfPinned( void DriveFileSystem::OnFileDownloadedAndSpaceChecked( const GetFileFromCacheParams& params, google_apis::GDataErrorCode status, - const FilePath& downloaded_file_path, + const base::FilePath& downloaded_file_path, bool has_enough_space) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!params.get_file_callback.is_null()); @@ -1253,7 +1254,7 @@ void DriveFileSystem::OnFileDownloadedAndSpaceChecked( void DriveFileSystem::OnDirectoryChangeFileMoveCallback( DriveFileError error, - const FilePath& directory_path) { + const base::FilePath& directory_path) { if (error == DRIVE_FILE_OK) OnDirectoryChanged(directory_path); } @@ -1312,9 +1313,9 @@ void DriveFileSystem::NotifyInitialLoadFinishedAndRun( } void DriveFileSystem::AddUploadedFile( - const FilePath& directory_path, + const base::FilePath& directory_path, scoped_ptr<google_apis::ResourceEntry> entry, - const FilePath& file_content_path, + const base::FilePath& file_content_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(entry.get()); @@ -1337,7 +1338,7 @@ void DriveFileSystem::AddUploadedFile( void DriveFileSystem::AddUploadedFileToCache( const AddUploadedFileParams& params, DriveFileError error, - const FilePath& file_path) { + const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!params.resource_id.empty()); DCHECK(!params.md5.empty()); @@ -1393,7 +1394,7 @@ void DriveFileSystem::SetHideHostedDocuments(bool hide) { // Kick off directory refresh when this setting changes. FOR_EACH_OBSERVER(DriveFileSystemObserver, observers_, - OnDirectoryChanged(FilePath(kDriveRootDirectory))); + OnDirectoryChanged(base::FilePath(kDriveRootDirectory))); } //============= DriveFileSystem: internal helper functions ===================== @@ -1409,7 +1410,7 @@ void DriveFileSystem::InitializePreferenceObserver() { base::Unretained(this))); } -void DriveFileSystem::OpenFile(const FilePath& file_path, +void DriveFileSystem::OpenFile(const base::FilePath& file_path, const OpenFileCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -1422,7 +1423,7 @@ void DriveFileSystem::OpenFile(const FilePath& file_path, if (open_files_.find(file_path) != open_files_.end()) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, DRIVE_FILE_ERROR_IN_USE, FilePath())); + base::Bind(callback, DRIVE_FILE_ERROR_IN_USE, base::FilePath())); return; } open_files_.insert(file_path); @@ -1439,7 +1440,7 @@ void DriveFileSystem::OpenFile(const FilePath& file_path, } void DriveFileSystem::OnGetEntryInfoCompleteForOpenFile( - const FilePath& file_path, + const base::FilePath& file_path, const OpenFileCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -1459,7 +1460,7 @@ void DriveFileSystem::OnGetEntryInfoCompleteForOpenFile( } if (error != DRIVE_FILE_OK) { - callback.Run(error, FilePath()); + callback.Run(error, base::FilePath()); return; } @@ -1481,14 +1482,14 @@ void DriveFileSystem::OnGetEntryInfoCompleteForOpenFile( void DriveFileSystem::OnGetFileCompleteForOpenFile( const GetFileCompleteForOpenParams& params, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, const std::string& mime_type, DriveFileType file_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!params.callback.is_null()); if (error != DRIVE_FILE_OK) { - params.callback.Run(error, FilePath()); + params.callback.Run(error, base::FilePath()); return; } @@ -1510,17 +1511,18 @@ void DriveFileSystem::OnMarkDirtyInCacheCompleteForOpenFile( DCHECK(!params.callback.is_null()); if (error != DRIVE_FILE_OK) { - params.callback.Run(error, FilePath()); + params.callback.Run(error, base::FilePath()); return; } cache_->GetFile(params.resource_id, params.md5, params.callback); } -void DriveFileSystem::OnOpenFileFinished(const FilePath& file_path, - const OpenFileCallback& callback, - DriveFileError result, - const FilePath& cache_file_path) { +void DriveFileSystem::OnOpenFileFinished( + const base::FilePath& file_path, + const OpenFileCallback& callback, + DriveFileError result, + const base::FilePath& cache_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -1533,7 +1535,7 @@ void DriveFileSystem::OnOpenFileFinished(const FilePath& file_path, callback.Run(result, cache_file_path); } -void DriveFileSystem::CloseFile(const FilePath& file_path, +void DriveFileSystem::CloseFile(const base::FilePath& file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -1559,7 +1561,7 @@ void DriveFileSystem::CloseFile(const FilePath& file_path, } void DriveFileSystem::CloseFileAfterGetEntryInfo( - const FilePath& file_path, + const base::FilePath& file_path, const FileOperationCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -1585,7 +1587,7 @@ void DriveFileSystem::CloseFileAfterGetEntryInfo( callback); } -void DriveFileSystem::CloseFileFinalize(const FilePath& file_path, +void DriveFileSystem::CloseFileFinalize(const base::FilePath& file_path, const FileOperationCallback& callback, DriveFileError result) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -1659,7 +1661,7 @@ void DriveFileSystem::CheckLocalModificationAndRunAfterGetCacheFile( scoped_ptr<DriveEntryProto> entry_proto, const GetEntryInfoCallback& callback, DriveFileError error, - const FilePath& local_cache_path) { + const base::FilePath& local_cache_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); diff --git a/chrome/browser/chromeos/drive/drive_file_system.h b/chrome/browser/chromeos/drive/drive_file_system.h index bf44cca..5f2db1a 100644 --- a/chrome/browser/chromeos/drive/drive_file_system.h +++ b/chrome/browser/chromeos/drive/drive_file_system.h @@ -82,34 +82,34 @@ class DriveFileSystem : public DriveFileSystemInterface, const GURL& next_feed, const SearchCallback& callback) OVERRIDE; virtual void TransferFileFromRemoteToLocal( - const FilePath& remote_src_file_path, - const FilePath& local_dest_file_path, + const base::FilePath& remote_src_file_path, + const base::FilePath& local_dest_file_path, const FileOperationCallback& callback) OVERRIDE; virtual void TransferFileFromLocalToRemote( - const FilePath& local_src_file_path, - const FilePath& remote_dest_file_path, + const base::FilePath& local_src_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback) OVERRIDE; - virtual void OpenFile(const FilePath& file_path, + virtual void OpenFile(const base::FilePath& file_path, const OpenFileCallback& callback) OVERRIDE; - virtual void CloseFile(const FilePath& file_path, + virtual void CloseFile(const base::FilePath& file_path, const FileOperationCallback& callback) OVERRIDE; - virtual void Copy(const FilePath& src_file_path, - const FilePath& dest_file_path, + virtual void Copy(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) OVERRIDE; - virtual void Move(const FilePath& src_file_path, - const FilePath& dest_file_path, + virtual void Move(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) OVERRIDE; - virtual void Remove(const FilePath& file_path, + virtual void Remove(const base::FilePath& file_path, bool is_recursive, const FileOperationCallback& callback) OVERRIDE; - virtual void CreateDirectory(const FilePath& directory_path, + virtual void CreateDirectory(const base::FilePath& directory_path, bool is_exclusive, bool is_recursive, const FileOperationCallback& callback) OVERRIDE; - virtual void CreateFile(const FilePath& file_path, + virtual void CreateFile(const base::FilePath& file_path, bool is_exclusive, const FileOperationCallback& callback) OVERRIDE; - virtual void GetFileByPath(const FilePath& file_path, + virtual void GetFileByPath(const base::FilePath& file_path, const GetFileCallback& callback) OVERRIDE; virtual void GetFileByResourceId( const std::string& resource_id, @@ -119,18 +119,18 @@ class DriveFileSystem : public DriveFileSystemInterface, const std::string& resource_id, const FileOperationCallback& callback) OVERRIDE; virtual void GetEntryInfoByPath( - const FilePath& file_path, + const base::FilePath& file_path, const GetEntryInfoCallback& callback) OVERRIDE; virtual void ReadDirectoryByPath( - const FilePath& directory_path, + const base::FilePath& directory_path, const ReadDirectoryWithSettingCallback& callback) OVERRIDE; virtual void RequestDirectoryRefresh( - const FilePath& directory_path) OVERRIDE; + const base::FilePath& directory_path) OVERRIDE; virtual void GetAvailableSpace( const GetAvailableSpaceCallback& callback) OVERRIDE; - virtual void AddUploadedFile(const FilePath& directory_path, + virtual void AddUploadedFile(const base::FilePath& directory_path, scoped_ptr<google_apis::ResourceEntry> doc_entry, - const FilePath& file_content_path, + const base::FilePath& file_content_path, const FileOperationCallback& callback) OVERRIDE; virtual void GetMetadata( const GetFilesystemMetadataCallback& callback) OVERRIDE; @@ -138,11 +138,11 @@ class DriveFileSystem : public DriveFileSystemInterface, // file_system::OperationObserver overrides. virtual void OnDirectoryChangedByOperation( - const FilePath& directory_path) OVERRIDE; + const base::FilePath& directory_path) OVERRIDE; // DriveFeedLoader::Observer overrides. // Used to propagate events from DriveFeedLoader. - virtual void OnDirectoryChanged(const FilePath& directory_path) OVERRIDE; + virtual void OnDirectoryChanged(const base::FilePath& directory_path) OVERRIDE; virtual void OnResourceListFetched(int num_accumulated_entries) OVERRIDE; virtual void OnFeedFromServerLoaded() OVERRIDE; @@ -192,7 +192,7 @@ class DriveFileSystem : public DriveFileSystemInterface, bool should_run_callback, const base::Closure& callback, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto); // Invoked during the process of CreateFile. @@ -202,15 +202,15 @@ class DriveFileSystem : public DriveFileSystemInterface, // entry, a new empty file is uploaded, and when it finishes // DidUploadForCreateBrandNewFile does the final clean up. // |callback| must not be null. - void OnGetEntryInfoForCreateFile(const FilePath& file_path, + void OnGetEntryInfoForCreateFile(const base::FilePath& file_path, bool is_exclusive, const FileOperationCallback& callback, DriveFileError result, scoped_ptr<DriveEntryProto> entry_proto); - void DoUploadForCreateBrandNewFile(const FilePath& remote_path, - FilePath* local_path, + void DoUploadForCreateBrandNewFile(const base::FilePath& remote_path, + base::FilePath* local_path, const FileOperationCallback& callback); - void DidUploadForCreateBrandNewFile(const FilePath& local_path, + void DidUploadForCreateBrandNewFile(const base::FilePath& local_path, const FileOperationCallback& callback, DriveFileError result); @@ -218,7 +218,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // GetFileByPath. It then continues to invoke GetResolvedFileByPath. // |callback| must not be null. void OnGetEntryInfoCompleteForGetFileByPath( - const FilePath& file_path, + const base::FilePath& file_path, const GetFileCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> file_info); @@ -227,7 +227,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // It then continues to invoke GetResolvedFileByPath and proceeds to // OnGetFileCompleteForOpenFile. void OnGetEntryInfoCompleteForOpenFile( - const FilePath& file_path, + const base::FilePath& file_path, const OpenFileCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> file_info); @@ -235,10 +235,10 @@ class DriveFileSystem : public DriveFileSystemInterface, // Invoked at the last step of OpenFile. It removes |file_path| from the // current set of opened files if |result| is an error, and then invokes the // |callback| function. - void OnOpenFileFinished(const FilePath& file_path, + void OnOpenFileFinished(const base::FilePath& file_path, const OpenFileCallback& callback, DriveFileError result, - const FilePath& cache_file_path); + const base::FilePath& cache_file_path); // Invoked during the process of CloseFile. What is done here is as follows: // 1) Gets resource_id and md5 of the entry at |file_path|. @@ -246,11 +246,11 @@ class DriveFileSystem : public DriveFileSystemInterface, // 3) Removes the |file_path| from the remembered set of opened files. // 4) Invokes the user-supplied |callback|. // |callback| must not be null. - void CloseFileAfterGetEntryInfo(const FilePath& file_path, + void CloseFileAfterGetEntryInfo(const base::FilePath& file_path, const FileOperationCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); - void CloseFileFinalize(const FilePath& file_path, + void CloseFileFinalize(const base::FilePath& file_path, const FileOperationCallback& callback, DriveFileError result); @@ -260,7 +260,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // |file_info.md5|. void OnGetFileCompleteForOpenFile(const GetFileCompleteForOpenParams& params, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, const std::string& mime_type, DriveFileType file_type); @@ -278,7 +278,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // Callback for handling file downloading requests. void OnFileDownloaded(const GetFileFromCacheParams& params, google_apis::GDataErrorCode status, - const FilePath& downloaded_file_path); + const base::FilePath& downloaded_file_path); // Unpins file if cache entry is pinned. void UnpinIfPinned(const std::string& resource_id, @@ -290,17 +290,17 @@ class DriveFileSystem : public DriveFileSystemInterface, // an error in case we don't have enough disk space. void OnFileDownloadedAndSpaceChecked(const GetFileFromCacheParams& params, google_apis::GDataErrorCode status, - const FilePath& downloaded_file_path, + const base::FilePath& downloaded_file_path, bool has_enough_space); // FileMoveCallback for directory changes. Notifies of directory changes. void OnDirectoryChangeFileMoveCallback(DriveFileError error, - const FilePath& directory_path); + const base::FilePath& directory_path); // Adds the uploaded file to the cache. void AddUploadedFileToCache(const AddUploadedFileParams& params, DriveFileError error, - const FilePath& file_path); + const base::FilePath& file_path); // Callback for handling results of ReloadFeedFromServerIfNeeded() initiated // from CheckForUpdates(). @@ -323,7 +323,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // GetFileByPath() request. void OnGetFileFromCache(const GetFileFromCacheParams& params, DriveFileError error, - const FilePath& cache_file_path); + const base::FilePath& cache_file_path); // Callback for |drive_service_->GetResourceEntry|. // It is called before file download. If GetResourceEntry was successful, @@ -340,14 +340,14 @@ class DriveFileSystem : public DriveFileSystemInterface, int64 file_size, const GURL& download_url, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto); // Starts downloading a file if we have enough disk space indicated by // |has_enough_space|. void StartDownloadFileIfEnoughSpace(const GetFileFromCacheParams& params, const GURL& download_url, - const FilePath& cache_file_path, + const base::FilePath& cache_file_path, bool has_enough_space); // Changes state of hosted documents visibility, triggers directory refresh. @@ -360,7 +360,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // 1) Called when the feed is loaded. // 2) Called when an entry is found. // |callback| must not be null. - void GetEntryInfoByPathAfterLoad(const FilePath& file_path, + void GetEntryInfoByPathAfterLoad(const base::FilePath& file_path, const GetEntryInfoCallback& callback, DriveFileError error); void GetEntryInfoByPathAfterGetEntry(const GetEntryInfoCallback& callback, @@ -372,7 +372,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // 2) Called when an entry is found. // |callback| must not be null. void ReadDirectoryByPathAfterLoad( - const FilePath& directory_path, + const base::FilePath& directory_path, const ReadDirectoryWithSettingCallback& callback, DriveFileError error); void ReadDirectoryByPathAfterRead( @@ -391,14 +391,14 @@ class DriveFileSystem : public DriveFileSystemInterface, // |get_file_callback| must not be null. // |get_content_callback| may be null. void GetResolvedFileByPath( - const FilePath& file_path, + const base::FilePath& file_path, const GetFileCallback& get_file_callback, const google_apis::GetContentCallback& get_content_callback, scoped_ptr<DriveEntryProto> entry_proto); void OnRequestDirectoryRefresh( const std::string& directory_resource_id, - const FilePath& directory_path, + const base::FilePath& directory_path, const ScopedVector<google_apis::ResourceList>& feed_list, DriveFileError error); @@ -408,7 +408,7 @@ class DriveFileSystem : public DriveFileSystemInterface, void GetEntryInfoByResourceIdAfterGetEntry( const GetEntryInfoWithFilePathCallback& callback, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, scoped_ptr<DriveEntryProto> entry_proto); // Part of GetFileByResourceId(). Called after @@ -419,13 +419,13 @@ class DriveFileSystem : public DriveFileSystemInterface, const GetFileCallback& get_file_callback, const google_apis::GetContentCallback& get_content_callback, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, scoped_ptr<DriveEntryProto> entry_proto); // Part of RequestDirectoryRefresh(). Called after // GetEntryInfoByPath() is complete. void RequestDirectoryRefreshAfterGetEntryInfo( - const FilePath& file_path, + const base::FilePath& file_path, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); @@ -444,7 +444,7 @@ class DriveFileSystem : public DriveFileSystemInterface, scoped_ptr<DriveEntryProto> entry_proto, const GetEntryInfoCallback& callback, DriveFileError error, - const FilePath& local_cache_path); + const base::FilePath& local_cache_path); void CheckLocalModificationAndRunAfterGetFileInfo( scoped_ptr<DriveEntryProto> entry_proto, const GetEntryInfoCallback& callback, @@ -481,7 +481,7 @@ class DriveFileSystem : public DriveFileSystemInterface, bool hide_hosted_docs_; // The set of paths opened by OpenFile but not yet closed by CloseFile. - std::set<FilePath> open_files_; + std::set<base::FilePath> open_files_; scoped_ptr<PrefChangeRegistrar> pref_registrar_; diff --git a/chrome/browser/chromeos/drive/drive_file_system_interface.h b/chrome/browser/chromeos/drive/drive_file_system_interface.h index df44133..87b3a56 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_interface.h +++ b/chrome/browser/chromeos/drive/drive_file_system_interface.h @@ -29,19 +29,19 @@ typedef std::vector<DriveEntryProto> DriveEntryProtoVector; // This is data needed to create a file system entry that will be used by file // browser. struct SearchResultInfo { - SearchResultInfo(const FilePath& path, + SearchResultInfo(const base::FilePath& path, const DriveEntryProto& entry_proto) : path(path), entry_proto(entry_proto) { } - FilePath path; + base::FilePath path; DriveEntryProto entry_proto; }; // Used to get files from the file system. typedef base::Callback<void(DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, const std::string& mime_type, DriveFileType file_type)> GetFileCallback; @@ -65,7 +65,7 @@ typedef base::Callback<void( // Used to open files from the file system. |file_path| is the path on the local // file system for the opened file. typedef base::Callback<void(DriveFileError error, - const FilePath& file_path)> OpenFileCallback; + const base::FilePath& file_path)> OpenFileCallback; // Used to get available space for the account from Drive. typedef base::Callback<void(DriveFileError error, @@ -123,8 +123,8 @@ class DriveFileSystemInterface { // // |callback| must not be null. virtual void TransferFileFromRemoteToLocal( - const FilePath& remote_src_file_path, - const FilePath& local_dest_file_path, + const base::FilePath& remote_src_file_path, + const base::FilePath& local_dest_file_path, const FileOperationCallback& callback) = 0; // Initiates transfer of |local_src_file_path| to |remote_dest_file_path|. @@ -134,8 +134,8 @@ class DriveFileSystemInterface { // // |callback| must not be null. virtual void TransferFileFromLocalToRemote( - const FilePath& local_src_file_path, - const FilePath& remote_dest_file_path, + const base::FilePath& local_src_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback) = 0; // Retrieves a file at the virtual path |file_path| on the Drive file system @@ -147,14 +147,14 @@ class DriveFileSystemInterface { // Otherwise, Drive file system does not pick up the file for uploading. // // |callback| must not be null. - virtual void OpenFile(const FilePath& file_path, + virtual void OpenFile(const base::FilePath& file_path, const OpenFileCallback& callback) = 0; // Closes a file at the virtual path |file_path| on the Drive file system, // which is opened via OpenFile(). It commits the dirty flag on the cache. // // |callback| must not be null. - virtual void CloseFile(const FilePath& file_path, + virtual void CloseFile(const base::FilePath& file_path, const FileOperationCallback& callback) = 0; // Copies |src_file_path| to |dest_file_path| on the file system. @@ -175,8 +175,8 @@ class DriveFileSystemInterface { // of the file system. // // |callback| must not be null. - virtual void Copy(const FilePath& src_file_path, - const FilePath& dest_file_path, + virtual void Copy(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) = 0; // Moves |src_file_path| to |dest_file_path| on the file system. @@ -195,8 +195,8 @@ class DriveFileSystemInterface { // of the file system. // // |callback| must not be null. - virtual void Move(const FilePath& src_file_path, - const FilePath& dest_file_path, + virtual void Move(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) = 0; // Removes |file_path| from the file system. If |is_recursive| is set and @@ -208,7 +208,7 @@ class DriveFileSystemInterface { // TODO(satorux): is_recursive is not supported yet. crbug.com/138282 // // |callback| must not be null. - virtual void Remove(const FilePath& file_path, + virtual void Remove(const base::FilePath& file_path, bool is_recursive, const FileOperationCallback& callback) = 0; @@ -218,7 +218,7 @@ class DriveFileSystemInterface { // directories as needed just like mkdir -p does. // // |callback| must not be null. - virtual void CreateDirectory(const FilePath& directory_path, + virtual void CreateDirectory(const base::FilePath& directory_path, bool is_exclusive, bool is_recursive, const FileOperationCallback& callback) = 0; @@ -229,7 +229,7 @@ class DriveFileSystemInterface { // path, or the parent directory of the path is not present yet. // // |callback| must not be null. - virtual void CreateFile(const FilePath& file_path, + virtual void CreateFile(const base::FilePath& file_path, bool is_exclusive, const FileOperationCallback& callback) = 0; @@ -239,7 +239,7 @@ class DriveFileSystemInterface { // will be downloaded through GData API or Drive V2 API. // // |callback| must not be null. - virtual void GetFileByPath(const FilePath& file_path, + virtual void GetFileByPath(const base::FilePath& file_path, const GetFileCallback& callback) = 0; // Gets a file by the given |resource_id| from the Drive server. Used for @@ -268,7 +268,7 @@ class DriveFileSystemInterface { // retrieve and refresh file system content from server and disk cache. // // |callback| must not be null. - virtual void GetEntryInfoByPath(const FilePath& file_path, + virtual void GetEntryInfoByPath(const base::FilePath& file_path, const GetEntryInfoCallback& callback) = 0; // Finds and reads a directory by |file_path|. This call will also retrieve @@ -276,7 +276,7 @@ class DriveFileSystemInterface { // // |callback| must not be null. virtual void ReadDirectoryByPath( - const FilePath& file_path, + const base::FilePath& file_path, const ReadDirectoryWithSettingCallback& callback) = 0; // Requests a refresh of the directory pointed by |file_path| (i.e. fetches @@ -291,7 +291,7 @@ class DriveFileSystemInterface { // and the change is notified via Observer::OnDirectoryChanged(). Note that // this function ignores changes in directories in the target // directory. Changes in directories are handled via the delta feeds. - virtual void RequestDirectoryRefresh(const FilePath& file_path) = 0; + virtual void RequestDirectoryRefresh(const base::FilePath& file_path) = 0; // Does server side content search for |search_query|. // If |shared_with_me| is true, it searches for the files shared to the user, @@ -315,9 +315,9 @@ class DriveFileSystemInterface { // |file_content_path| into the cache. // // |callback| must not be null. - virtual void AddUploadedFile(const FilePath& directory_path, + virtual void AddUploadedFile(const base::FilePath& directory_path, scoped_ptr<google_apis::ResourceEntry> doc_entry, - const FilePath& file_content_path, + const base::FilePath& file_content_path, const FileOperationCallback& callback) = 0; // Returns miscellaneous metadata of the file system like the largest diff --git a/chrome/browser/chromeos/drive/drive_file_system_proxy.cc b/chrome/browser/chromeos/drive/drive_file_system_proxy.cc index b67cddb..6a61650 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_proxy.cc +++ b/chrome/browser/chromeos/drive/drive_file_system_proxy.cc @@ -53,7 +53,7 @@ void OnGetFileByPathForOpen( int file_flags, base::ProcessHandle peer_handle, DriveFileError file_error, - const FilePath& local_path, + const base::FilePath& local_path, const std::string& unused_mime_type, DriveFileType file_type) { base::PlatformFileError error = @@ -85,7 +85,7 @@ void CallSnapshotFileCallback( const FileSystemOperation::SnapshotFileCallback& callback, const base::PlatformFileInfo& file_info, DriveFileError file_error, - const FilePath& local_path, + const base::FilePath& local_path, const std::string& unused_mime_type, DriveFileType file_type) { scoped_refptr<ShareableFileReference> file_ref; @@ -114,13 +114,13 @@ void CallSnapshotFileCallback( } // Emits debug log when DriveFileSystem::CloseFile() is complete. -void EmitDebugLogForCloseFile(const FilePath& local_path, +void EmitDebugLogForCloseFile(const base::FilePath& local_path, DriveFileError file_error) { DVLOG(1) << "Closed: " << local_path.AsUTF8Unsafe() << ": " << file_error; } base::PlatformFileError DoTruncateOnBlockingPool( - const FilePath& local_cache_path, + const base::FilePath& local_cache_path, int64 length) { base::PlatformFileError result = base::PLATFORM_FILE_ERROR_FAILED; @@ -179,13 +179,13 @@ void DriveFileSystemProxy::DetachFromFileSystem() { void DriveFileSystemProxy::GetFileInfo(const FileSystemURL& file_url, const FileSystemOperation::GetMetadataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(file_url, &file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND, base::PlatformFileInfo(), - FilePath())); + base::FilePath())); return; } @@ -205,7 +205,7 @@ void DriveFileSystemProxy::Copy(const FileSystemURL& src_file_url, const FileSystemOperation::StatusCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath src_file_path, dest_file_path; + base::FilePath src_file_path, dest_file_path; if (!ValidateUrl(src_file_url, &src_file_path) || !ValidateUrl(dest_file_url, &dest_file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, @@ -229,7 +229,7 @@ void DriveFileSystemProxy::Move(const FileSystemURL& src_file_url, const FileSystemOperation::StatusCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath src_file_path, dest_file_path; + base::FilePath src_file_path, dest_file_path; if (!ValidateUrl(src_file_url, &src_file_path) || !ValidateUrl(dest_file_url, &dest_file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, @@ -252,7 +252,7 @@ void DriveFileSystemProxy::ReadDirectory(const FileSystemURL& file_url, const FileSystemOperation::ReadDirectoryCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(file_url, &file_path)) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, @@ -277,7 +277,7 @@ void DriveFileSystemProxy::Remove(const FileSystemURL& file_url, bool recursive, const FileSystemOperation::StatusCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(file_url, &file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND)); @@ -302,7 +302,7 @@ void DriveFileSystemProxy::CreateDirectory( const FileSystemOperation::StatusCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(file_url, &file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND)); @@ -327,7 +327,7 @@ void DriveFileSystemProxy::CreateFile( const FileSystemOperation::StatusCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(file_url, &file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND)); @@ -356,7 +356,7 @@ void DriveFileSystemProxy::Truncate( return; } - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(file_url, &file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND)); @@ -383,7 +383,7 @@ void DriveFileSystemProxy::OnOpenFileForWriting( base::ProcessHandle peer_handle, const FileSystemOperation::OpenFileCallback& callback, DriveFileError file_error, - const FilePath& local_cache_path) { + const base::FilePath& local_cache_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); base::PlatformFileError error = @@ -412,7 +412,7 @@ void DriveFileSystemProxy::OnOpenFileForWriting( } void DriveFileSystemProxy::OnCreateFileForOpen( - const FilePath& file_path, + const base::FilePath& file_path, int file_flags, base::ProcessHandle peer_handle, const FileSystemOperation::OpenFileCallback& callback, @@ -448,11 +448,11 @@ void DriveFileSystemProxy::OnCreateFileForOpen( } void DriveFileSystemProxy::OnFileOpenedForTruncate( - const FilePath& virtual_path, + const base::FilePath& virtual_path, int64 length, const fileapi::FileSystemOperation::StatusCallback& callback, DriveFileError open_result, - const FilePath& local_cache_path) { + const base::FilePath& local_cache_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); if (open_result != DRIVE_FILE_OK) { @@ -475,7 +475,7 @@ void DriveFileSystemProxy::OnFileOpenedForTruncate( } void DriveFileSystemProxy::DidTruncate( - const FilePath& virtual_path, + const base::FilePath& virtual_path, const FileSystemOperation::StatusCallback& callback, base::PlatformFileError truncate_result) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); @@ -499,7 +499,7 @@ void DriveFileSystemProxy::OpenFile( const FileSystemOperation::OpenFileCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(file_url, &file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(callback, @@ -577,7 +577,7 @@ void DriveFileSystemProxy::OpenFile( } void DriveFileSystemProxy::NotifyCloseFile(const FileSystemURL& url) { - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(url, &file_path)) return; @@ -608,13 +608,13 @@ void DriveFileSystemProxy::CreateSnapshotFile( const FileSystemOperation::SnapshotFileCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(file_url, &file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND, base::PlatformFileInfo(), - FilePath(), + base::FilePath(), scoped_refptr<ShareableFileReference>(NULL))); return; } @@ -631,7 +631,7 @@ void DriveFileSystemProxy::CreateSnapshotFile( } void DriveFileSystemProxy::OnGetEntryInfoByPath( - const FilePath& entry_path, + const base::FilePath& entry_path, const FileSystemOperation::SnapshotFileCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -640,7 +640,7 @@ void DriveFileSystemProxy::OnGetEntryInfoByPath( if (error != DRIVE_FILE_OK || !entry_proto.get()) { callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND, base::PlatformFileInfo(), - FilePath(), + base::FilePath(), scoped_refptr<ShareableFileReference>(NULL)); return; } @@ -663,12 +663,12 @@ void DriveFileSystemProxy::CreateWritableSnapshotFile( const fileapi::WritableSnapshotFile& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(file_url, &file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND, - FilePath(), + base::FilePath(), scoped_refptr<ShareableFileReference>(NULL))); return; } @@ -692,7 +692,7 @@ DriveFileSystemProxy::~DriveFileSystemProxy() { // static. bool DriveFileSystemProxy::ValidateUrl( - const FileSystemURL& url, FilePath* file_path) { + const FileSystemURL& url, base::FilePath* file_path) { // what platform you're on. if (!url.is_valid() || url.type() != fileapi::kFileSystemTypeDrive) { return false; @@ -728,7 +728,7 @@ void DriveFileSystemProxy::OnStatusCallback( } void DriveFileSystemProxy::OnGetMetadata( - const FilePath& file_path, + const base::FilePath& file_path, const FileSystemOperation::GetMetadataCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -737,7 +737,7 @@ void DriveFileSystemProxy::OnGetMetadata( if (error != DRIVE_FILE_OK) { callback.Run(DriveFileErrorToPlatformError(error), base::PlatformFileInfo(), - FilePath()); + base::FilePath()); return; } DCHECK(entry_proto.get()); @@ -780,10 +780,10 @@ void DriveFileSystemProxy::OnReadDirectory( } void DriveFileSystemProxy::OnCreateWritableSnapshotFile( - const FilePath& virtual_path, + const base::FilePath& virtual_path, const fileapi::WritableSnapshotFile& callback, DriveFileError result, - const FilePath& local_path) { + const base::FilePath& local_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); scoped_refptr<ShareableFileReference> file_ref; @@ -803,8 +803,8 @@ void DriveFileSystemProxy::OnCreateWritableSnapshotFile( } void DriveFileSystemProxy::CloseWritableSnapshotFile( - const FilePath& virtual_path, - const FilePath& local_path) { + const base::FilePath& virtual_path, + const base::FilePath& local_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); CallDriveFileSystemMethodOnUIThread( diff --git a/chrome/browser/chromeos/drive/drive_file_system_proxy.h b/chrome/browser/chromeos/drive/drive_file_system_proxy.h index 50142bd..7fcbd01 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_proxy.h +++ b/chrome/browser/chromeos/drive/drive_file_system_proxy.h @@ -96,7 +96,7 @@ class DriveFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { // the call will return true and fill in |file_path| with a file path of // a corresponding element within this file system. static bool ValidateUrl(const fileapi::FileSystemURL& url, - FilePath* file_path); + base::FilePath* file_path); // Helper method to call methods of DriveFilesSystem. This method aborts // method calls in case DetachFromFileSystem() has been called. @@ -115,7 +115,7 @@ class DriveFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { // Helper callback for relaying reply for metadata retrieval request to the // calling thread. void OnGetMetadata( - const FilePath& file_path, + const base::FilePath& file_path, const fileapi::FileSystemOperation::GetMetadataCallback& callback, DriveFileError error, @@ -124,7 +124,7 @@ class DriveFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { // Helper callback for relaying reply for GetEntryInfoByPath() to the // calling thread. void OnGetEntryInfoByPath( - const FilePath& entry_path, + const base::FilePath& entry_path, const fileapi::FileSystemOperation::SnapshotFileCallback& callback, DriveFileError error, @@ -142,31 +142,31 @@ class DriveFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { // Helper callback for relaying reply for CreateWritableSnapshotFile() to // the calling thread. void OnCreateWritableSnapshotFile( - const FilePath& virtual_path, + const base::FilePath& virtual_path, const fileapi::WritableSnapshotFile& callback, DriveFileError result, - const FilePath& local_path); + const base::FilePath& local_path); // Helper callback for closing the local cache file and committing the dirty // flag. This is triggered when the callback for CreateWritableSnapshotFile // released the refcounted reference to the file. void CloseWritableSnapshotFile( - const FilePath& virtual_path, - const FilePath& local_path); + const base::FilePath& virtual_path, + const base::FilePath& local_path); // Invoked during Truncate() operation. This is called when a local modifiable // cache is ready for truncation. void OnFileOpenedForTruncate( - const FilePath& virtual_path, + const base::FilePath& virtual_path, int64 length, const fileapi::FileSystemOperation::StatusCallback& callback, DriveFileError open_result, - const FilePath& local_cache_path); + const base::FilePath& local_cache_path); // Invoked during Truncate() operation. This is called when the truncation of // a local cache file is finished on FILE thread. void DidTruncate( - const FilePath& virtual_path, + const base::FilePath& virtual_path, const fileapi::FileSystemOperation::StatusCallback& callback, base::PlatformFileError truncate_result); @@ -178,11 +178,11 @@ class DriveFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { base::ProcessHandle peer_handle, const fileapi::FileSystemOperation::OpenFileCallback& callback, DriveFileError file_error, - const FilePath& local_cache_path); + const base::FilePath& local_cache_path); // Invoked during OpenFile() operation when file create flags are set. void OnCreateFileForOpen( - const FilePath& file_path, + const base::FilePath& file_path, int file_flags, base::ProcessHandle peer_handle, const fileapi::FileSystemOperation::OpenFileCallback& callback, diff --git a/chrome/browser/chromeos/drive/drive_file_system_unittest.cc b/chrome/browser/chromeos/drive/drive_file_system_unittest.cc index 9de17d9..9302e05 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_file_system_unittest.cc @@ -70,7 +70,7 @@ void DriveSearchCallback( ASSERT_EQ(expected_results_size, results->size()); for (size_t i = 0; i < results->size(); i++) { - EXPECT_EQ(FilePath(expected_results[i].path), + EXPECT_EQ(base::FilePath(expected_results[i].path), results->at(i).path); EXPECT_EQ(expected_results[i].is_directory, results->at(i).entry_proto.file_info().is_directory()); @@ -104,8 +104,8 @@ class FakeDriveUploader : public google_apis::DriveUploaderInterface { // contents of "gdata/uploaded_file.json" to the caller. virtual void UploadNewFile( const GURL& upload_location, - const FilePath& drive_file_path, - const FilePath& local_file_path, + const base::FilePath& drive_file_path, + const base::FilePath& local_file_path, const std::string& title, const std::string& content_type, const google_apis::UploadCompletionCallback& callback) OVERRIDE { @@ -130,8 +130,8 @@ class FakeDriveUploader : public google_apis::DriveUploaderInterface { // "gdata/root_feed.json" to the caller. virtual void UploadExistingFile( const GURL& upload_location, - const FilePath& drive_file_path, - const FilePath& local_file_path, + const base::FilePath& drive_file_path, + const base::FilePath& local_file_path, const std::string& content_type, const std::string& etag, const google_apis::UploadCompletionCallback& callback) OVERRIDE { @@ -277,7 +277,7 @@ class DriveFileSystemTest : public testing::Test { return true; } - void AddDirectoryFromFile(const FilePath& directory_path, + void AddDirectoryFromFile(const base::FilePath& directory_path, const std::string& filename) { scoped_ptr<Value> atom = google_apis::test_util::LoadJSONFile(filename); ASSERT_TRUE(atom.get()); @@ -293,7 +293,7 @@ class DriveFileSystemTest : public testing::Test { // Tweak entry title to match the last segment of the directory path // (new directory name). - std::vector<FilePath::StringType> dir_parts; + std::vector<base::FilePath::StringType> dir_parts; directory_path.GetComponents(&dir_parts); entry_dict->SetString("title.$t", dir_parts[dir_parts.size() - 1]); @@ -307,7 +307,7 @@ class DriveFileSystemTest : public testing::Test { EXPECT_EQ(DRIVE_FILE_OK, error); } - bool RemoveEntry(const FilePath& file_path) { + bool RemoveEntry(const base::FilePath& file_path) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; file_system_->Remove( file_path, false, @@ -317,7 +317,7 @@ class DriveFileSystemTest : public testing::Test { return error == DRIVE_FILE_OK; } - FilePath GetCachePathForFile(const std::string& resource_id, + base::FilePath GetCachePathForFile(const std::string& resource_id, const std::string& md5) { return cache_->GetCacheFilePath(resource_id, md5, @@ -327,7 +327,7 @@ class DriveFileSystemTest : public testing::Test { // Gets entry info by path synchronously. scoped_ptr<DriveEntryProto> GetEntryInfoByPathSync( - const FilePath& file_path) { + const base::FilePath& file_path) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; scoped_ptr<DriveEntryProto> entry_proto; file_system_->GetEntryInfoByPath( @@ -341,7 +341,7 @@ class DriveFileSystemTest : public testing::Test { // Gets directory info by path synchronously. scoped_ptr<DriveEntryProtoVector> ReadDirectoryByPathSync( - const FilePath& file_path) { + const base::FilePath& file_path) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; scoped_ptr<DriveEntryProtoVector> entries; file_system_->ReadDirectoryByPath( @@ -354,13 +354,13 @@ class DriveFileSystemTest : public testing::Test { } // Returns true if an entry exists at |file_path|. - bool EntryExists(const FilePath& file_path) { + bool EntryExists(const base::FilePath& file_path) { return GetEntryInfoByPathSync(file_path).get(); } // Gets the resource ID of |file_path|. Returns an empty string if not found. - std::string GetResourceIdByPath(const FilePath& file_path) { + std::string GetResourceIdByPath(const base::FilePath& file_path) { scoped_ptr<DriveEntryProto> entry_proto = GetEntryInfoByPathSync(file_path); if (entry_proto.get()) @@ -392,7 +392,7 @@ class DriveFileSystemTest : public testing::Test { // Returns true if the cache file exists for the given resource ID and MD5. bool CacheFileExists(const std::string& resource_id, const std::string& md5) { - const FilePath file_path = cache_->GetCacheFilePath( + const base::FilePath file_path = cache_->GetCacheFilePath( resource_id, md5, DriveCache::CACHE_TYPE_TMP, @@ -403,7 +403,7 @@ class DriveFileSystemTest : public testing::Test { void TestStoreToCache( const std::string& resource_id, const std::string& md5, - const FilePath& source_path, + const base::FilePath& source_path, DriveFileError expected_error, int expected_cache_state, DriveCache::CacheSubDirectoryType expected_sub_dir_type) { @@ -480,7 +480,7 @@ class DriveFileSystemTest : public testing::Test { void VerifyCacheStateAfterOpenFile(DriveFileError error, const std::string& resource_id, const std::string& md5, - const FilePath& cache_file_path) { + const base::FilePath& cache_file_path) { expected_error_ = DRIVE_FILE_OK; expected_cache_state_ = (test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | @@ -527,7 +527,7 @@ class DriveFileSystemTest : public testing::Test { } // Verify actual cache file. - FilePath dest_path = cache_->GetCacheFilePath( + base::FilePath dest_path = cache_->GetCacheFilePath( resource_id, md5, test_util::ToCacheEntry(expected_cache_state_).is_pinned() || @@ -544,7 +544,7 @@ class DriveFileSystemTest : public testing::Test { EXPECT_FALSE(exists); // Verify symlink in pinned dir. - FilePath symlink_path = cache_->GetCacheFilePath( + base::FilePath symlink_path = cache_->GetCacheFilePath( resource_id, std::string(), DriveCache::CACHE_TYPE_PINNED, @@ -553,7 +553,7 @@ class DriveFileSystemTest : public testing::Test { exists = file_util::IsLink(symlink_path); if (test_util::ToCacheEntry(expected_cache_state_).is_pinned()) { EXPECT_TRUE(exists); - FilePath target_path; + base::FilePath target_path; EXPECT_TRUE(file_util::ReadSymbolicLink(symlink_path, &target_path)); if (test_util::ToCacheEntry(expected_cache_state_).is_present()) EXPECT_EQ(dest_path, target_path); @@ -574,7 +574,7 @@ class DriveFileSystemTest : public testing::Test { if (expect_outgoing_symlink_ && test_util::ToCacheEntry(expected_cache_state_).is_dirty()) { EXPECT_TRUE(exists); - FilePath target_path; + base::FilePath target_path; EXPECT_TRUE(file_util::ReadSymbolicLink(symlink_path, &target_path)); EXPECT_TRUE(target_path.value() != kSymLinkToDevNull); if (test_util::ToCacheEntry(expected_cache_state_).is_present()) @@ -672,7 +672,7 @@ class DriveFileSystemTest : public testing::Test { ASSERT_TRUE(root.SerializeToString(&serialized_proto)); ASSERT_TRUE(!serialized_proto.empty()); - FilePath cache_dir_path = profile_->GetPath().Append( + base::FilePath cache_dir_path = profile_->GetPath().Append( FILE_PATH_LITERAL("GCache/v1/meta/")); ASSERT_TRUE(file_util::CreateDirectory(cache_dir_path)); const int file_size = static_cast<int>(serialized_proto.length()); @@ -683,7 +683,7 @@ class DriveFileSystemTest : public testing::Test { // Verifies that |file_path| is a valid JSON file for the hosted document // associated with |entry| (i.e. |url| and |resource_id| match). void VerifyHostedDocumentJSONFile(const DriveEntryProto& entry_proto, - const FilePath& file_path) { + const base::FilePath& file_path) { std::string error; JSONFileValueSerializer serializer(file_path); scoped_ptr<Value> value(serializer.Deserialize(NULL, &error)); @@ -728,7 +728,7 @@ class DriveFileSystemTest : public testing::Test { void AsyncInitializationCallback( int* counter, int expected_counter, - const FilePath& expected_file_path, + const base::FilePath& expected_file_path, MessageLoop* message_loop, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -748,13 +748,13 @@ TEST_F(DriveFileSystemTest, DuplicatedAsyncInitialization) { &AsyncInitializationCallback, &counter, 2, - FilePath(FILE_PATH_LITERAL("drive")), + base::FilePath(FILE_PATH_LITERAL("drive")), &message_loop_); file_system_->GetEntryInfoByPath( - FilePath(FILE_PATH_LITERAL("drive")), callback); + base::FilePath(FILE_PATH_LITERAL("drive")), callback); file_system_->GetEntryInfoByPath( - FilePath(FILE_PATH_LITERAL("drive")), callback); + base::FilePath(FILE_PATH_LITERAL("drive")), callback); message_loop_.Run(); // Wait to get our result EXPECT_EQ(2, counter); @@ -768,9 +768,9 @@ TEST_F(DriveFileSystemTest, DuplicatedAsyncInitialization) { TEST_F(DriveFileSystemTest, SearchRootDirectory) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath = FilePath(FILE_PATH_LITERAL("drive")); + const base::FilePath kFilePath = base::FilePath(FILE_PATH_LITERAL("drive")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync( - FilePath(FILE_PATH_LITERAL(kFilePath))); + base::FilePath(FILE_PATH_LITERAL(kFilePath))); ASSERT_TRUE(entry.get()); EXPECT_EQ(fake_drive_service_->GetRootResourceId(), entry->resource_id()); } @@ -778,7 +778,7 @@ TEST_F(DriveFileSystemTest, SearchRootDirectory) { TEST_F(DriveFileSystemTest, SearchExistingFile) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath = FilePath( + const base::FilePath kFilePath = base::FilePath( FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath); ASSERT_TRUE(entry.get()); @@ -788,7 +788,7 @@ TEST_F(DriveFileSystemTest, SearchExistingFile) { TEST_F(DriveFileSystemTest, SearchExistingDocument) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath = FilePath( + const base::FilePath kFilePath = base::FilePath( FILE_PATH_LITERAL("drive/Document 1.gdoc")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath); ASSERT_TRUE(entry.get()); @@ -798,7 +798,7 @@ TEST_F(DriveFileSystemTest, SearchExistingDocument) { TEST_F(DriveFileSystemTest, SearchNonExistingFile) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath = FilePath( + const base::FilePath kFilePath = base::FilePath( FILE_PATH_LITERAL("drive/nonexisting.file")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath); ASSERT_FALSE(entry.get()); @@ -807,18 +807,18 @@ TEST_F(DriveFileSystemTest, SearchNonExistingFile) { TEST_F(DriveFileSystemTest, SearchEncodedFileNames) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath1 = FilePath( + const base::FilePath kFilePath1 = base::FilePath( FILE_PATH_LITERAL("drive/Slash / in file 1.txt")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath1); ASSERT_FALSE(entry.get()); - const FilePath kFilePath2 = FilePath::FromUTF8Unsafe( + const base::FilePath kFilePath2 = base::FilePath::FromUTF8Unsafe( "drive/Slash \xE2\x88\x95 in file 1.txt"); entry = GetEntryInfoByPathSync(kFilePath2); ASSERT_TRUE(entry.get()); EXPECT_EQ("file:slash_file_resource_id", entry->resource_id()); - const FilePath kFilePath3 = FilePath::FromUTF8Unsafe( + const base::FilePath kFilePath3 = base::FilePath::FromUTF8Unsafe( "drive/Slash \xE2\x88\x95 in directory/Slash SubDir File.txt"); entry = GetEntryInfoByPathSync(kFilePath3); ASSERT_TRUE(entry.get()); @@ -828,18 +828,18 @@ TEST_F(DriveFileSystemTest, SearchEncodedFileNames) { TEST_F(DriveFileSystemTest, SearchEncodedFileNamesLoadingRoot) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath1 = FilePath( + const base::FilePath kFilePath1 = base::FilePath( FILE_PATH_LITERAL("drive/Slash / in file 1.txt")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath1); ASSERT_FALSE(entry.get()); - const FilePath kFilePath2 = FilePath::FromUTF8Unsafe( + const base::FilePath kFilePath2 = base::FilePath::FromUTF8Unsafe( "drive/Slash \xE2\x88\x95 in file 1.txt"); entry = GetEntryInfoByPathSync(kFilePath2); ASSERT_TRUE(entry.get()); EXPECT_EQ("file:slash_file_resource_id", entry->resource_id()); - const FilePath kFilePath3 = FilePath::FromUTF8Unsafe( + const base::FilePath kFilePath3 = base::FilePath::FromUTF8Unsafe( "drive/Slash \xE2\x88\x95 in directory/Slash SubDir File.txt"); entry = GetEntryInfoByPathSync(kFilePath3); ASSERT_TRUE(entry.get()); @@ -849,13 +849,13 @@ TEST_F(DriveFileSystemTest, SearchEncodedFileNamesLoadingRoot) { TEST_F(DriveFileSystemTest, SearchDuplicateNames) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath1 = FilePath( + const base::FilePath kFilePath1 = base::FilePath( FILE_PATH_LITERAL("drive/Duplicate Name.txt")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath1); ASSERT_TRUE(entry.get()); const std::string resource_id1 = entry->resource_id(); - const FilePath kFilePath2 = FilePath( + const base::FilePath kFilePath2 = base::FilePath( FILE_PATH_LITERAL("drive/Duplicate Name (2).txt")); entry = GetEntryInfoByPathSync(kFilePath2); ASSERT_TRUE(entry.get()); @@ -874,7 +874,7 @@ TEST_F(DriveFileSystemTest, SearchDuplicateNames) { TEST_F(DriveFileSystemTest, SearchExistingDirectory) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath = FilePath( + const base::FilePath kFilePath = base::FilePath( FILE_PATH_LITERAL("drive/Directory 1")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath); ASSERT_TRUE(entry.get()); @@ -884,7 +884,7 @@ TEST_F(DriveFileSystemTest, SearchExistingDirectory) { TEST_F(DriveFileSystemTest, SearchInSubdir) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath = FilePath( + const base::FilePath kFilePath = base::FilePath( FILE_PATH_LITERAL("drive/Directory 1/SubDirectory File 1.txt")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath); ASSERT_TRUE(entry.get()); @@ -895,7 +895,7 @@ TEST_F(DriveFileSystemTest, SearchInSubdir) { TEST_F(DriveFileSystemTest, SearchInSubSubdir) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath = FilePath( + const base::FilePath kFilePath = base::FilePath( FILE_PATH_LITERAL("drive/Directory 1/Sub Directory Folder/" "Sub Sub Directory Folder")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath); @@ -906,10 +906,12 @@ TEST_F(DriveFileSystemTest, SearchInSubSubdir) { TEST_F(DriveFileSystemTest, FilePathTests) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/File 1.txt")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/Directory 1")))); + EXPECT_TRUE( + EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/File 1.txt")))); + EXPECT_TRUE( + EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1")))); EXPECT_TRUE(EntryExists( - FilePath( + base::FilePath( FILE_PATH_LITERAL("drive/Directory 1/SubDirectory File 1.txt")))); } @@ -917,38 +919,40 @@ TEST_F(DriveFileSystemTest, ChangeFeed_AddAndDeleteFileInRoot) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(2); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(2); ASSERT_TRUE(LoadChangeFeed("gdata/delta_file_added_in_root.json")); EXPECT_TRUE( - EntryExists(FilePath(FILE_PATH_LITERAL("drive/Added file.gdoc")))); + EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/Added file.gdoc")))); ASSERT_TRUE(LoadChangeFeed("gdata/delta_file_deleted_in_root.json")); EXPECT_FALSE( - EntryExists(FilePath(FILE_PATH_LITERAL("drive/Added file.gdoc")))); + EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/Added file.gdoc")))); } TEST_F(DriveFileSystemTest, ChangeFeed_AddAndDeleteFileFromExistingDirectory) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/Directory 1")))); + EXPECT_TRUE( + EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1")))); // Add file to an existing directory. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); ASSERT_TRUE(LoadChangeFeed("gdata/delta_file_added_in_directory.json")); - EXPECT_TRUE(EntryExists(FilePath( + EXPECT_TRUE(EntryExists(base::FilePath( FILE_PATH_LITERAL("drive/Directory 1/Added file.gdoc")))); // Remove that file from the directory. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); ASSERT_TRUE(LoadChangeFeed("gdata/delta_file_deleted_in_directory.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/Directory 1")))); - EXPECT_FALSE(EntryExists(FilePath( + EXPECT_TRUE( + EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1")))); + EXPECT_FALSE(EntryExists(base::FilePath( FILE_PATH_LITERAL("drive/Directory 1/Added file.gdoc")))); } @@ -956,14 +960,15 @@ TEST_F(DriveFileSystemTest, ChangeFeed_AddFileToNewDirectory) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); // Add file to a new directory. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/New Directory"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/New Directory"))))).Times(1); ASSERT_TRUE(LoadChangeFeed("gdata/delta_file_added_in_new_directory.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/New Directory")))); - EXPECT_TRUE(EntryExists(FilePath( + EXPECT_TRUE( + EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/New Directory")))); + EXPECT_TRUE(EntryExists(base::FilePath( FILE_PATH_LITERAL("drive/New Directory/File in new dir.gdoc")))); } @@ -981,41 +986,41 @@ TEST_F(DriveFileSystemTest, ChangeFeed_AddFileToNewButDeletedDirectory) { TEST_F(DriveFileSystemTest, ChangeFeed_DirectoryMovedFromRootToDirectory) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 2")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/SubDirectory File 1.txt")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/Sub Directory Folder")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/Sub Directory Folder/Sub Sub Directory Folder")))); // This will move "Directory 1" from "drive/" to "drive/Directory 2/". EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 2"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 2"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 2/Directory 1"))))) + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 2/Directory 1"))))) .Times(1); ASSERT_TRUE(LoadChangeFeed( "gdata/delta_dir_moved_from_root_to_directory.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 2")))); - EXPECT_FALSE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_FALSE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 2/Directory 1")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 2/Directory 1/SubDirectory File 1.txt")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 2/Directory 1/Sub Directory Folder")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 2/Directory 1/Sub Directory Folder/" "Sub Sub Directory Folder")))); } @@ -1023,53 +1028,53 @@ TEST_F(DriveFileSystemTest, ChangeFeed_DirectoryMovedFromRootToDirectory) { TEST_F(DriveFileSystemTest, ChangeFeed_FileMovedFromDirectoryToRoot) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/Sub Directory Folder")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/Sub Directory Folder/Sub Sub Directory Folder")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/SubDirectory File 1.txt")))); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); ASSERT_TRUE(LoadChangeFeed( "gdata/delta_file_moved_from_directory_to_root.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/Sub Directory Folder")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/Sub Directory Folder/Sub Sub Directory Folder")))); - EXPECT_FALSE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_FALSE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/SubDirectory File 1.txt")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/SubDirectory File 1.txt")))); } TEST_F(DriveFileSystemTest, ChangeFeed_FileRenamedInDirectory) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/SubDirectory File 1.txt")))); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); ASSERT_TRUE(LoadChangeFeed("gdata/delta_file_renamed_in_directory.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1")))); - EXPECT_FALSE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_FALSE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/SubDirectory File 1.txt")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/New SubDirectory File 1.txt")))); } @@ -1077,19 +1082,21 @@ TEST_F(DriveFileSystemTest, CachedFeedLoading) { SaveTestFileSystem(USE_OLD_TIMESTAMP); ASSERT_TRUE(TestLoadMetadataFromCache()); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/File1")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/Dir1")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/Dir1/File2")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/Dir1/SubDir2")))); + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/File1")))); + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/Dir1")))); + EXPECT_TRUE( + EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/Dir1/File2")))); + EXPECT_TRUE( + EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/Dir1/SubDir2")))); EXPECT_TRUE(EntryExists( - FilePath(FILE_PATH_LITERAL("drive/Dir1/SubDir2/File3")))); + base::FilePath(FILE_PATH_LITERAL("drive/Dir1/SubDir2/File3")))); } TEST_F(DriveFileSystemTest, CachedFeedLoadingThenServerFeedLoading) { SaveTestFileSystem(USE_SERVER_TIMESTAMP); // Kicks loading of cached file system and query for server update. - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/File1")))); + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/File1")))); // SaveTestFileSystem and "account_metadata.json" have the same changestamp, // so no request for new feeds (i.e., call to GetResourceList) should happen. @@ -1113,7 +1120,7 @@ TEST_F(DriveFileSystemTest, OfflineCachedFeedLoading) { fake_drive_service_->set_offline(true); // Kicks loading of cached file system and query for server update. - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/File1")))); + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/File1")))); // Loading of account metadata should not happen as it's offline. EXPECT_EQ(0, fake_drive_service_->account_metadata_load_count()); @@ -1139,17 +1146,17 @@ TEST_F(DriveFileSystemTest, TransferFileFromLocalToRemote_RegularFile) { // We'll add a file to the Drive root directory. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); // Prepare a local file. base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - const FilePath local_src_file_path = temp_dir.path().Append("local.txt"); + const base::FilePath local_src_file_path = temp_dir.path().Append("local.txt"); const std::string kContent = "hello"; file_util::WriteFile(local_src_file_path, kContent.data(), kContent.size()); // Confirm that the remote file does not exist. - const FilePath remote_dest_file_path(FILE_PATH_LITERAL("drive/remote.txt")); + const base::FilePath remote_dest_file_path(FILE_PATH_LITERAL("drive/remote.txt")); EXPECT_FALSE(EntryExists(remote_dest_file_path)); scoped_ptr<base::Value> value = @@ -1178,7 +1185,8 @@ TEST_F(DriveFileSystemTest, TransferFileFromLocalToRemote_HostedDocument) { // matches "Document 1" in root_feed.json. base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - const FilePath local_src_file_path = temp_dir.path().Append("local.gdoc"); + const base::FilePath local_src_file_path = + temp_dir.path().Append("local.gdoc"); const std::string kEditUrl = "https://3_document_self_link/document:5_document_resource_id"; const std::string kResourceId = "document:5_document_resource_id"; @@ -1188,15 +1196,15 @@ TEST_F(DriveFileSystemTest, TransferFileFromLocalToRemote_HostedDocument) { file_util::WriteFile(local_src_file_path, kContent.data(), kContent.size()); // Confirm that the remote file does not exist. - const FilePath remote_dest_file_path( + const base::FilePath remote_dest_file_path( FILE_PATH_LITERAL("drive/Directory 1/Document 1.gdoc")); EXPECT_FALSE(EntryExists(remote_dest_file_path)); // We'll add a file to the Drive root and then move to "Directory 1". EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); // We'll copy a hosted document using CopyHostedDocument. // ".gdoc" suffix should be stripped when copying. @@ -1226,16 +1234,17 @@ TEST_F(DriveFileSystemTest, TransferFileFromRemoteToLocal_RegularFile) { // The transfered file is cached and the change of "offline avaialble" // attribute is notified. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - FilePath local_dest_file_path = temp_dir.path().Append("local_copy.txt"); + base::FilePath local_dest_file_path = + temp_dir.path().Append("local_copy.txt"); - FilePath remote_src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath remote_src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> file = GetEntryInfoByPathSync( remote_src_file_path); - FilePath cache_file = GetCachePathForFile( + base::FilePath cache_file = GetCachePathForFile( file->resource_id(), file->file_specific_info().file_md5()); const int64 file_size = file->file_info().size(); @@ -1270,8 +1279,10 @@ TEST_F(DriveFileSystemTest, TransferFileFromRemoteToLocal_HostedDocument) { base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - FilePath local_dest_file_path = temp_dir.path().Append("local_copy.txt"); - FilePath remote_src_file_path(FILE_PATH_LITERAL("drive/Document 1.gdoc")); + base::FilePath local_dest_file_path = + temp_dir.path().Append("local_copy.txt"); + base::FilePath remote_src_file_path( + FILE_PATH_LITERAL("drive/Document 1.gdoc")); DriveFileError error = DRIVE_FILE_ERROR_FAILED; file_system_->TransferFileFromRemoteToLocal( remote_src_file_path, @@ -1288,8 +1299,8 @@ TEST_F(DriveFileSystemTest, TransferFileFromRemoteToLocal_HostedDocument) { } TEST_F(DriveFileSystemTest, CopyNotExistingFile) { - FilePath src_file_path(FILE_PATH_LITERAL("drive/Dummy file.txt")); - FilePath dest_file_path(FILE_PATH_LITERAL("drive/Test.log")); + base::FilePath src_file_path(FILE_PATH_LITERAL("drive/Dummy file.txt")); + base::FilePath dest_file_path(FILE_PATH_LITERAL("drive/Test.log")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); @@ -1308,9 +1319,9 @@ TEST_F(DriveFileSystemTest, CopyNotExistingFile) { } TEST_F(DriveFileSystemTest, CopyFileToNonExistingDirectory) { - FilePath src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); - FilePath dest_parent_path(FILE_PATH_LITERAL("drive/Dummy")); - FilePath dest_file_path(FILE_PATH_LITERAL("drive/Dummy/Test.log")); + base::FilePath src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath dest_parent_path(FILE_PATH_LITERAL("drive/Dummy")); + base::FilePath dest_file_path(FILE_PATH_LITERAL("drive/Dummy/Test.log")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); @@ -1341,9 +1352,10 @@ TEST_F(DriveFileSystemTest, CopyFileToNonExistingDirectory) { // Test the case where the parent of |dest_file_path| is an existing file, // not a directory. TEST_F(DriveFileSystemTest, CopyFileToInvalidPath) { - FilePath src_file_path(FILE_PATH_LITERAL("drive/Document 1.gdoc")); - FilePath dest_parent_path(FILE_PATH_LITERAL("drive/Duplicate Name.txt")); - FilePath dest_file_path(FILE_PATH_LITERAL( + base::FilePath src_file_path(FILE_PATH_LITERAL("drive/Document 1.gdoc")); + base::FilePath dest_parent_path( + FILE_PATH_LITERAL("drive/Duplicate Name.txt")); + base::FilePath dest_file_path(FILE_PATH_LITERAL( "drive/Duplicate Name.txt/Document 1.gdoc")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); @@ -1377,10 +1389,10 @@ TEST_F(DriveFileSystemTest, CopyFileToInvalidPath) { } TEST_F(DriveFileSystemTest, RenameFile) { - const FilePath src_file_path( + const base::FilePath src_file_path( FILE_PATH_LITERAL("drive/Directory 1/SubDirectory File 1.txt")); - const FilePath src_parent_path(FILE_PATH_LITERAL("drive/Directory 1")); - const FilePath dest_file_path( + const base::FilePath src_parent_path(FILE_PATH_LITERAL("drive/Directory 1")); + const base::FilePath dest_file_path( FILE_PATH_LITERAL("drive/Directory 1/Test.log")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); @@ -1393,7 +1405,7 @@ TEST_F(DriveFileSystemTest, RenameFile) { src_entry_proto->resource_id(); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); DriveFileError error = DRIVE_FILE_ERROR_FAILED; file_system_->Move( @@ -1409,9 +1421,10 @@ TEST_F(DriveFileSystemTest, RenameFile) { } TEST_F(DriveFileSystemTest, MoveFileFromRootToSubDirectory) { - FilePath src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); - FilePath dest_parent_path(FILE_PATH_LITERAL("drive/Directory 1")); - FilePath dest_file_path(FILE_PATH_LITERAL("drive/Directory 1/Test.log")); + base::FilePath src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath dest_parent_path(FILE_PATH_LITERAL("drive/Directory 1")); + base::FilePath dest_file_path( + FILE_PATH_LITERAL("drive/Directory 1/Test.log")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); @@ -1432,9 +1445,9 @@ TEST_F(DriveFileSystemTest, MoveFileFromRootToSubDirectory) { // Expect notification for both source and destination directories. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(2); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(2); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); DriveFileError error = DRIVE_FILE_ERROR_FAILED; file_system_->Move( @@ -1450,10 +1463,10 @@ TEST_F(DriveFileSystemTest, MoveFileFromRootToSubDirectory) { } TEST_F(DriveFileSystemTest, MoveFileFromSubDirectoryToRoot) { - FilePath src_parent_path(FILE_PATH_LITERAL("drive/Directory 1")); - FilePath src_file_path( + base::FilePath src_parent_path(FILE_PATH_LITERAL("drive/Directory 1")); + base::FilePath src_file_path( FILE_PATH_LITERAL("drive/Directory 1/SubDirectory File 1.txt")); - FilePath dest_file_path(FILE_PATH_LITERAL("drive/Test.log")); + base::FilePath dest_file_path(FILE_PATH_LITERAL("drive/Test.log")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); @@ -1474,9 +1487,9 @@ TEST_F(DriveFileSystemTest, MoveFileFromSubDirectoryToRoot) { // Expect notification for both source and destination directories. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(2); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(2); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); DriveFileError error = DRIVE_FILE_ERROR_FAILED; file_system_->Move( @@ -1492,17 +1505,18 @@ TEST_F(DriveFileSystemTest, MoveFileFromSubDirectoryToRoot) { } TEST_F(DriveFileSystemTest, MoveFileBetweenSubDirectories) { - FilePath src_parent_path(FILE_PATH_LITERAL("drive/Directory 1")); - FilePath src_file_path( + base::FilePath src_parent_path(FILE_PATH_LITERAL("drive/Directory 1")); + base::FilePath src_file_path( FILE_PATH_LITERAL("drive/Directory 1/SubDirectory File 1.txt")); - FilePath dest_parent_path(FILE_PATH_LITERAL("drive/New Folder 1")); - FilePath dest_file_path(FILE_PATH_LITERAL("drive/New Folder 1/Test.log")); - FilePath interim_file_path(FILE_PATH_LITERAL("drive/Test.log")); + base::FilePath dest_parent_path(FILE_PATH_LITERAL("drive/New Folder 1")); + base::FilePath dest_file_path( + FILE_PATH_LITERAL("drive/New Folder 1/Test.log")); + base::FilePath interim_file_path(FILE_PATH_LITERAL("drive/Test.log")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); AddDirectoryFromFile(dest_parent_path, "gdata/directory_entry_atom.json"); @@ -1533,11 +1547,11 @@ TEST_F(DriveFileSystemTest, MoveFileBetweenSubDirectories) { // Expect notification for both source and destination directories plus // interim file path. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/New Folder 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/New Folder 1"))))).Times(1); DriveFileError error = DRIVE_FILE_ERROR_FAILED; file_system_->Move( @@ -1556,8 +1570,8 @@ TEST_F(DriveFileSystemTest, MoveFileBetweenSubDirectories) { } TEST_F(DriveFileSystemTest, MoveNotExistingFile) { - FilePath src_file_path(FILE_PATH_LITERAL("drive/Dummy file.txt")); - FilePath dest_file_path(FILE_PATH_LITERAL("drive/Test.log")); + base::FilePath src_file_path(FILE_PATH_LITERAL("drive/Dummy file.txt")); + base::FilePath dest_file_path(FILE_PATH_LITERAL("drive/Test.log")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); @@ -1576,9 +1590,9 @@ TEST_F(DriveFileSystemTest, MoveNotExistingFile) { } TEST_F(DriveFileSystemTest, MoveFileToNonExistingDirectory) { - FilePath src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); - FilePath dest_parent_path(FILE_PATH_LITERAL("drive/Dummy")); - FilePath dest_file_path(FILE_PATH_LITERAL("drive/Dummy/Test.log")); + base::FilePath src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath dest_parent_path(FILE_PATH_LITERAL("drive/Dummy")); + base::FilePath dest_file_path(FILE_PATH_LITERAL("drive/Dummy/Test.log")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); @@ -1607,9 +1621,10 @@ TEST_F(DriveFileSystemTest, MoveFileToNonExistingDirectory) { // Test the case where the parent of |dest_file_path| is a existing file, // not a directory. TEST_F(DriveFileSystemTest, MoveFileToInvalidPath) { - FilePath src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); - FilePath dest_parent_path(FILE_PATH_LITERAL("drive/Duplicate Name.txt")); - FilePath dest_file_path(FILE_PATH_LITERAL( + base::FilePath src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath dest_parent_path( + FILE_PATH_LITERAL("drive/Duplicate Name.txt")); + base::FilePath dest_file_path(FILE_PATH_LITERAL( "drive/Duplicate Name.txt/Test.log")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); @@ -1643,10 +1658,10 @@ TEST_F(DriveFileSystemTest, MoveFileToInvalidPath) { TEST_F(DriveFileSystemTest, RemoveEntries) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - FilePath nonexisting_file(FILE_PATH_LITERAL("drive/Dummy file.txt")); - FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); - FilePath dir_in_root(FILE_PATH_LITERAL("drive/Directory 1")); - FilePath file_in_subdir( + base::FilePath nonexisting_file(FILE_PATH_LITERAL("drive/Dummy file.txt")); + base::FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath dir_in_root(FILE_PATH_LITERAL("drive/Directory 1")); + base::FilePath file_in_subdir( FILE_PATH_LITERAL("drive/Directory 1/SubDirectory File 1.txt")); ASSERT_TRUE(EntryExists(file_in_root)); @@ -1667,7 +1682,7 @@ TEST_F(DriveFileSystemTest, RemoveEntries) { // Once for file in root and once for file... EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(2); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(2); // Remove first file in root. EXPECT_TRUE(RemoveEntry(file_in_root)); @@ -1688,7 +1703,7 @@ TEST_F(DriveFileSystemTest, RemoveEntries) { EXPECT_FALSE(RemoveEntry(nonexisting_file)); // Try removing root file element. - EXPECT_FALSE(RemoveEntry(FilePath(FILE_PATH_LITERAL("drive")))); + EXPECT_FALSE(RemoveEntry(base::FilePath(FILE_PATH_LITERAL("drive")))); // Need this to ensure OnDirectoryChanged() is run. google_apis::test_util::RunBlockingPoolTask(); @@ -1698,19 +1713,19 @@ TEST_F(DriveFileSystemTest, CreateDirectory) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); // Create directory in root. - FilePath dir_path(FILE_PATH_LITERAL("drive/New Folder 1")); + base::FilePath dir_path(FILE_PATH_LITERAL("drive/New Folder 1")); EXPECT_FALSE(EntryExists(dir_path)); AddDirectoryFromFile(dir_path, "gdata/directory_entry_atom.json"); EXPECT_TRUE(EntryExists(dir_path)); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/New Folder 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/New Folder 1"))))).Times(1); // Create directory in a sub directory. - FilePath subdir_path(FILE_PATH_LITERAL("drive/New Folder 1/New Folder 2")); + base::FilePath subdir_path(FILE_PATH_LITERAL("drive/New Folder 1/New Folder 2")); EXPECT_FALSE(EntryExists(subdir_path)); AddDirectoryFromFile(subdir_path, "gdata/directory_entry_atom2.json"); EXPECT_TRUE(EntryExists(subdir_path)); @@ -1720,11 +1735,11 @@ TEST_F(DriveFileSystemTest, CreateDirectory) { TEST_F(DriveFileSystemTest, CreateDirectoryWithService) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); DriveFileError error = DRIVE_FILE_ERROR_FAILED; file_system_->CreateDirectory( - FilePath(FILE_PATH_LITERAL("drive/Sample Directory Title")), + base::FilePath(FILE_PATH_LITERAL("drive/Sample Directory Title")), false, // is_exclusive true, // is_recursive base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); @@ -1739,11 +1754,11 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpace) { // The transfered file is cached and the change of "offline avaialble" // attribute is notified. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); - FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(file_in_root)); - FilePath downloaded_file = GetCachePathForFile( + base::FilePath downloaded_file = GetCachePathForFile( entry_proto->resource_id(), entry_proto->file_specific_info().file_md5()); const int64 file_size = entry_proto->file_info().size(); @@ -1753,7 +1768,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpace) { file_size + kMinFreeSpace); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath file_path; + base::FilePath file_path; DriveFileType file_type; file_system_->GetFileByPath( file_in_root, @@ -1769,9 +1784,9 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpace) { TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoSpaceAtAll) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(file_in_root)); - FilePath downloaded_file = GetCachePathForFile( + base::FilePath downloaded_file = GetCachePathForFile( entry_proto->resource_id(), entry_proto->file_specific_info().file_md5()); @@ -1779,7 +1794,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoSpaceAtAll) { fake_free_disk_space_getter_->set_fake_free_disk_space(0); DriveFileError error = DRIVE_FILE_OK; - FilePath file_path; + base::FilePath file_path; DriveFileType file_type; file_system_->GetFileByPath( file_in_root, @@ -1796,11 +1811,11 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) { // The transfered file is cached and the change of "offline avaialble" // attribute is notified. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); - FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(file_in_root)); - FilePath downloaded_file = GetCachePathForFile( + base::FilePath downloaded_file = GetCachePathForFile( entry_proto->resource_id(), entry_proto->file_specific_info().file_md5()); const int64 file_size = entry_proto->file_info().size(); @@ -1820,7 +1835,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) { const std::string content(file_size, 'x'); base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - const FilePath tmp_file = + const base::FilePath tmp_file = temp_dir.path().AppendASCII("something.txt"); ASSERT_EQ(file_size, file_util::WriteFile(tmp_file, content.data(), content.size())); @@ -1835,7 +1850,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) { ASSERT_TRUE(CacheFileExists("<resource_id>", "<md5>")); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath file_path; + base::FilePath file_path; DriveFileType file_type; file_system_->GetFileByPath( file_in_root, @@ -1856,9 +1871,9 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) { TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpaceButBecomeFull) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(file_in_root)); - FilePath downloaded_file = GetCachePathForFile( + base::FilePath downloaded_file = GetCachePathForFile( entry_proto->resource_id(), entry_proto->file_specific_info().file_md5()); const int64 file_size = entry_proto->file_info().size(); @@ -1873,7 +1888,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpaceButBecomeFull) { fake_free_disk_space_getter_->set_fake_free_disk_space(kMinFreeSpace - 1); DriveFileError error = DRIVE_FILE_OK; - FilePath file_path; + base::FilePath file_path; DriveFileType file_type; file_system_->GetFileByPath( file_in_root, @@ -1889,9 +1904,9 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromCache) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(file_in_root)); - FilePath downloaded_file = GetCachePathForFile( + base::FilePath downloaded_file = GetCachePathForFile( entry_proto->resource_id(), entry_proto->file_specific_info().file_md5()); @@ -1905,7 +1920,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromCache) { DriveCache::CACHE_TYPE_TMP); DriveFileError error = DRIVE_FILE_OK; - FilePath file_path; + base::FilePath file_path; DriveFileType file_type; file_system_->GetFileByPath( file_in_root, @@ -1920,13 +1935,13 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromCache) { TEST_F(DriveFileSystemTest, GetFileByPath_HostedDocument) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - FilePath file_in_root(FILE_PATH_LITERAL("drive/Document 1.gdoc")); + base::FilePath file_in_root(FILE_PATH_LITERAL("drive/Document 1.gdoc")); scoped_ptr<DriveEntryProto> src_entry_proto = GetEntryInfoByPathSync(file_in_root); ASSERT_TRUE(src_entry_proto.get()); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath file_path; + base::FilePath file_path; DriveFileType file_type; file_system_->GetFileByPath( file_in_root, @@ -1947,18 +1962,18 @@ TEST_F(DriveFileSystemTest, GetFileByResourceId) { // The transfered file is cached and the change of "offline avaialble" // attribute is notified. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(file_in_root)); - FilePath downloaded_file = GetCachePathForFile( + base::FilePath downloaded_file = GetCachePathForFile( entry_proto->resource_id(), entry_proto->file_specific_info().file_md5()); DriveFileError error = DRIVE_FILE_OK; - FilePath file_path; + base::FilePath file_path; DriveFileType file_type; file_system_->GetFileByResourceId( entry_proto->resource_id(), @@ -1976,9 +1991,9 @@ TEST_F(DriveFileSystemTest, GetFileByResourceId_FromCache) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(file_in_root)); - FilePath downloaded_file = GetCachePathForFile( + base::FilePath downloaded_file = GetCachePathForFile( entry_proto->resource_id(), entry_proto->file_specific_info().file_md5()); @@ -1996,7 +2011,7 @@ TEST_F(DriveFileSystemTest, GetFileByResourceId_FromCache) { fake_drive_service_->set_offline(true); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath file_path; + base::FilePath file_path; DriveFileType file_type; file_system_->GetFileByResourceId( entry_proto->resource_id(), @@ -2015,7 +2030,7 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); // This is a file defined in root_feed.json. - const FilePath kFilePath(FILE_PATH_LITERAL("drive/File 1.txt")); + const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/File 1.txt")); const std::string kResourceId("file:2_file_resource_id"); const std::string kMd5("3b4382ebefec6e743578c76bbd0575ce"); @@ -2029,7 +2044,7 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { // First store a file to cache. A cache file will be created at: // GCache/v1/persistent/<kResourceId>.<kMd5> - const FilePath original_cache_file_path = + const base::FilePath original_cache_file_path = DriveCache::GetCacheRootPath(profile_.get()) .AppendASCII("persistent") .AppendASCII(kResourceId + "." + kMd5); @@ -2055,7 +2070,7 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PERSISTENT, DriveCache::CACHE_TYPE_PERSISTENT); - const FilePath dirty_cache_file_path = + const base::FilePath dirty_cache_file_path = DriveCache::GetCacheRootPath(profile_.get()) .AppendASCII("persistent") .AppendASCII(kResourceId + ".local"); @@ -2080,7 +2095,7 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PERSISTENT, DriveCache::CACHE_TYPE_PERSISTENT); - const FilePath outgoing_symlink_path = + const base::FilePath outgoing_symlink_path = DriveCache::GetCacheRootPath(profile_.get()) .AppendASCII("outgoing") .AppendASCII(kResourceId); @@ -2089,12 +2104,12 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { // We'll notify the directory change to the observer upon completion. EXPECT_CALL(*mock_directory_observer_, - OnDirectoryChanged(Eq(FilePath(kDriveRootDirectory)))).Times(1); + OnDirectoryChanged(Eq(base::FilePath(kDriveRootDirectory)))).Times(1); // Check the number of files in the root directory. We'll compare the // number after updating a file. scoped_ptr<DriveEntryProtoVector> root_directory_entries( - ReadDirectoryByPathSync(FilePath::FromUTF8Unsafe("drive"))); + ReadDirectoryByPathSync(base::FilePath::FromUTF8Unsafe("drive"))); ASSERT_TRUE(root_directory_entries.get()); const int num_files_in_root = CountFiles(*root_directory_entries); @@ -2120,7 +2135,7 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_NonexistentFile) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); // This is nonexistent in root_feed.json. - const FilePath kFilePath(FILE_PATH_LITERAL("drive/Nonexistent.txt")); + const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/Nonexistent.txt")); const std::string kResourceId("file:nonexistent_resource_id"); const std::string kMd5("nonexistent_md5"); @@ -2224,9 +2239,10 @@ TEST_F(DriveFileSystemTest, RequestDirectoryRefresh) { // We'll notify the directory change to the observer. EXPECT_CALL(*mock_directory_observer_, - OnDirectoryChanged(Eq(FilePath(kDriveRootDirectory)))).Times(1); + OnDirectoryChanged(Eq( + base::FilePath(kDriveRootDirectory)))).Times(1); - file_system_->RequestDirectoryRefresh(FilePath(kDriveRootDirectory)); + file_system_->RequestDirectoryRefresh(base::FilePath(kDriveRootDirectory)); google_apis::test_util::RunBlockingPoolTask(); } @@ -2236,11 +2252,11 @@ TEST_F(DriveFileSystemTest, OpenAndCloseFile) { // The transfered file is cached and the change of "offline avaialble" // attribute is notified. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); - const FilePath kFileInRoot(FILE_PATH_LITERAL("drive/File 1.txt")); + const base::FilePath kFileInRoot(FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(kFileInRoot)); - FilePath downloaded_file = GetCachePathForFile( + base::FilePath downloaded_file = GetCachePathForFile( entry_proto->resource_id(), entry_proto->file_specific_info().file_md5()); const int64 file_size = entry_proto->file_info().size(); @@ -2258,13 +2274,13 @@ TEST_F(DriveFileSystemTest, OpenAndCloseFile) { // Open kFileInRoot ("drive/File 1.txt"). DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath file_path; + base::FilePath file_path; file_system_->OpenFile( kFileInRoot, base::Bind(&test_util::CopyResultsFromOpenFileCallbackAndQuit, &error, &file_path)); message_loop_.Run(); - const FilePath opened_file_path = file_path; + const base::FilePath opened_file_path = file_path; // Verify that the file was properly opened. EXPECT_EQ(DRIVE_FILE_OK, error); @@ -2326,7 +2342,7 @@ TEST_F(DriveFileSystemTest, WebAppsRegistryIsLoaded) { // No apps should be found as the webapps registry is empty. ScopedVector<DriveWebAppInfo> apps; drive_webapps_registry_->GetWebAppsForFile( - FilePath::FromUTF8Unsafe("foo.ext_1"), + base::FilePath::FromUTF8Unsafe("foo.ext_1"), "" /* mime_type */, &apps); EXPECT_TRUE(apps.empty()); @@ -2334,11 +2350,11 @@ TEST_F(DriveFileSystemTest, WebAppsRegistryIsLoaded) { // Kicks loading of cached file system and query for server update. This // will cause GetAccountMetadata() to be called, to check the server-side // changestamp, and the webapps registry will be loaded at the same time. - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/File1")))); + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/File1")))); // An app for foo.ext_1 should now be found, as the registry was loaded. drive_webapps_registry_->GetWebAppsForFile( - FilePath(FILE_PATH_LITERAL("foo.ext_1")), + base::FilePath(FILE_PATH_LITERAL("foo.ext_1")), "" /* mime_type */, &apps); EXPECT_EQ(1U, apps.size()); diff --git a/chrome/browser/chromeos/drive/drive_file_system_util.cc b/chrome/browser/chromeos/drive/drive_file_system_util.cc index 94f492b..80f798a 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_util.cc +++ b/chrome/browser/chromeos/drive/drive_file_system_util.cc @@ -45,7 +45,7 @@ const char kDriveSpecialRootPath[] = "/special"; const char kDriveMountPointPath[] = "/special/drive"; -const FilePath::CharType* kDriveMountPointPathComponents[] = { +const base::FilePath::CharType* kDriveMountPointPathComponents[] = { "/", "special", "drive" }; @@ -75,7 +75,8 @@ FileWriteHelper* GetFileWriteHelper(Profile* profile) { return system_service ? system_service->file_write_helper() : NULL; } -GURL GetHostedDocumentURLBlockingThread(const FilePath& drive_cache_path) { +GURL GetHostedDocumentURLBlockingThread( + const base::FilePath& drive_cache_path) { std::string json; if (!file_util::ReadFileToString(drive_cache_path, &json)) { NOTREACHED() << "Unable to read file " << drive_cache_path.value(); @@ -112,7 +113,7 @@ void OpenEditURLUIThread(Profile* profile, const GURL& edit_url) { void OnGetEntryInfoByResourceId(Profile* profile, const std::string& resource_id, DriveFileError error, - const FilePath& /* drive_file_path */, + const base::FilePath& /* drive_file_path */, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -128,9 +129,9 @@ void OnGetEntryInfoByResourceId(Profile* profile, } // namespace -const FilePath& GetDriveMountPointPath() { - CR_DEFINE_STATIC_LOCAL(FilePath, drive_mount_path, - (FilePath::FromUTF8Unsafe(kDriveMountPointPath))); +const base::FilePath& GetDriveMountPointPath() { + CR_DEFINE_STATIC_LOCAL(base::FilePath, drive_mount_path, + (base::FilePath::FromUTF8Unsafe(kDriveMountPointPath))); return drive_mount_path; } @@ -140,9 +141,9 @@ const std::string& GetDriveMountPointPathAsString() { return drive_mount_path_string; } -const FilePath& GetSpecialRemoteRootPath() { - CR_DEFINE_STATIC_LOCAL(FilePath, drive_mount_path, - (FilePath::FromUTF8Unsafe(kDriveSpecialRootPath))); +const base::FilePath& GetSpecialRemoteRootPath() { + CR_DEFINE_STATIC_LOCAL(base::FilePath, drive_mount_path, + (base::FilePath::FromUTF8Unsafe(kDriveSpecialRootPath))); return drive_mount_path; } @@ -156,7 +157,7 @@ GURL GetFileResourceUrl(const std::string& resource_id, } void ModifyDriveFileResourceUrl(Profile* profile, - const FilePath& drive_cache_path, + const base::FilePath& drive_cache_path, GURL* url) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -193,20 +194,20 @@ void ModifyDriveFileResourceUrl(Profile* profile, } } -bool IsUnderDriveMountPoint(const FilePath& path) { +bool IsUnderDriveMountPoint(const base::FilePath& path) { return GetDriveMountPointPath() == path || GetDriveMountPointPath().IsParent(path); } -FilePath ExtractDrivePath(const FilePath& path) { +base::FilePath ExtractDrivePath(const base::FilePath& path) { if (!IsUnderDriveMountPoint(path)) - return FilePath(); + return base::FilePath(); - std::vector<FilePath::StringType> components; + std::vector<base::FilePath::StringType> components; path.GetComponents(&components); // -1 to include 'drive'. - FilePath extracted; + base::FilePath extracted; for (size_t i = arraysize(kDriveMountPointPathComponents) - 1; i < components.size(); ++i) { extracted = extracted.Append(components[i]); @@ -255,7 +256,7 @@ std::string ExtractResourceIdFromUrl(const GURL& url) { net::UnescapeRule::URL_SPECIAL_CHARS); } -void ParseCacheFilePath(const FilePath& path, +void ParseCacheFilePath(const base::FilePath& path, std::string* resource_id, std::string* md5, std::string* extra_extension) { @@ -264,13 +265,13 @@ void ParseCacheFilePath(const FilePath& path, DCHECK(extra_extension); // Extract up to two extensions from the right. - FilePath base_name = path.BaseName(); + base::FilePath base_name = path.BaseName(); const int kNumExtensionsToExtract = 2; - std::vector<FilePath::StringType> extensions; + std::vector<base::FilePath::StringType> extensions; for (int i = 0; i < kNumExtensionsToExtract; ++i) { - FilePath::StringType extension = base_name.Extension(); + base::FilePath::StringType extension = base_name.Extension(); if (!extension.empty()) { - // FilePath::Extension returns ".", so strip it. + // base::FilePath::Extension returns ".", so strip it. extension = UnescapeCacheFileName(extension.substr(1)); base_name = base_name.RemoveExtension(); extensions.push_back(extension); @@ -291,7 +292,7 @@ void ParseCacheFilePath(const FilePath& path, } void PrepareWritableFileAndRun(Profile* profile, - const FilePath& path, + const base::FilePath& path, const OpenFileCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -299,7 +300,7 @@ void PrepareWritableFileAndRun(Profile* profile, FileWriteHelper* file_write_helper = GetFileWriteHelper(profile); if (!file_write_helper) return; - FilePath remote_path(ExtractDrivePath(path)); + base::FilePath remote_path(ExtractDrivePath(path)); file_write_helper->PrepareWritableFileAndRun(remote_path, callback); } else { content::BrowserThread::GetBlockingPool()->PostTask( @@ -308,7 +309,7 @@ void PrepareWritableFileAndRun(Profile* profile, } void EnsureDirectoryExists(Profile* profile, - const FilePath& directory, + const base::FilePath& directory, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || BrowserThread::CurrentlyOn(BrowserThread::IO)); diff --git a/chrome/browser/chromeos/drive/drive_file_system_util_unittest.cc b/chrome/browser/chromeos/drive/drive_file_system_util_unittest.cc index 73baf0e..4c90b24 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_util_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_file_system_util_unittest.cc @@ -12,42 +12,42 @@ namespace util { TEST(DriveFileSystemUtilTest, IsUnderDriveMountPoint) { EXPECT_FALSE(IsUnderDriveMountPoint( - FilePath::FromUTF8Unsafe("/wherever/foo.txt"))); + base::FilePath::FromUTF8Unsafe("/wherever/foo.txt"))); EXPECT_FALSE(IsUnderDriveMountPoint( - FilePath::FromUTF8Unsafe("/special/foo.txt"))); + base::FilePath::FromUTF8Unsafe("/special/foo.txt"))); EXPECT_FALSE(IsUnderDriveMountPoint( - FilePath::FromUTF8Unsafe("/special/drivex/foo.txt"))); + base::FilePath::FromUTF8Unsafe("/special/drivex/foo.txt"))); EXPECT_FALSE(IsUnderDriveMountPoint( - FilePath::FromUTF8Unsafe("special/drivex/foo.txt"))); + base::FilePath::FromUTF8Unsafe("special/drivex/foo.txt"))); EXPECT_TRUE(IsUnderDriveMountPoint( - FilePath::FromUTF8Unsafe("/special/drive"))); + base::FilePath::FromUTF8Unsafe("/special/drive"))); EXPECT_TRUE(IsUnderDriveMountPoint( - FilePath::FromUTF8Unsafe("/special/drive/foo.txt"))); + base::FilePath::FromUTF8Unsafe("/special/drive/foo.txt"))); EXPECT_TRUE(IsUnderDriveMountPoint( - FilePath::FromUTF8Unsafe("/special/drive/subdir/foo.txt"))); + base::FilePath::FromUTF8Unsafe("/special/drive/subdir/foo.txt"))); } TEST(DriveFileSystemUtilTest, ExtractDrivePath) { - EXPECT_EQ(FilePath(), + EXPECT_EQ(base::FilePath(), ExtractDrivePath( - FilePath::FromUTF8Unsafe("/wherever/foo.txt"))); - EXPECT_EQ(FilePath(), + base::FilePath::FromUTF8Unsafe("/wherever/foo.txt"))); + EXPECT_EQ(base::FilePath(), ExtractDrivePath( - FilePath::FromUTF8Unsafe("/special/foo.txt"))); - EXPECT_EQ(FilePath(), + base::FilePath::FromUTF8Unsafe("/special/foo.txt"))); + EXPECT_EQ(base::FilePath(), ExtractDrivePath( - FilePath::FromUTF8Unsafe("/special/drivex/foo.txt"))); + base::FilePath::FromUTF8Unsafe("/special/drivex/foo.txt"))); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive"), ExtractDrivePath( - FilePath::FromUTF8Unsafe("/special/drive"))); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/foo.txt"), + base::FilePath::FromUTF8Unsafe("/special/drive"))); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/foo.txt"), ExtractDrivePath( - FilePath::FromUTF8Unsafe("/special/drive/foo.txt"))); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/subdir/foo.txt"), - ExtractDrivePath( - FilePath::FromUTF8Unsafe("/special/drive/subdir/foo.txt"))); + 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"))); } TEST(DriveFileSystemUtilTest, EscapeUnescapeCacheFileName) { @@ -80,7 +80,7 @@ TEST(DriveFileSystemUtilTest, ExtractResourceIdFromUrl) { TEST(DriveFileSystemUtilTest, ParseCacheFilePath) { std::string resource_id, md5, extra_extension; ParseCacheFilePath( - FilePath::FromUTF8Unsafe( + base::FilePath::FromUTF8Unsafe( "/home/user/GCache/v1/persistent/pdf:a1b2.0123456789abcdef.mounted"), &resource_id, &md5, @@ -90,7 +90,7 @@ TEST(DriveFileSystemUtilTest, ParseCacheFilePath) { EXPECT_EQ(extra_extension, "mounted"); ParseCacheFilePath( - FilePath::FromUTF8Unsafe( + base::FilePath::FromUTF8Unsafe( "/home/user/GCache/v1/tmp/pdf:a1b2.0123456789abcdef"), &resource_id, &md5, @@ -100,7 +100,7 @@ TEST(DriveFileSystemUtilTest, ParseCacheFilePath) { EXPECT_EQ(extra_extension, ""); ParseCacheFilePath( - FilePath::FromUTF8Unsafe( + base::FilePath::FromUTF8Unsafe( "/home/user/GCache/v1/pinned/pdf:a1b2"), &resource_id, &md5, diff --git a/chrome/browser/chromeos/drive/drive_files.cc b/chrome/browser/chromeos/drive/drive_files.cc index 4dcc037..c8230ab 100644 --- a/chrome/browser/chromeos/drive/drive_files.cc +++ b/chrome/browser/chromeos/drive/drive_files.cc @@ -46,8 +46,8 @@ const DriveDirectory* DriveEntry::AsDriveDirectoryConst() const { return const_cast<DriveEntry*>(this)->AsDriveDirectory(); } -FilePath DriveEntry::GetFilePath() const { - FilePath path; +base::FilePath DriveEntry::GetFilePath() const { + base::FilePath path; if (parent()) path = parent()->GetFilePath(); path = path.Append(base_name()); @@ -120,17 +120,17 @@ void DriveDirectory::AddEntry(DriveEntry* entry) { // Do file name de-duplication - find files with the same name and // append a name modifier to the name. int max_modifier = 1; - FilePath full_file_name(entry->base_name()); + base::FilePath full_file_name(entry->base_name()); const std::string extension = full_file_name.Extension(); const std::string file_name = full_file_name.RemoveExtension().value(); while (!FindChild(full_file_name.value()).empty()) { if (!extension.empty()) { - full_file_name = FilePath(base::StringPrintf("%s (%d)%s", + full_file_name = base::FilePath(base::StringPrintf("%s (%d)%s", file_name.c_str(), ++max_modifier, extension.c_str())); } else { - full_file_name = FilePath(base::StringPrintf("%s (%d)", + full_file_name = base::FilePath(base::StringPrintf("%s (%d)", file_name.c_str(), ++max_modifier)); } @@ -183,7 +183,7 @@ void DriveDirectory::RemoveEntry(DriveEntry* entry) { } std::string DriveDirectory::FindChild( - const FilePath::StringType& file_name) const { + const base::FilePath::StringType& file_name) const { ChildMap::const_iterator iter = child_files_.find(file_name); if (iter != child_files_.end()) return iter->second; @@ -242,7 +242,8 @@ void DriveDirectory::RemoveChildDirectories() { child_directories_.clear(); } -void DriveDirectory::GetChildDirectoryPaths(std::set<FilePath>* child_dirs) { +void DriveDirectory::GetChildDirectoryPaths( + std::set<base::FilePath>* child_dirs) { for (ChildMap::const_iterator iter = child_directories_.begin(); iter != child_directories_.end(); ++iter) { DriveDirectory* dir = resource_metadata_->GetEntryByResourceId( diff --git a/chrome/browser/chromeos/drive/drive_files.h b/chrome/browser/chromeos/drive/drive_files.h index 241df6d..9c3b750 100644 --- a/chrome/browser/chromeos/drive/drive_files.h +++ b/chrome/browser/chromeos/drive/drive_files.h @@ -62,12 +62,14 @@ class DriveEntry { // This is not the full path, use GetFilePath for that. // Note that base_name_ gets reset by SetBaseNameFromTitle() in a number of // situations due to de-duplication (see AddEntry). - const FilePath::StringType& base_name() const { return base_name_; } + const base::FilePath::StringType& base_name() const { return base_name_; } // TODO(achuith): Make this private when GDataDB no longer uses path as a key. - void set_base_name(const FilePath::StringType& name) { base_name_ = name; } + void set_base_name(const base::FilePath::StringType& name) { + base_name_ = name; + } - const FilePath::StringType& title() const { return title_; } - void set_title(const FilePath::StringType& title) { title_ = title; } + const base::FilePath::StringType& title() const { return title_; } + void set_title(const base::FilePath::StringType& title) { title_ = title; } // The unique resource ID associated with this file system entry. const std::string& resource_id() const { return resource_id_; } @@ -96,7 +98,7 @@ class DriveEntry { // Returns virtual file path representing this file system entry. This path // corresponds to file path expected by public methods of DriveFileSystem // class. - FilePath GetFilePath() const; + base::FilePath GetFilePath() const; // Sets |base_name_| based on the value of |title_| without name // de-duplication (see AddEntry() for details on de-duplication). @@ -118,7 +120,7 @@ class DriveEntry { // |base_name_| but may be different from |base_name_|. For example, // |base_name_| has an added .g<something> extension for hosted documents or // may have an extra suffix for name de-duplication on the drive file system. - FilePath::StringType title_; + base::FilePath::StringType title_; std::string resource_id_; std::string parent_resource_id_; // Files with the same title will be uniquely identified with this field @@ -133,7 +135,7 @@ class DriveEntry { // Name of this file in the drive virtual file system. This can change // due to de-duplication (See AddEntry). - FilePath::StringType base_name_; + base::FilePath::StringType base_name_; DriveDirectory* parent_; // Weak pointer to DriveResourceMetadata. @@ -231,7 +233,7 @@ class DriveDirectory : public DriveEntry { // Find a child's resource_id by its name. Returns the empty string if not // found. TODO(satorux): Remove this. crbug.com/139649 - std::string FindChild(const FilePath::StringType& file_name) const; + std::string FindChild(const base::FilePath::StringType& file_name) const; // Removes the entry from its children without destroying the // entry instance. @@ -243,10 +245,10 @@ class DriveDirectory : public DriveEntry { void RemoveChildDirectories(); // Recursively extracts the paths set of all sub-directories. - void GetChildDirectoryPaths(std::set<FilePath>* child_dirs); + void GetChildDirectoryPaths(std::set<base::FilePath>* child_dirs); // Map between base_name and resource_id of files and directories. - typedef std::map<FilePath::StringType, std::string> ChildMap; + typedef std::map<base::FilePath::StringType, std::string> ChildMap; // Collection of children. ChildMap child_files_; ChildMap child_directories_; diff --git a/chrome/browser/chromeos/drive/drive_prefetcher.cc b/chrome/browser/chromeos/drive/drive_prefetcher.cc index a977c80..917b2d5 100644 --- a/chrome/browser/chromeos/drive/drive_prefetcher.cc +++ b/chrome/browser/chromeos/drive/drive_prefetcher.cc @@ -87,7 +87,7 @@ void DrivePrefetcher::OnInitialLoadFinished(DriveFileError error) { DoFullScan(); } -void DrivePrefetcher::OnDirectoryChanged(const FilePath& directory_path) { +void DrivePrefetcher::OnDirectoryChanged(const base::FilePath& directory_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kinaba): crbug.com/156270. @@ -110,7 +110,7 @@ void DrivePrefetcher::OnSyncClientIdle() { void DrivePrefetcher::DoFullScan() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - FilePath root(util::ExtractDrivePath(util::GetDriveMountPointPath())); + base::FilePath root(util::ExtractDrivePath(util::GetDriveMountPointPath())); VisitDirectory(root); } @@ -138,7 +138,7 @@ void DrivePrefetcher::DoPrefetch() { void DrivePrefetcher::OnPrefetchFinished(const std::string& resource_id, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, const std::string& mime_type, DriveFileType file_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -177,7 +177,7 @@ void DrivePrefetcher::VisitFile(const DriveEntryProto& entry) { latest_files_.erase(latest_files_.begin()); } -void DrivePrefetcher::VisitDirectory(const FilePath& directory_path) { +void DrivePrefetcher::VisitDirectory(const base::FilePath& directory_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); ++number_of_inflight_traversals_; @@ -189,7 +189,7 @@ void DrivePrefetcher::VisitDirectory(const FilePath& directory_path) { } void DrivePrefetcher::OnReadDirectory( - const FilePath& directory_path, + const base::FilePath& directory_path, DriveFileError error, bool hide_hosted_documents, scoped_ptr<DriveEntryProtoVector> entries) { diff --git a/chrome/browser/chromeos/drive/drive_prefetcher_unittest.cc b/chrome/browser/chromeos/drive/drive_prefetcher_unittest.cc index 7430f69..80e8f14 100644 --- a/chrome/browser/chromeos/drive/drive_prefetcher_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_prefetcher_unittest.cc @@ -35,7 +35,7 @@ enum TestEntryType { // TestEntry represents a dummy entry for mocking a filesystem. struct TestEntry { - const FilePath::CharType* path; + const base::FilePath::CharType* path; TestEntryType entry_type; int64 last_accessed; int64 last_modified; @@ -43,15 +43,15 @@ struct TestEntry { int64 file_size; // Checks whether this TestEntry is the direct content of the |directory|. - bool IsDirectChildOf(const FilePath& directory) const { - return FilePath(path).DirName() == directory; + bool IsDirectChildOf(const base::FilePath& directory) const { + return base::FilePath(path).DirName() == directory; } // Converts this TestEntry to DriveEntryProto, which is the real data // structure used in DriveFileSystem. DriveEntryProto ToDriveEntryProto() const { DriveEntryProto entry; - entry.set_base_name(FilePath(path).BaseName().value()); + entry.set_base_name(base::FilePath(path).BaseName().value()); entry.mutable_file_info()->set_is_directory(entry_type == TYPE_DIRECTORY); if (entry_type != TYPE_DIRECTORY) { entry.mutable_file_specific_info()->set_is_hosted_document( @@ -69,14 +69,14 @@ struct TestEntry { // resource_id (arg0) to |fetched_list|, and calls back a successful completion. ACTION_P(MockGetFile, fetched_list) { fetched_list->push_back(arg0); - arg1.Run(DRIVE_FILE_OK, FilePath(), std::string(), REGULAR_FILE); + arg1.Run(DRIVE_FILE_OK, base::FilePath(), std::string(), REGULAR_FILE); } // Mocks DriveFileSystem::ReadDirectory. It holds the flat list of all entries // in the mock filesystem in |test_entries|, and when it is called to read a // |directory|, it selects only the direct children of the directory. ACTION_P(MockReadDirectory, test_entries) { - const FilePath& directory = arg0; + const base::FilePath& directory = arg0; const ReadDirectoryWithSettingCallback& callback = arg1; scoped_ptr<DriveEntryProtoVector> entries(new DriveEntryProtoVector); diff --git a/chrome/browser/chromeos/drive/drive_protocol_handler.cc b/chrome/browser/chromeos/drive/drive_protocol_handler.cc index 4f224a4..74f204d 100644 --- a/chrome/browser/chromeos/drive/drive_protocol_handler.cc +++ b/chrome/browser/chromeos/drive/drive_protocol_handler.cc @@ -113,7 +113,7 @@ DriveFileSystemInterface* GetFileSystemOnUIThread(void* profile_id) { // Helper function to cancel Drive download operation on UI thread. void CancelDriveDownloadOnUIThread( - void* profile_id, const FilePath& drive_file_path) { + void* profile_id, const base::FilePath& drive_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DriveSystemService* system_service = GetSystemService(profile_id); @@ -131,7 +131,7 @@ void GetEntryInfoByResourceIdOnUIThread( DriveFileSystemInterface* file_system = GetFileSystemOnUIThread(profile_id); if (!file_system) { callback.Run(DRIVE_FILE_ERROR_FAILED, - FilePath(), + base::FilePath(), scoped_ptr<DriveEntryProto>()); return; } @@ -149,7 +149,7 @@ void GetFileByResourceIdOnUIThread( DriveFileSystemInterface* file_system = GetFileSystemOnUIThread(profile_id); if (!file_system) { get_file_callback.Run(DRIVE_FILE_ERROR_FAILED, - FilePath(), + base::FilePath(), std::string(), REGULAR_FILE); return; @@ -197,7 +197,7 @@ class DriveURLRequestJob : public net::URLRequestJob { // Helper callback for handling async responses from // DriveFileSystem::GetFileByResourceId(). void OnGetFileByResourceId(DriveFileError error, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const std::string& mime_type, DriveFileType file_type); @@ -207,7 +207,7 @@ class DriveURLRequestJob : public net::URLRequestJob { // Helper callback for GetEntryInfoByResourceId invoked by Start(). void OnGetEntryInfoByResourceId(const std::string& resource_id, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto); // Helper methods for ReadRawData to open file and read from its corresponding @@ -242,8 +242,8 @@ class DriveURLRequestJob : public net::URLRequestJob { bool error_; // True if we've encountered an error. bool headers_set_; // True if headers have been set. - FilePath local_file_path_; - FilePath drive_file_path_; + base::FilePath local_file_path_; + base::FilePath drive_file_path_; std::string mime_type_; int64 initial_file_size_; int64 remaining_bytes_; @@ -519,7 +519,7 @@ DriveURLRequestJob::~DriveURLRequestJob() { void DriveURLRequestJob::OnGetEntryInfoByResourceId( const std::string& resource_id, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto) { if (entry_proto.get() && !entry_proto->has_file_specific_info()) error = DRIVE_FILE_ERROR_NOT_FOUND; @@ -671,7 +671,7 @@ bool DriveURLRequestJob::ReadFromDownloadData() { void DriveURLRequestJob::OnGetFileByResourceId( DriveFileError error, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const std::string& mime_type, DriveFileType file_type) { DVLOG(1) << "Got OnGetFileByResourceId"; diff --git a/chrome/browser/chromeos/drive/drive_resource_metadata.cc b/chrome/browser/chromeos/drive/drive_resource_metadata.cc index a952cf8..7d4d53c 100644 --- a/chrome/browser/chromeos/drive/drive_resource_metadata.cc +++ b/chrome/browser/chromeos/drive/drive_resource_metadata.cc @@ -34,7 +34,7 @@ void PostFileMoveCallbackError(const FileMoveCallback& callback, DriveFileError error) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, error, FilePath())); + base::Bind(callback, error, base::FilePath())); } // Posts |error| to |callback| asynchronously. |callback| must not be null. @@ -44,7 +44,7 @@ void PostGetEntryInfoWithFilePathCallbackError( scoped_ptr<DriveEntryProto> proto; base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, error, FilePath(), base::Passed(&proto))); + base::Bind(callback, error, base::FilePath(), base::Passed(&proto))); } } // namespace @@ -65,13 +65,13 @@ EntryInfoPairResult::~EntryInfoPairResult() { // Params for ResourceMetadataDB::Create. struct CreateDBParams { - CreateDBParams(const FilePath& db_path, + CreateDBParams(const base::FilePath& db_path, base::SequencedTaskRunner* blocking_task_runner) : db_path(db_path), blocking_task_runner(blocking_task_runner) { } - FilePath db_path; + base::FilePath db_path; scoped_refptr<base::SequencedTaskRunner> blocking_task_runner; scoped_ptr<ResourceMetadataDB> db; DriveResourceMetadata::SerializedMap serialized_resources; @@ -80,7 +80,7 @@ struct CreateDBParams { // Wrapper for level db. All methods must be called on blocking thread. class ResourceMetadataDB { public: - ResourceMetadataDB(const FilePath& db_path, + ResourceMetadataDB(const base::FilePath& db_path, base::SequencedTaskRunner* blocking_task_runner); // Initializes the database. @@ -98,10 +98,10 @@ class ResourceMetadataDB { scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; scoped_ptr<leveldb::DB> level_db_; - FilePath db_path_; + base::FilePath db_path_; }; -ResourceMetadataDB::ResourceMetadataDB(const FilePath& db_path, +ResourceMetadataDB::ResourceMetadataDB(const base::FilePath& db_path, base::SequencedTaskRunner* blocking_task_runner) : blocking_task_runner_(blocking_task_runner), db_path_(db_path) { @@ -246,7 +246,7 @@ void DriveResourceMetadata::SetLargestChangestamp( } void DriveResourceMetadata::AddEntryToDirectory( - const FilePath& directory_path, + const base::FilePath& directory_path, scoped_ptr<google_apis::ResourceEntry> entry, const FileMoveCallback& callback) { DCHECK(!directory_path.empty()); @@ -276,8 +276,8 @@ void DriveResourceMetadata::AddEntryToDirectory( } void DriveResourceMetadata::MoveEntryToDirectory( - const FilePath& file_path, - const FilePath& directory_path, + const base::FilePath& file_path, + const base::FilePath& directory_path, const FileMoveCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!directory_path.empty()); @@ -291,7 +291,7 @@ void DriveResourceMetadata::MoveEntryToDirectory( } DriveEntry* destination = FindEntryByPathSync(directory_path); - FilePath moved_file_path; + base::FilePath moved_file_path; DriveFileError error = DRIVE_FILE_ERROR_FAILED; if (!destination) { error = DRIVE_FILE_ERROR_NOT_FOUND; @@ -311,8 +311,8 @@ void DriveResourceMetadata::MoveEntryToDirectory( } void DriveResourceMetadata::RenameEntry( - const FilePath& file_path, - const FilePath::StringType& new_name, + const base::FilePath& file_path, + const base::FilePath::StringType& new_name, const FileMoveCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!file_path.empty()); @@ -389,11 +389,11 @@ void DriveResourceMetadata::RemoveEntryFromResourceMap( } DriveEntry* DriveResourceMetadata::FindEntryByPathSync( - const FilePath& file_path) { + const base::FilePath& file_path) { if (file_path == root_->GetFilePath()) return root_.get(); - std::vector<FilePath::StringType> components; + std::vector<base::FilePath::StringType> components; file_path.GetComponents(&components); DriveDirectory* current_dir = root_.get(); @@ -428,7 +428,7 @@ void DriveResourceMetadata::GetEntryInfoByResourceId( scoped_ptr<DriveEntryProto> entry_proto; DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; DriveEntry* entry = GetEntryByResourceId(resource_id); if (entry) { @@ -446,7 +446,7 @@ void DriveResourceMetadata::GetEntryInfoByResourceId( } void DriveResourceMetadata::GetEntryInfoByPath( - const FilePath& path, + const base::FilePath& path, const GetEntryInfoCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -469,7 +469,7 @@ void DriveResourceMetadata::GetEntryInfoByPath( } void DriveResourceMetadata::ReadDirectoryByPath( - const FilePath& path, + const base::FilePath& path, const ReadDirectoryCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -493,8 +493,8 @@ void DriveResourceMetadata::ReadDirectoryByPath( } void DriveResourceMetadata::GetEntryInfoPairByPaths( - const FilePath& first_path, - const FilePath& second_path, + const base::FilePath& first_path, + const base::FilePath& second_path, const GetEntryInfoPairCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -534,7 +534,7 @@ void DriveResourceMetadata::RefreshEntry( FROM_HERE, base::Bind(callback, DRIVE_FILE_ERROR_NOT_FOUND, - FilePath(), + base::FilePath(), base::Passed(&result_entry_proto))); return; } @@ -651,7 +651,7 @@ void DriveResourceMetadata::GetChildDirectories( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!changed_dirs_callback.is_null()); - std::set<FilePath> changed_directories; + std::set<base::FilePath> changed_directories; DriveEntry* entry = GetEntryByResourceId(resource_id); if (entry && entry->AsDriveDirectory()) entry->AsDriveDirectory()->GetChildDirectoryPaths(&changed_directories); @@ -667,7 +667,7 @@ void DriveResourceMetadata::RemoveAll(const base::Closure& callback) { } void DriveResourceMetadata::InitFromDB( - const FilePath& db_path, + const base::FilePath& db_path, base::SequencedTaskRunner* blocking_task_runner, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -896,8 +896,8 @@ scoped_ptr<DriveEntry> DriveResourceMetadata::CreateDriveEntryFromProtoString( } void DriveResourceMetadata::GetEntryInfoPairByPathsAfterGetFirst( - const FilePath& first_path, - const FilePath& second_path, + const base::FilePath& first_path, + const base::FilePath& second_path, const GetEntryInfoPairCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -926,7 +926,7 @@ void DriveResourceMetadata::GetEntryInfoPairByPathsAfterGetFirst( } void DriveResourceMetadata::GetEntryInfoPairByPathsAfterGetSecond( - const FilePath& second_path, + const base::FilePath& second_path, const GetEntryInfoPairCallback& callback, scoped_ptr<EntryInfoPairResult> result, DriveFileError error, diff --git a/chrome/browser/chromeos/drive/drive_resource_metadata.h b/chrome/browser/chromeos/drive/drive_resource_metadata.h index 356ab72..9cd61fa 100644 --- a/chrome/browser/chromeos/drive/drive_resource_metadata.h +++ b/chrome/browser/chromeos/drive/drive_resource_metadata.h @@ -47,7 +47,8 @@ enum DriveFileType { // The root directory name used for the Google Drive file system tree. The // name is used in URLs for the file manager, hence user-visible. -const FilePath::CharType kDriveRootDirectory[] = FILE_PATH_LITERAL("drive"); +const base::FilePath::CharType kDriveRootDirectory[] = + FILE_PATH_LITERAL("drive"); // This should be incremented when incompatibility change is made in // drive.proto. @@ -56,7 +57,7 @@ const int32 kProtoVersion = 2; // Callback similar to FileOperationCallback but with a given |file_path|. // Used for operations that change a file path like moving files. typedef base::Callback<void(DriveFileError error, - const FilePath& file_path)> + const base::FilePath& file_path)> FileMoveCallback; // Used to get entry info from the file system. @@ -76,12 +77,12 @@ typedef base::Callback<void(DriveFileError error, // the Drive file path (i.e. only contains the base name without parent // directory names). typedef base::Callback<void(DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto)> GetEntryInfoWithFilePathCallback; // Used to get a set of changed directories for feed processing. -typedef base::Callback<void(const std::set<FilePath>&)> +typedef base::Callback<void(const std::set<base::FilePath>&)> GetChildDirectoriesCallback; typedef base::Callback<void(int64)> GetChangestampCallback; @@ -91,7 +92,7 @@ struct EntryInfoResult { EntryInfoResult(); ~EntryInfoResult(); - FilePath path; + base::FilePath path; DriveFileError error; scoped_ptr<DriveEntryProto> proto; }; @@ -124,7 +125,7 @@ class DriveResourceMetadataInterface { // Adds |entry| to directory with path |directory_path| and invoke the // callback asynchronously. |callback| must not be null. - virtual void AddEntryToDirectory(const FilePath& directory_path, + virtual void AddEntryToDirectory(const base::FilePath& directory_path, scoped_ptr<google_apis::ResourceEntry> entry, const FileMoveCallback& callback) = 0; @@ -136,14 +137,14 @@ class DriveResourceMetadataInterface { // Moves entry specified by |file_path| to the directory specified by // |directory_path| and calls the callback asynchronously. Removes the entry // from the previous parent. |callback| must not be null. - virtual void MoveEntryToDirectory(const FilePath& file_path, - const FilePath& directory_path, + virtual void MoveEntryToDirectory(const base::FilePath& file_path, + const base::FilePath& directory_path, const FileMoveCallback& callback) = 0; // Renames entry specified by |file_path| with the new name |new_name| and // calls |callback| asynchronously. |callback| must not be null. - virtual void RenameEntry(const FilePath& file_path, - const FilePath::StringType& new_name, + virtual void RenameEntry(const base::FilePath& file_path, + const base::FilePath::StringType& new_name, const FileMoveCallback& callback) = 0; // Removes entry with |resource_id| from its parent. Calls |callback| with the @@ -159,12 +160,12 @@ class DriveResourceMetadataInterface { // Finds an entry (a file or a directory) by |file_path|. // |callback| must not be null. - virtual void GetEntryInfoByPath(const FilePath& file_path, + virtual void GetEntryInfoByPath(const base::FilePath& file_path, const GetEntryInfoCallback& callback) = 0; // Finds and reads a directory by |file_path|. // |callback| must not be null. - virtual void ReadDirectoryByPath(const FilePath& file_path, + virtual void ReadDirectoryByPath(const base::FilePath& file_path, const ReadDirectoryCallback& callback) = 0; // Similar to GetEntryInfoByPath() but this function finds a pair of @@ -172,8 +173,8 @@ class DriveResourceMetadataInterface { // |first_path| is not found, this function does not try to get the // entry of |second_path|. |callback| must not be null. virtual void GetEntryInfoPairByPaths( - const FilePath& first_path, - const FilePath& second_path, + const base::FilePath& first_path, + const base::FilePath& second_path, const GetEntryInfoPairCallback& callback) = 0; // Refreshes a drive entry with the same resource id as |entry_proto|. @@ -232,16 +233,16 @@ class DriveResourceMetadata : public DriveResourceMetadataInterface { int64 value, const FileOperationCallback& callback) OVERRIDE; virtual void AddEntryToDirectory( - const FilePath& directory_path, + const base::FilePath& directory_path, scoped_ptr<google_apis::ResourceEntry> entry, const FileMoveCallback& callback) OVERRIDE; virtual void AddEntryToParent(const DriveEntryProto& entry_proto, const FileMoveCallback& callback) OVERRIDE; - virtual void MoveEntryToDirectory(const FilePath& file_path, - const FilePath& directory_path, + virtual void MoveEntryToDirectory(const base::FilePath& file_path, + const base::FilePath& directory_path, const FileMoveCallback& callback) OVERRIDE; - virtual void RenameEntry(const FilePath& file_path, - const FilePath::StringType& new_name, + virtual void RenameEntry(const base::FilePath& file_path, + const base::FilePath::StringType& new_name, const FileMoveCallback& callback) OVERRIDE; virtual void RemoveEntryFromParent(const std::string& resource_id, const FileMoveCallback& callback) OVERRIDE; @@ -249,14 +250,14 @@ class DriveResourceMetadata : public DriveResourceMetadataInterface { const std::string& resource_id, const GetEntryInfoWithFilePathCallback& callback) OVERRIDE; virtual void GetEntryInfoByPath( - const FilePath& file_path, + const base::FilePath& file_path, const GetEntryInfoCallback& callback) OVERRIDE; virtual void ReadDirectoryByPath( - const FilePath& file_path, + const base::FilePath& file_path, const ReadDirectoryCallback& callback) OVERRIDE; virtual void GetEntryInfoPairByPaths( - const FilePath& first_path, - const FilePath& second_path, + const base::FilePath& first_path, + const base::FilePath& second_path, const GetEntryInfoPairCallback& callback) OVERRIDE; virtual void RefreshEntry( const DriveEntryProto& entry_proto, @@ -275,7 +276,7 @@ class DriveResourceMetadata : public DriveResourceMetadataInterface { // Restores from and saves to database, calling |callback| asynchronously. // |callback| must not be null. - void InitFromDB(const FilePath& db_path, + void InitFromDB(const base::FilePath& db_path, base::SequencedTaskRunner* blocking_task_runner, const FileOperationCallback& callback); void SaveToDB(); @@ -321,8 +322,8 @@ class DriveResourceMetadata : public DriveResourceMetadataInterface { // asynchronously fetched. This fetches the second DriveEntry only if the // first was found. void GetEntryInfoPairByPathsAfterGetFirst( - const FilePath& first_path, - const FilePath& second_path, + const base::FilePath& first_path, + const base::FilePath& second_path, const GetEntryInfoPairCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); @@ -330,14 +331,14 @@ class DriveResourceMetadata : public DriveResourceMetadataInterface { // Continues with GetIntroInfoPairByPaths after the second DriveEntry has been // asynchronously fetched. void GetEntryInfoPairByPathsAfterGetSecond( - const FilePath& second_path, + const base::FilePath& second_path, const GetEntryInfoPairCallback& callback, scoped_ptr<EntryInfoPairResult> result, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); // Searches for |file_path| synchronously. - DriveEntry* FindEntryByPathSync(const FilePath& file_path); + DriveEntry* FindEntryByPathSync(const base::FilePath& file_path); // Helper function to add |entry_proto| as a child to |directory|. // |callback| must not be null. diff --git a/chrome/browser/chromeos/drive/drive_resource_metadata_unittest.cc b/chrome/browser/chromeos/drive/drive_resource_metadata_unittest.cc index 76080a0..43c06af 100644 --- a/chrome/browser/chromeos/drive/drive_resource_metadata_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_resource_metadata_unittest.cc @@ -38,8 +38,8 @@ void CopyResultsFromInitFromDBCallback(DriveFileError* expected_error, // Copies result from GetChildDirectoriesCallback. void CopyResultFromGetChildDirectoriesCallback( - std::set<FilePath>* out_child_directories, - const std::set<FilePath>& in_child_directories) { + std::set<base::FilePath>* out_child_directories, + const std::set<base::FilePath>& in_child_directories) { *out_child_directories = in_child_directories; } @@ -158,7 +158,7 @@ bool DriveResourceMetadataTest::AddDriveEntryProto( is_directory, parent_resource_id); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; resource_metadata->AddEntryToParent( entry_proto, @@ -228,7 +228,7 @@ TEST_F(DriveResourceMetadataTest, GetEntryByResourceId_RootDirectory) { DriveResourceMetadata resource_metadata(kTestRootResourceId); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; scoped_ptr<DriveEntryProto> entry_proto; // Look up the root directory by its resource ID. @@ -238,7 +238,7 @@ TEST_F(DriveResourceMetadataTest, GetEntryByResourceId_RootDirectory) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive"), drive_file_path); ASSERT_TRUE(entry_proto.get()); EXPECT_EQ("drive", entry_proto->base_name()); } @@ -246,7 +246,7 @@ TEST_F(DriveResourceMetadataTest, GetEntryByResourceId_RootDirectory) { TEST_F(DriveResourceMetadataTest, GetEntryInfoByResourceId) { // Confirm that an existing file is found. DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; scoped_ptr<DriveEntryProto> entry_proto; resource_metadata_->GetEntryInfoByResourceId( "resource_id:file4", @@ -254,7 +254,8 @@ TEST_F(DriveResourceMetadataTest, GetEntryInfoByResourceId) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/file4"), + drive_file_path); ASSERT_TRUE(entry_proto.get()); EXPECT_EQ("file4", entry_proto->base_name()); @@ -275,7 +276,7 @@ TEST_F(DriveResourceMetadataTest, GetEntryInfoByPath) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; scoped_ptr<DriveEntryProto> entry_proto; resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive/dir1/file4"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file4"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -287,7 +288,7 @@ TEST_F(DriveResourceMetadataTest, GetEntryInfoByPath) { error = DRIVE_FILE_ERROR_FAILED; entry_proto.reset(); resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive/dir1/non_existing"), + base::FilePath::FromUTF8Unsafe("drive/dir1/non_existing"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -300,7 +301,7 @@ TEST_F(DriveResourceMetadataTest, ReadDirectoryByPath) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; scoped_ptr<DriveEntryProtoVector> entries; resource_metadata_->ReadDirectoryByPath( - FilePath::FromUTF8Unsafe("drive/dir1"), + base::FilePath::FromUTF8Unsafe("drive/dir1"), base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, &error, &entries)); google_apis::test_util::RunBlockingPoolTask(); @@ -322,7 +323,7 @@ TEST_F(DriveResourceMetadataTest, ReadDirectoryByPath) { error = DRIVE_FILE_ERROR_FAILED; entries.reset(); resource_metadata_->ReadDirectoryByPath( - FilePath::FromUTF8Unsafe("drive/non_existing"), + base::FilePath::FromUTF8Unsafe("drive/non_existing"), base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, &error, &entries)); google_apis::test_util::RunBlockingPoolTask(); @@ -333,7 +334,7 @@ TEST_F(DriveResourceMetadataTest, ReadDirectoryByPath) { error = DRIVE_FILE_ERROR_FAILED; entries.reset(); resource_metadata_->ReadDirectoryByPath( - FilePath::FromUTF8Unsafe("drive/dir1/file4"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file4"), base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, &error, &entries)); google_apis::test_util::RunBlockingPoolTask(); @@ -345,20 +346,20 @@ TEST_F(DriveResourceMetadataTest, GetEntryInfoPairByPaths) { // Confirm that existing two files are found. scoped_ptr<EntryInfoPairResult> pair_result; resource_metadata_->GetEntryInfoPairByPaths( - FilePath::FromUTF8Unsafe("drive/dir1/file4"), - FilePath::FromUTF8Unsafe("drive/dir1/file5"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file4"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file5"), base::Bind(&test_util::CopyResultsFromGetEntryInfoPairCallback, &pair_result)); google_apis::test_util::RunBlockingPoolTask(); // The first entry should be found. EXPECT_EQ(DRIVE_FILE_OK, pair_result->first.error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/file4"), pair_result->first.path); ASSERT_TRUE(pair_result->first.proto.get()); EXPECT_EQ("file4", pair_result->first.proto->base_name()); // The second entry should be found. EXPECT_EQ(DRIVE_FILE_OK, pair_result->second.error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file5"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/file5"), pair_result->second.path); ASSERT_TRUE(pair_result->second.proto.get()); EXPECT_EQ("file5", pair_result->second.proto->base_name()); @@ -366,38 +367,38 @@ TEST_F(DriveResourceMetadataTest, GetEntryInfoPairByPaths) { // Confirm that the first non existent file is not found. pair_result.reset(); resource_metadata_->GetEntryInfoPairByPaths( - FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), - FilePath::FromUTF8Unsafe("drive/dir1/file5"), + base::FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file5"), base::Bind(&test_util::CopyResultsFromGetEntryInfoPairCallback, &pair_result)); google_apis::test_util::RunBlockingPoolTask(); // The first entry should not be found. EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, pair_result->first.error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), pair_result->first.path); ASSERT_FALSE(pair_result->first.proto.get()); // The second entry should not be found, because the first one failed. EXPECT_EQ(DRIVE_FILE_ERROR_FAILED, pair_result->second.error); - EXPECT_EQ(FilePath(), pair_result->second.path); + EXPECT_EQ(base::FilePath(), pair_result->second.path); ASSERT_FALSE(pair_result->second.proto.get()); // Confirm that the second non existent file is not found. pair_result.reset(); resource_metadata_->GetEntryInfoPairByPaths( - FilePath::FromUTF8Unsafe("drive/dir1/file4"), - FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file4"), + base::FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), base::Bind(&test_util::CopyResultsFromGetEntryInfoPairCallback, &pair_result)); google_apis::test_util::RunBlockingPoolTask(); // The first entry should be found. EXPECT_EQ(DRIVE_FILE_OK, pair_result->first.error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/file4"), pair_result->first.path); ASSERT_TRUE(pair_result->first.proto.get()); EXPECT_EQ("file4", pair_result->first.proto->base_name()); // The second entry should not be found. EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, pair_result->second.error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), pair_result->second.path); ASSERT_FALSE(pair_result->second.proto.get()); } @@ -412,7 +413,7 @@ TEST_F(DriveResourceMetadataTest, DBTest) { DriveResourceMetadata resource_metadata(kTestRootResourceId); Init(&resource_metadata); - FilePath db_path(DriveCache::GetCacheRootPath(&profile). + base::FilePath db_path(DriveCache::GetCacheRootPath(&profile). AppendASCII("meta").AppendASCII("resource_metadata.db")); // InitFromDB should fail with DRIVE_FILE_ERROR_NOT_FOUND since the db // doesn't exist. @@ -452,7 +453,7 @@ TEST_F(DriveResourceMetadataTest, DBTest) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; scoped_ptr<DriveEntryProtoVector> entries; test_resource_metadata.ReadDirectoryByPath( - FilePath::FromUTF8Unsafe("drive/dir2"), + base::FilePath::FromUTF8Unsafe("drive/dir2"), base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, &error, &entries)); google_apis::test_util::RunBlockingPoolTask(); @@ -464,7 +465,7 @@ TEST_F(DriveResourceMetadataTest, DBTest) { TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { // Make sure file9 is found. DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; const std::string file9_resource_id = "resource_id:file9"; scoped_ptr<DriveEntryProto> entry_proto; resource_metadata_->GetEntryInfoByResourceId( @@ -473,7 +474,8 @@ TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3/file9"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/file9"), + drive_file_path); ASSERT_TRUE(entry_proto.get()); EXPECT_EQ("file9", entry_proto->base_name()); @@ -484,7 +486,7 @@ TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir3"), drive_file_path); // file9 should no longer exist. resource_metadata_->GetEntryInfoByResourceId( @@ -503,7 +505,7 @@ TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir3"), drive_file_path); ASSERT_TRUE(entry_proto.get()); EXPECT_EQ("dir3", entry_proto->base_name()); @@ -514,7 +516,7 @@ TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1"), drive_file_path); // dir3 should no longer exist. resource_metadata_->GetEntryInfoByResourceId( @@ -544,18 +546,19 @@ TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { TEST_F(DriveResourceMetadataTest, MoveEntryToDirectory) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; scoped_ptr<DriveEntryProto> entry_proto; // Move file8 to drive/dir1. resource_metadata_->MoveEntryToDirectory( - FilePath::FromUTF8Unsafe("drive/dir2/file8"), - FilePath::FromUTF8Unsafe("drive/dir1"), + base::FilePath::FromUTF8Unsafe("drive/dir2/file8"), + base::FilePath::FromUTF8Unsafe("drive/dir1"), base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file8"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/file8"), + drive_file_path); // Look up the entry by its resource id and make sure it really moved. resource_metadata_->GetEntryInfoByResourceId( @@ -564,57 +567,59 @@ TEST_F(DriveResourceMetadataTest, MoveEntryToDirectory) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file8"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/file8"), + drive_file_path); // Move non-existent file to drive/dir1. This should fail. resource_metadata_->MoveEntryToDirectory( - FilePath::FromUTF8Unsafe("drive/dir2/file8"), - FilePath::FromUTF8Unsafe("drive/dir1"), + base::FilePath::FromUTF8Unsafe("drive/dir2/file8"), + base::FilePath::FromUTF8Unsafe("drive/dir1"), base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); - EXPECT_EQ(FilePath(), drive_file_path); + EXPECT_EQ(base::FilePath(), drive_file_path); // Move existing file to non-existent directory. This should fail. resource_metadata_->MoveEntryToDirectory( - FilePath::FromUTF8Unsafe("drive/dir1/file8"), - FilePath::FromUTF8Unsafe("drive/dir4"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file8"), + base::FilePath::FromUTF8Unsafe("drive/dir4"), base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); - EXPECT_EQ(FilePath(), drive_file_path); + EXPECT_EQ(base::FilePath(), drive_file_path); // Move existing file to existing file (non-directory). This should fail. resource_metadata_->MoveEntryToDirectory( - FilePath::FromUTF8Unsafe("drive/dir1/file8"), - FilePath::FromUTF8Unsafe("drive/dir1/file4"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file8"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file4"), base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_A_DIRECTORY, error); - EXPECT_EQ(FilePath(), drive_file_path); + EXPECT_EQ(base::FilePath(), drive_file_path); // Move the file to root. resource_metadata_->MoveEntryToDirectory( - FilePath::FromUTF8Unsafe("drive/dir1/file8"), - FilePath::FromUTF8Unsafe("drive"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file8"), + base::FilePath::FromUTF8Unsafe("drive"), base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/file8"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/file8"), drive_file_path); // Move the file from root. resource_metadata_->MoveEntryToDirectory( - FilePath::FromUTF8Unsafe("drive/file8"), - FilePath::FromUTF8Unsafe("drive/dir2"), + base::FilePath::FromUTF8Unsafe("drive/file8"), + base::FilePath::FromUTF8Unsafe("drive/dir2"), base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file8"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir2/file8"), + drive_file_path); // Make sure file is still ok. resource_metadata_->GetEntryInfoByResourceId( @@ -623,23 +628,25 @@ TEST_F(DriveResourceMetadataTest, MoveEntryToDirectory) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file8"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir2/file8"), + drive_file_path); } TEST_F(DriveResourceMetadataTest, RenameEntry) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; scoped_ptr<DriveEntryProto> entry_proto; // Rename file8 to file11. resource_metadata_->RenameEntry( - FilePath::FromUTF8Unsafe("drive/dir2/file8"), + base::FilePath::FromUTF8Unsafe("drive/dir2/file8"), "file11", base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file11"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir2/file11"), + drive_file_path); // Lookup the file by resource id to make sure the file actually got renamed. resource_metadata_->GetEntryInfoByResourceId( @@ -648,47 +655,49 @@ TEST_F(DriveResourceMetadataTest, RenameEntry) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file11"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir2/file11"), + drive_file_path); // Rename to file7 to force a duplicate name. resource_metadata_->RenameEntry( - FilePath::FromUTF8Unsafe("drive/dir2/file11"), + base::FilePath::FromUTF8Unsafe("drive/dir2/file11"), "file7", base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file7 (2)"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir2/file7 (2)"), + drive_file_path); // Rename to same name. This should fail. resource_metadata_->RenameEntry( - FilePath::FromUTF8Unsafe("drive/dir2/file7 (2)"), + base::FilePath::FromUTF8Unsafe("drive/dir2/file7 (2)"), "file7 (2)", base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_EXISTS, error); - EXPECT_EQ(FilePath(), drive_file_path); + EXPECT_EQ(base::FilePath(), drive_file_path); // Rename non-existent. resource_metadata_->RenameEntry( - FilePath::FromUTF8Unsafe("drive/dir2/file11"), + base::FilePath::FromUTF8Unsafe("drive/dir2/file11"), "file11", base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); - EXPECT_EQ(FilePath(), drive_file_path); + EXPECT_EQ(base::FilePath(), drive_file_path); } TEST_F(DriveResourceMetadataTest, RefreshEntry) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; scoped_ptr<DriveEntryProto> entry_proto; // Get file9. resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive/dir1/dir3/file9"), + base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/file9"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -710,7 +719,7 @@ TEST_F(DriveResourceMetadataTest, RefreshEntry) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"), drive_file_path); ASSERT_TRUE(entry_proto.get()); EXPECT_EQ("file100", entry_proto->base_name()); @@ -720,7 +729,7 @@ TEST_F(DriveResourceMetadataTest, RefreshEntry) { // Make sure we get the same thing from GetEntryInfoByPath. entry_proto.reset(); resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"), + base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -733,7 +742,7 @@ TEST_F(DriveResourceMetadataTest, RefreshEntry) { // Get dir2. entry_proto.reset(); resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive/dir2"), + base::FilePath::FromUTF8Unsafe("drive/dir2"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -753,7 +762,7 @@ TEST_F(DriveResourceMetadataTest, RefreshEntry) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3/dir100"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/dir100"), drive_file_path); ASSERT_TRUE(entry_proto.get()); EXPECT_EQ("dir100", entry_proto->base_name()); @@ -763,7 +772,7 @@ TEST_F(DriveResourceMetadataTest, RefreshEntry) { // Make sure the children have moved over. Test file6. entry_proto.reset(); resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive/dir1/dir3/dir100/file6"), + base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/dir100/file6"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -773,7 +782,7 @@ TEST_F(DriveResourceMetadataTest, RefreshEntry) { // Make sure dir2 no longer exists. resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive/dir2"), + base::FilePath::FromUTF8Unsafe("drive/dir2"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -784,12 +793,12 @@ TEST_F(DriveResourceMetadataTest, RefreshEntry) { // Test the special logic for RefreshEntry of root. TEST_F(DriveResourceMetadataTest, RefreshEntry_Root) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; scoped_ptr<DriveEntryProto> entry_proto; // Get root. resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive"), + base::FilePath::FromUTF8Unsafe("drive"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -810,7 +819,7 @@ TEST_F(DriveResourceMetadataTest, RefreshEntry_Root) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive"), drive_file_path); ASSERT_TRUE(entry_proto.get()); EXPECT_EQ("drive", entry_proto->base_name()); EXPECT_TRUE(entry_proto->file_info().is_directory()); @@ -820,7 +829,7 @@ TEST_F(DriveResourceMetadataTest, RefreshEntry_Root) { // Make sure the children have moved over. Test file9. entry_proto.reset(); resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive/dir1/dir3/file9"), + base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/file9"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -835,7 +844,7 @@ TEST_F(DriveResourceMetadataTest, AddEntryToParent) { sequence_id++, false, "resource_id:dir3"); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; // Add to dir3. resource_metadata_->AddEntryToParent( @@ -844,7 +853,7 @@ TEST_F(DriveResourceMetadataTest, AddEntryToParent) { &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"), drive_file_path); // Adds to root when parent resource id is not specified. @@ -857,7 +866,7 @@ TEST_F(DriveResourceMetadataTest, AddEntryToParent) { &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/file101"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/file101"), drive_file_path); // Add a directory. DriveEntryProto dir_entry_proto = CreateDriveEntryProto( @@ -869,7 +878,8 @@ TEST_F(DriveResourceMetadataTest, AddEntryToParent) { &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir102"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir102"), + drive_file_path); // Add to an invalid parent. DriveEntryProto file_entry_proto3 = CreateDriveEntryProto( @@ -884,7 +894,7 @@ TEST_F(DriveResourceMetadataTest, AddEntryToParent) { } TEST_F(DriveResourceMetadataTest, GetChildDirectories) { - std::set<FilePath> child_directories; + std::set<base::FilePath> child_directories; // file9: not a directory, so no children. resource_metadata_->GetChildDirectories("resource_id:file9", @@ -907,7 +917,7 @@ TEST_F(DriveResourceMetadataTest, GetChildDirectories) { google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(1u, child_directories.size()); EXPECT_EQ(1u, child_directories.count( - FilePath::FromUTF8Unsafe("drive/dir1/dir3"))); + base::FilePath::FromUTF8Unsafe("drive/dir1/dir3"))); // Add a few more directories to make sure deeper nesting works. // dir2/dir100 @@ -941,11 +951,11 @@ TEST_F(DriveResourceMetadataTest, GetChildDirectories) { &child_directories)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(8u, child_directories.size()); - EXPECT_EQ(1u, child_directories.count(FilePath::FromUTF8Unsafe( + EXPECT_EQ(1u, child_directories.count(base::FilePath::FromUTF8Unsafe( "drive/dir2/dir101"))); - EXPECT_EQ(1u, child_directories.count(FilePath::FromUTF8Unsafe( + EXPECT_EQ(1u, child_directories.count(base::FilePath::FromUTF8Unsafe( "drive/dir2/dir101/dir104"))); - EXPECT_EQ(1u, child_directories.count(FilePath::FromUTF8Unsafe( + EXPECT_EQ(1u, child_directories.count(base::FilePath::FromUTF8Unsafe( "drive/dir2/dir101/dir102/dir105/dir106/dir107"))); } @@ -955,7 +965,7 @@ TEST_F(DriveResourceMetadataTest, RemoveAll) { // root has children. resource_metadata_->ReadDirectoryByPath( - FilePath::FromUTF8Unsafe("drive"), + base::FilePath::FromUTF8Unsafe("drive"), base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, &error, &entries)); google_apis::test_util::RunBlockingPoolTask(); @@ -967,12 +977,12 @@ TEST_F(DriveResourceMetadataTest, RemoveAll) { resource_metadata_->RemoveAll(base::Bind(&base::DoNothing)); google_apis::test_util::RunBlockingPoolTask(); - FilePath drive_file_path; + base::FilePath drive_file_path; scoped_ptr<DriveEntryProto> entry_proto; // root should continue to exist. resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive"), + base::FilePath::FromUTF8Unsafe("drive"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -984,7 +994,7 @@ TEST_F(DriveResourceMetadataTest, RemoveAll) { // root should have no children. resource_metadata_->ReadDirectoryByPath( - FilePath::FromUTF8Unsafe("drive"), + base::FilePath::FromUTF8Unsafe("drive"), base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, &error, &entries)); google_apis::test_util::RunBlockingPoolTask(); diff --git a/chrome/browser/chromeos/drive/drive_scheduler.cc b/chrome/browser/chromeos/drive/drive_scheduler.cc index ea62f51..905d441 100644 --- a/chrome/browser/chromeos/drive/drive_scheduler.cc +++ b/chrome/browser/chromeos/drive/drive_scheduler.cc @@ -242,8 +242,8 @@ void DriveScheduler::AddNewDirectory( } void DriveScheduler::DownloadFile( - const FilePath& virtual_path, - const FilePath& local_cache_path, + const base::FilePath& virtual_path, + const base::FilePath& local_cache_path, const GURL& download_url, const google_apis::DownloadActionCallback& download_action_callback, const google_apis::GetContentCallback& get_content_callback) { @@ -263,8 +263,8 @@ void DriveScheduler::DownloadFile( void DriveScheduler::UploadExistingFile( const GURL& upload_location, - const FilePath& drive_file_path, - const FilePath& local_file_path, + const base::FilePath& drive_file_path, + const base::FilePath& local_file_path, const std::string& content_type, const std::string& etag, const google_apis::UploadCompletionCallback& upload_completion_callback) { @@ -636,7 +636,7 @@ void DriveScheduler::OnEntryActionJobDone(int job_id, void DriveScheduler::OnDownloadActionJobDone(int job_id, google_apis::GDataErrorCode error, - const FilePath& temp_file) { + const base::FilePath& temp_file) { DriveFileError drive_error(util::GDataToDriveFileError(error)); scoped_ptr<QueueEntry> job_info = OnJobDone(job_id, drive_error); @@ -652,8 +652,8 @@ void DriveScheduler::OnDownloadActionJobDone(int job_id, void DriveScheduler::OnUploadCompletionJobDone( int job_id, google_apis::DriveUploadError error, - const FilePath& drive_path, - const FilePath& file_path, + const base::FilePath& drive_path, + const base::FilePath& file_path, scoped_ptr<google_apis::ResourceEntry> resource_entry) { DriveFileError drive_error(DriveUploadErrorToDriveFileError(error)); diff --git a/chrome/browser/chromeos/drive/drive_scheduler.h b/chrome/browser/chromeos/drive/drive_scheduler.h index 23eddd2..7713e39 100644 --- a/chrome/browser/chromeos/drive/drive_scheduler.h +++ b/chrome/browser/chromeos/drive/drive_scheduler.h @@ -73,7 +73,7 @@ class DriveScheduler int total_bytes; // Drive path of the file that this job acts on. - FilePath file_path; + base::FilePath file_path; // Current state of the operation. JobState state; @@ -145,8 +145,8 @@ class DriveScheduler // Adds a DownloadFile operation to the queue. void DownloadFile( - const FilePath& virtual_path, - const FilePath& local_cache_path, + const base::FilePath& virtual_path, + const base::FilePath& local_cache_path, const GURL& download_url, const google_apis::DownloadActionCallback& download_action_callback, const google_apis::GetContentCallback& get_content_callback); @@ -154,8 +154,8 @@ class DriveScheduler // Adds an UploadExistingFile operation to the queue. void UploadExistingFile( const GURL& upload_location, - const FilePath& drive_file_path, - const FilePath& local_file_path, + const base::FilePath& drive_file_path, + const base::FilePath& local_file_path, const std::string& content_type, const std::string& etag, const google_apis::UploadCompletionCallback& upload_completion_callback); @@ -186,8 +186,8 @@ class DriveScheduler // Online and cache path of the operation's target. // Used by: // TYPE_DOWNLOAD_FILE - FilePath virtual_path; - FilePath local_cache_path; + base::FilePath virtual_path; + base::FilePath local_cache_path; // Parameters for GetResourceList(). // Used by: @@ -256,8 +256,8 @@ class DriveScheduler // Used by: // TYPE_UPLOAD_EXISTING_FILE GURL upload_location; - FilePath drive_file_path; - FilePath local_file_path; + base::FilePath drive_file_path; + base::FilePath local_file_path; std::string content_type; std::string etag; google_apis::UploadCompletionCallback upload_completion_callback; @@ -319,14 +319,14 @@ class DriveScheduler // Callback for job finishing with a DownloadActionCallback. void OnDownloadActionJobDone(int job_id, google_apis::GDataErrorCode error, - const FilePath& temp_file); + const base::FilePath& temp_file); // Callback for job finishing with a UploadCompletionCallback. void OnUploadCompletionJobDone( int job_id, google_apis::DriveUploadError error, - const FilePath& drive_path, - const FilePath& file_path, + const base::FilePath& drive_path, + const base::FilePath& file_path, scoped_ptr<google_apis::ResourceEntry> resource_entry); // net::NetworkChangeNotifier::ConnectionTypeObserver override. diff --git a/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc b/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc index 327d811..9b38173 100644 --- a/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc @@ -44,8 +44,8 @@ class FakeDriveUploader : public google_apis::DriveUploaderInterface { // DriveUploaderInterface overrides. virtual void UploadNewFile( const GURL& upload_location, - const FilePath& drive_file_path, - const FilePath& local_file_path, + const base::FilePath& drive_file_path, + const base::FilePath& local_file_path, const std::string& title, const std::string& content_type, const google_apis::UploadCompletionCallback& callback) OVERRIDE { @@ -53,8 +53,8 @@ class FakeDriveUploader : public google_apis::DriveUploaderInterface { virtual void UploadExistingFile( const GURL& upload_location, - const FilePath& drive_file_path, - const FilePath& local_file_path, + const base::FilePath& drive_file_path, + const base::FilePath& local_file_path, const std::string& content_type, const std::string& etag, const google_apis::UploadCompletionCallback& callback) OVERRIDE { diff --git a/chrome/browser/chromeos/drive/drive_sync_client.cc b/chrome/browser/chromeos/drive/drive_sync_client.cc index 341ccb0..739ab7f 100644 --- a/chrome/browser/chromeos/drive/drive_sync_client.cc +++ b/chrome/browser/chromeos/drive/drive_sync_client.cc @@ -264,7 +264,7 @@ void DriveSyncClient::OnGetEntryInfoByResourceId( const std::string& resource_id, const DriveCacheEntry& cache_entry, DriveFileError error, - const FilePath& /* drive_file_path */, + const base::FilePath& /* drive_file_path */, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -321,7 +321,7 @@ void DriveSyncClient::OnPinned(const std::string& resource_id, void DriveSyncClient::OnFetchFileComplete(const std::string& resource_id, DriveFileError error, - const FilePath& local_path, + const base::FilePath& local_path, const std::string& ununsed_mime_type, DriveFileType file_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); diff --git a/chrome/browser/chromeos/drive/drive_sync_client.h b/chrome/browser/chromeos/drive/drive_sync_client.h index e30b5ce..77dc8d3 100644 --- a/chrome/browser/chromeos/drive/drive_sync_client.h +++ b/chrome/browser/chromeos/drive/drive_sync_client.h @@ -127,7 +127,7 @@ class DriveSyncClient void OnGetEntryInfoByResourceId(const std::string& resource_id, const DriveCacheEntry& cache_entry, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, scoped_ptr<DriveEntryProto> entry_proto); // Called when a cache entry is obtained. @@ -146,7 +146,7 @@ class DriveSyncClient // Calls DoSyncLoop() to go back to the sync loop. void OnFetchFileComplete(const std::string& resource_id, DriveFileError error, - const FilePath& local_path, + const base::FilePath& local_path, const std::string& ununsed_mime_type, DriveFileType file_type); diff --git a/chrome/browser/chromeos/drive/drive_sync_client_unittest.cc b/chrome/browser/chromeos/drive/drive_sync_client_unittest.cc index 2b7aa26..a5a30af 100644 --- a/chrome/browser/chromeos/drive/drive_sync_client_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_sync_client_unittest.cc @@ -53,7 +53,7 @@ ACTION_P(MockUpdateFileByResourceId, error) { ACTION_P2(MockUpdateFileByResourceId, error, md5) { scoped_ptr<DriveEntryProto> entry_proto(new DriveEntryProto); entry_proto->mutable_file_specific_info()->set_file_md5(md5); - arg1.Run(error, FilePath(), entry_proto.Pass()); + arg1.Run(error, base::FilePath(), entry_proto.Pass()); } class MockNetworkChangeNotifier : public net::NetworkChangeNotifier { @@ -140,7 +140,7 @@ class DriveSyncClientTest : public testing::Test { // Sets up cache for tests. void SetUpCache() { // Prepare a temp file. - FilePath temp_file; + base::FilePath temp_file; EXPECT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &temp_file)); const std::string content = "hello"; @@ -170,7 +170,7 @@ class DriveSyncClientTest : public testing::Test { // Prepare a pinned-and-fetched file. const std::string resource_id_fetched = "resource_id_fetched"; const std::string md5_fetched = "md5"; - FilePath cache_file_path; + base::FilePath cache_file_path; cache_->Store(resource_id_fetched, md5_fetched, temp_file, DriveCache::FILE_OPERATION_COPY, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, @@ -220,7 +220,7 @@ class DriveSyncClientTest : public testing::Test { &DriveSyncClientTest::VerifyStartNotified), MockGetFileByResourceId( DRIVE_FILE_OK, - FilePath::FromUTF8Unsafe("local_path_does_not_matter"), + base::FilePath::FromUTF8Unsafe("local_path_does_not_matter"), std::string("mime_type_does_not_matter"), REGULAR_FILE))); } diff --git a/chrome/browser/chromeos/drive/drive_system_service.cc b/chrome/browser/chromeos/drive/drive_system_service.cc index 65c449f..d7c85b2 100644 --- a/chrome/browser/chromeos/drive/drive_system_service.cc +++ b/chrome/browser/chromeos/drive/drive_system_service.cc @@ -106,7 +106,7 @@ void DriveSystemService::DriveCacheDeleter::operator()( DriveSystemService::DriveSystemService( Profile* profile, google_apis::DriveServiceInterface* test_drive_service, - const FilePath& test_cache_root, + const base::FilePath& test_cache_root, DriveFileSystemInterface* test_file_system) : profile_(profile), drive_disabled_(false), @@ -259,7 +259,7 @@ void DriveSystemService::AddDriveMountPoint() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!file_system_proxy_.get()); - const FilePath drive_mount_point = util::GetDriveMountPointPath(); + const base::FilePath drive_mount_point = util::GetDriveMountPointPath(); fileapi::ExternalMountPoints* mount_points = BrowserContext::GetMountPoints(profile_); DCHECK(mount_points); @@ -414,7 +414,7 @@ ProfileKeyedService* DriveSystemServiceFactory::BuildServiceInstanceFor( Profile* profile) const { DriveSystemService* service = NULL; if (factory_for_test_.is_null()) - service = new DriveSystemService(profile, NULL, FilePath(), NULL); + service = new DriveSystemService(profile, NULL, base::FilePath(), NULL); else service = factory_for_test_.Run(profile); diff --git a/chrome/browser/chromeos/drive/drive_system_service_unittest.cc b/chrome/browser/chromeos/drive/drive_system_service_unittest.cc index 52b64e7..fbb9433 100644 --- a/chrome/browser/chromeos/drive/drive_system_service_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_system_service_unittest.cc @@ -27,7 +27,7 @@ class DriveSystemServiceTest : public testing::Test { file_system_ = new MockDriveFileSystem; system_service_ = new DriveSystemService(profile_.get(), new google_apis::DummyDriveService, - FilePath(), + base::FilePath(), file_system_); } diff --git a/chrome/browser/chromeos/drive/drive_task_executor.cc b/chrome/browser/chromeos/drive/drive_task_executor.cc index 8ce2e94..4eeed0a 100644 --- a/chrome/browser/chromeos/drive/drive_task_executor.cc +++ b/chrome/browser/chromeos/drive/drive_task_executor.cc @@ -46,7 +46,7 @@ DriveTaskExecutor::~DriveTaskExecutor() { bool DriveTaskExecutor::ExecuteAndNotify( const std::vector<FileSystemURL>& file_urls, const file_handler_util::FileTaskFinishedCallback& done) { - std::vector<FilePath> raw_paths; + std::vector<base::FilePath> raw_paths; for (std::vector<FileSystemURL>::const_iterator url = file_urls.begin(); url != file_urls.end(); ++url) { if (!url->is_valid() || url->type() != fileapi::kFileSystemTypeDrive) @@ -64,7 +64,7 @@ bool DriveTaskExecutor::ExecuteAndNotify( // Reset the index, so we know when we're done. current_index_ = raw_paths.size(); - for (std::vector<FilePath>::const_iterator iter = raw_paths.begin(); + for (std::vector<base::FilePath>::const_iterator iter = raw_paths.begin(); iter != raw_paths.end(); ++iter) { file_system->GetEntryInfoByPath( *iter, diff --git a/chrome/browser/chromeos/drive/drive_test_util.cc b/chrome/browser/chromeos/drive/drive_test_util.cc index 986d561..24b0cac 100644 --- a/chrome/browser/chromeos/drive/drive_test_util.cc +++ b/chrome/browser/chromeos/drive/drive_test_util.cc @@ -44,9 +44,9 @@ void CopyErrorCodeFromFileOperationCallback(DriveFileError* output, void CopyResultsFromFileMoveCallback( DriveFileError* out_error, - FilePath* out_file_path, + base::FilePath* out_file_path, DriveFileError error, - const FilePath& moved_file_path) { + const base::FilePath& moved_file_path) { DCHECK(out_error); DCHECK(out_file_path); @@ -93,10 +93,10 @@ void CopyResultsFromReadDirectoryByPathCallback( void CopyResultsFromGetEntryInfoWithFilePathCallback( DriveFileError* out_error, - FilePath* out_drive_file_path, + base::FilePath* out_drive_file_path, scoped_ptr<DriveEntryProto>* out_entry_proto, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(out_error); DCHECK(out_drive_file_path); @@ -121,10 +121,11 @@ void CopyResultFromInitializeCacheCallback(bool* out_success, *out_success = success; } -void CopyResultsFromGetFileFromCacheCallback(DriveFileError* out_error, - FilePath* out_cache_file_path, - DriveFileError error, - const FilePath& cache_file_path) { +void CopyResultsFromGetFileFromCacheCallback( + DriveFileError* out_error, + base::FilePath* out_cache_file_path, + DriveFileError error, + const base::FilePath& cache_file_path) { DCHECK(out_error); DCHECK(out_cache_file_path); *out_error = error; @@ -142,10 +143,10 @@ void CopyResultsFromGetCacheEntryCallback(bool* out_success, } void CopyResultsFromGetFileCallback(DriveFileError* out_error, - FilePath* out_file_path, + base::FilePath* out_file_path, DriveFileType* out_file_type, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, const std::string& /*mime_type*/, DriveFileType file_type) { DCHECK(out_error); @@ -183,9 +184,9 @@ void CopyResultsFromSearchMetadataCallback( } void CopyResultsFromOpenFileCallbackAndQuit(DriveFileError* out_error, - FilePath* out_file_path, + base::FilePath* out_file_path, DriveFileError error, - const FilePath& file_path) { + const base::FilePath& file_path) { *out_error = error; *out_file_path = file_path; MessageLoop::current()->Quit(); diff --git a/chrome/browser/chromeos/drive/drive_webapps_registry.cc b/chrome/browser/chromeos/drive/drive_webapps_registry.cc index 9813d53..0da55eb 100644 --- a/chrome/browser/chromeos/drive/drive_webapps_registry.cc +++ b/chrome/browser/chromeos/drive/drive_webapps_registry.cc @@ -31,8 +31,8 @@ std::string GetWebStoreIdFromUrl(const GURL& url) { return std::string(); } - FilePath path(url.path()); - std::vector<FilePath::StringType> components; + base::FilePath path(url.path()); + std::vector<base::FilePath::StringType> components; path.GetComponents(&components); DCHECK_LE(2U, components.size()); // Coming from kStoreProductUrl @@ -101,14 +101,14 @@ DriveWebAppsRegistry::~DriveWebAppsRegistry() { } void DriveWebAppsRegistry::GetWebAppsForFile( - const FilePath& file, + const base::FilePath& file, const std::string& mime_type, ScopedVector<DriveWebAppInfo>* apps) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); SelectorWebAppList result_map; if (!file.empty()) { - FilePath::StringType extension = file.Extension(); + base::FilePath::StringType extension = file.Extension(); if (extension.size() < 2) return; diff --git a/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc b/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc index fff37b3..90f8604 100644 --- a/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc @@ -92,14 +92,14 @@ TEST_F(DriveWebAppsRegistryTest, LoadAndFindWebApps) { // Find by extension 'ext_1'. ScopedVector<DriveWebAppInfo> ext_1_results; - FilePath ext1_file(FILE_PATH_LITERAL("gdata/SampleFile.ext_1")); + base::FilePath ext1_file(FILE_PATH_LITERAL("gdata/SampleFile.ext_1")); web_apps->GetWebAppsForFile(ext1_file, std::string(), &ext_1_results); ASSERT_EQ(1U, ext_1_results.size()); EXPECT_TRUE(VerifyApp1(ext_1_results, true)); // Find by extension 'ext_3'. ScopedVector<DriveWebAppInfo> ext_3_results; - FilePath ext3_file(FILE_PATH_LITERAL("gdata/AnotherFile.ext_3")); + base::FilePath ext3_file(FILE_PATH_LITERAL("gdata/AnotherFile.ext_3")); web_apps->GetWebAppsForFile(ext3_file, std::string(), &ext_3_results); ASSERT_EQ(2U, ext_3_results.size()); EXPECT_TRUE(VerifyApp1(ext_3_results, false)); @@ -107,14 +107,14 @@ TEST_F(DriveWebAppsRegistryTest, LoadAndFindWebApps) { // Find by mimetype 'ext_3'. ScopedVector<DriveWebAppInfo> mime_results; - web_apps->GetWebAppsForFile(FilePath(), "application/test_type_2", + web_apps->GetWebAppsForFile(base::FilePath(), "application/test_type_2", &mime_results); ASSERT_EQ(1U, mime_results.size()); EXPECT_TRUE(VerifyApp2(mime_results, true)); // Find by extension and mimetype. ScopedVector<DriveWebAppInfo> mime_ext_results; - FilePath mime_file(FILE_PATH_LITERAL("gdata/MimeFile.ext_2")); + base::FilePath mime_file(FILE_PATH_LITERAL("gdata/MimeFile.ext_2")); web_apps->GetWebAppsForFile(mime_file, "application/test_type_2", &mime_ext_results); ASSERT_EQ(2U, mime_ext_results.size()); @@ -137,7 +137,7 @@ TEST_F(DriveWebAppsRegistryTest, LoadAndFindDriveWebApps) { // Find by primary extension 'exe'. ScopedVector<DriveWebAppInfo> ext_results; - FilePath ext_file(FILE_PATH_LITERAL("drive/file.exe")); + base::FilePath ext_file(FILE_PATH_LITERAL("drive/file.exe")); web_apps->GetWebAppsForFile(ext_file, std::string(), &ext_results); ASSERT_EQ(1U, ext_results.size()); VerifyApp(ext_results, "abcdefghabcdefghabcdefghabcdefgh", "123456788192", @@ -145,7 +145,7 @@ TEST_F(DriveWebAppsRegistryTest, LoadAndFindDriveWebApps) { // Find by primary MIME type. ScopedVector<DriveWebAppInfo> primary_app; - web_apps->GetWebAppsForFile(FilePath(), + web_apps->GetWebAppsForFile(base::FilePath(), "application/vnd.google-apps.drive-sdk.123456788192", &primary_app); ASSERT_EQ(1U, primary_app.size()); VerifyApp(primary_app, "abcdefghabcdefghabcdefghabcdefgh", "123456788192", @@ -153,7 +153,7 @@ TEST_F(DriveWebAppsRegistryTest, LoadAndFindDriveWebApps) { // Find by secondary MIME type. ScopedVector<DriveWebAppInfo> secondary_app; - web_apps->GetWebAppsForFile(FilePath(), "text/html", &secondary_app); + web_apps->GetWebAppsForFile(base::FilePath(), "text/html", &secondary_app); ASSERT_EQ(1U, secondary_app.size()); VerifyApp(secondary_app, "abcdefghabcdefghabcdefghabcdefgh", "123456788192", "Drive app 1", "", false); diff --git a/chrome/browser/chromeos/drive/file_change.cc b/chrome/browser/chromeos/drive/file_change.cc index a4e6ee9..cc3c9aa 100644 --- a/chrome/browser/chromeos/drive/file_change.cc +++ b/chrome/browser/chromeos/drive/file_change.cc @@ -6,14 +6,15 @@ namespace drive { -FileChange::FileChange(const FilePath& path, Type type) +FileChange::FileChange(const base::FilePath& path, Type type) : path_(path), type_(type) { } FileChange::~FileChange() {} // static -FileChangeSet FileChange::CreateSingleSet(const FilePath& path, Type type) { +FileChangeSet FileChange::CreateSingleSet(const base::FilePath& path, + Type type) { FileChangeSet result; result.insert(FileChange(path, type)); return result; diff --git a/chrome/browser/chromeos/drive/file_change.h b/chrome/browser/chromeos/drive/file_change.h index f24cdc9..b9880e9 100644 --- a/chrome/browser/chromeos/drive/file_change.h +++ b/chrome/browser/chromeos/drive/file_change.h @@ -29,11 +29,11 @@ class FileChange { // Created an object representing a change of file or directory pointed by // |change_path|. The change is of |change_type| type. - FileChange(const FilePath& path, Type type); + FileChange(const base::FilePath& path, Type type); ~FileChange(); // Factory method to create a FileChangeSet object with only one element. - static FileChangeSet CreateSingleSet(const FilePath& path, Type type); + static FileChangeSet CreateSingleSet(const base::FilePath& path, Type type); bool operator==(const FileChange &file_change) const { return path_ == file_change.path() && type_ == file_change.type(); @@ -44,12 +44,12 @@ class FileChange { (path_ == file_change.path() && type_ < file_change.type()); } - const FilePath& path() const { return path_; } + const base::FilePath& path() const { return path_; } Type type() const { return type_; } private: - const FilePath path_; + const base::FilePath path_; const Type type_; }; diff --git a/chrome/browser/chromeos/drive/file_change_unittest.cc b/chrome/browser/chromeos/drive/file_change_unittest.cc index 1912a5c..619f37f 100644 --- a/chrome/browser/chromeos/drive/file_change_unittest.cc +++ b/chrome/browser/chromeos/drive/file_change_unittest.cc @@ -8,7 +8,7 @@ namespace drive { TEST(FileChangeTest, Getters) { - FilePath change_path(FILE_PATH_LITERAL("test")); + base::FilePath change_path(FILE_PATH_LITERAL("test")); FileChange::Type change_type = FileChange::ADDED; FileChange file_change(change_path, change_type); @@ -18,7 +18,7 @@ TEST(FileChangeTest, Getters) { } TEST(FileChangeTest, FactoryMethod) { - FilePath change_path(FILE_PATH_LITERAL("a/b/c/d")); + base::FilePath change_path(FILE_PATH_LITERAL("a/b/c/d")); FileChange::Type change_type = FileChange::CHANGED; FileChangeSet changed_files = @@ -34,38 +34,38 @@ TEST(FileChangeTest, FactoryMethod) { TEST(FileChangeTest, Equals) { // Change is equal if and only if both path and type are equal. // Paths differ, types are equal. - FileChange file_change1(FilePath(FILE_PATH_LITERAL("a")), + FileChange file_change1(base::FilePath(FILE_PATH_LITERAL("a")), FileChange::ADDED); - FileChange file_change2(FilePath(FILE_PATH_LITERAL("b")), + FileChange file_change2(base::FilePath(FILE_PATH_LITERAL("b")), FileChange::ADDED); EXPECT_EQ(file_change1, file_change1); EXPECT_FALSE(file_change1 == file_change2); // Paths are equal, types differ. - FileChange file_change3(FilePath(FILE_PATH_LITERAL("a")), + FileChange file_change3(base::FilePath(FILE_PATH_LITERAL("a")), FileChange::DELETED); - FileChange file_change4(FilePath(FILE_PATH_LITERAL("a")), + FileChange file_change4(base::FilePath(FILE_PATH_LITERAL("a")), FileChange::CHANGED); EXPECT_FALSE(file_change3 == file_change4); // Paths and types are equal. - FileChange file_change5(FilePath(FILE_PATH_LITERAL("c")), + FileChange file_change5(base::FilePath(FILE_PATH_LITERAL("c")), FileChange::ADDED); - FileChange file_change6(FilePath(FILE_PATH_LITERAL("c")), + FileChange file_change6(base::FilePath(FILE_PATH_LITERAL("c")), FileChange::ADDED); EXPECT_EQ(file_change5, file_change6); } TEST(FileChangeTest, Compare) { - FileChange file_change1(FilePath(FILE_PATH_LITERAL("a")), + FileChange file_change1(base::FilePath(FILE_PATH_LITERAL("a")), FileChange::DELETED); - FileChange file_change2(FilePath(FILE_PATH_LITERAL("a")), + FileChange file_change2(base::FilePath(FILE_PATH_LITERAL("a")), FileChange::ADDED); - FileChange file_change3(FilePath(FILE_PATH_LITERAL("a")), + FileChange file_change3(base::FilePath(FILE_PATH_LITERAL("a")), FileChange::CHANGED); - FileChange file_change4(FilePath(FILE_PATH_LITERAL("b")), + FileChange file_change4(base::FilePath(FILE_PATH_LITERAL("b")), FileChange::ADDED); - FileChange file_change5(FilePath(FILE_PATH_LITERAL("c")), + FileChange file_change5(base::FilePath(FILE_PATH_LITERAL("c")), FileChange::DELETED); // Comparison operator should not return true for equal values. diff --git a/chrome/browser/chromeos/drive/file_system/copy_operation.cc b/chrome/browser/chromeos/drive/file_system/copy_operation.cc index 75d422e..798f64c 100644 --- a/chrome/browser/chromeos/drive/file_system/copy_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/copy_operation.cc @@ -34,8 +34,9 @@ const char kMimeTypeOctetStream[] = "application/octet-stream"; // Copies a file from |src_file_path| to |dest_file_path| on the local // file system using file_util::CopyFile. // Returns DRIVE_FILE_OK on success or DRIVE_FILE_ERROR_FAILED otherwise. -DriveFileError CopyLocalFileOnBlockingPool(const FilePath& src_file_path, - const FilePath& dest_file_path) { +DriveFileError CopyLocalFileOnBlockingPool( + const base::FilePath& src_file_path, + const base::FilePath& dest_file_path) { return file_util::CopyFile(src_file_path, dest_file_path) ? DRIVE_FILE_OK : DRIVE_FILE_ERROR_FAILED; } @@ -44,7 +45,7 @@ DriveFileError CopyLocalFileOnBlockingPool(const FilePath& src_file_path, // hosted document on blocking pool, and if so, gets the resource ID of the // document. std::string GetDocumentResourceIdOnBlockingPool( - const FilePath& local_file_path) { + const base::FilePath& local_file_path) { std::string result; if (ResourceEntry::HasHostedDocumentExtension(local_file_path)) { std::string error; @@ -61,15 +62,15 @@ std::string GetDocumentResourceIdOnBlockingPool( // CopyOperation::StartFileUploadParams implementation. struct CopyOperation::StartFileUploadParams { - StartFileUploadParams(const FilePath& in_local_file_path, - const FilePath& in_remote_file_path, + StartFileUploadParams(const base::FilePath& in_local_file_path, + const base::FilePath& in_remote_file_path, const FileOperationCallback& in_callback) : local_file_path(in_local_file_path), remote_file_path(in_remote_file_path), callback(in_callback) {} - const FilePath local_file_path; - const FilePath remote_file_path; + const base::FilePath local_file_path; + const base::FilePath remote_file_path; const FileOperationCallback callback; }; @@ -97,8 +98,8 @@ CopyOperation::~CopyOperation() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); } -void CopyOperation::Copy(const FilePath& src_file_path, - const FilePath& dest_file_path, +void CopyOperation::Copy(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) { BrowserThread::CurrentlyOn(BrowserThread::UI); DCHECK(!callback.is_null()); @@ -113,8 +114,8 @@ void CopyOperation::Copy(const FilePath& src_file_path, } void CopyOperation::TransferFileFromRemoteToLocal( - const FilePath& remote_src_file_path, - const FilePath& local_dest_file_path, + const base::FilePath& remote_src_file_path, + const base::FilePath& local_dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -128,10 +129,10 @@ void CopyOperation::TransferFileFromRemoteToLocal( } void CopyOperation::OnGetFileCompleteForTransferFile( - const FilePath& local_dest_file_path, + const base::FilePath& local_dest_file_path, const FileOperationCallback& callback, DriveFileError error, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const std::string& unused_mime_type, DriveFileType file_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -155,8 +156,8 @@ void CopyOperation::OnGetFileCompleteForTransferFile( } void CopyOperation::TransferFileFromLocalToRemote( - const FilePath& local_src_file_path, - const FilePath& remote_dest_file_path, + const base::FilePath& local_src_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -173,8 +174,8 @@ void CopyOperation::TransferFileFromLocalToRemote( } void CopyOperation::TransferRegularFile( - const FilePath& local_file_path, - const FilePath& remote_dest_file_path, + const base::FilePath& local_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -195,16 +196,16 @@ void CopyOperation::TransferRegularFile( } void CopyOperation::CopyHostedDocumentToDirectory( - const FilePath& dir_path, + const base::FilePath& dir_path, const std::string& resource_id, - const FilePath::StringType& new_name, + const base::FilePath::StringType& new_name, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); drive_scheduler_->CopyHostedDocument( resource_id, - FilePath(new_name).AsUTF8Unsafe(), + base::FilePath(new_name).AsUTF8Unsafe(), base::Bind(&CopyOperation::OnCopyHostedDocumentCompleted, weak_ptr_factory_.GetWeakPtr(), dir_path, @@ -212,7 +213,7 @@ void CopyOperation::CopyHostedDocumentToDirectory( } void CopyOperation::OnCopyHostedDocumentCompleted( - const FilePath& dir_path, + const base::FilePath& dir_path, const FileOperationCallback& callback, GDataErrorCode status, scoped_ptr<google_apis::ResourceEntry> resource_entry) { @@ -230,7 +231,7 @@ void CopyOperation::OnCopyHostedDocumentCompleted( // first add it to |root_| to mirror the state and then move it to the // destination directory by MoveEntryFromRootDirectory(). metadata_->AddEntryToDirectory( - FilePath(kDriveRootDirectory), + base::FilePath(kDriveRootDirectory), resource_entry.Pass(), base::Bind(&CopyOperation::MoveEntryFromRootDirectory, weak_ptr_factory_.GetWeakPtr(), @@ -239,17 +240,17 @@ void CopyOperation::OnCopyHostedDocumentCompleted( } void CopyOperation::MoveEntryFromRootDirectory( - const FilePath& directory_path, + const base::FilePath& directory_path, const FileOperationCallback& callback, DriveFileError error, - const FilePath& file_path) { + const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); DCHECK_EQ(kDriveRootDirectory, file_path.DirName().value()); // Return if there is an error or |dir_path| is the root directory. if (error != DRIVE_FILE_OK || - directory_path == FilePath(kDriveRootDirectory)) { + directory_path == base::FilePath(kDriveRootDirectory)) { callback.Run(error); return; } @@ -260,7 +261,7 @@ void CopyOperation::MoveEntryFromRootDirectory( } void CopyOperation::CopyAfterGetEntryInfoPair( - const FilePath& dest_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback, scoped_ptr<EntryInfoPairResult> result) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -301,7 +302,7 @@ void CopyOperation::CopyAfterGetEntryInfoPair( // TODO(kochi): Reimplement this once the server API supports // copying of regular files directly on the server side. crbug.com/138273 - const FilePath& src_file_path = result->first.path; + const base::FilePath& src_file_path = result->first.path; drive_file_system_->GetFileByPath( src_file_path, base::Bind(&CopyOperation::OnGetFileCompleteForCopy, @@ -311,10 +312,10 @@ void CopyOperation::CopyAfterGetEntryInfoPair( } void CopyOperation::OnGetFileCompleteForCopy( - const FilePath& remote_dest_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback, DriveFileError error, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const std::string& unused_mime_type, DriveFileType file_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -375,8 +376,8 @@ void CopyOperation::StartFileUploadAfterGetEntryInfo( void CopyOperation::OnTransferCompleted( const FileOperationCallback& callback, google_apis::DriveUploadError error, - const FilePath& drive_path, - const FilePath& file_path, + const base::FilePath& drive_path, + const base::FilePath& file_path, scoped_ptr<ResourceEntry> resource_entry) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -392,8 +393,8 @@ void CopyOperation::OnTransferCompleted( } void CopyOperation::TransferFileFromLocalToRemoteAfterGetEntryInfo( - const FilePath& local_src_file_path, - const FilePath& remote_dest_file_path, + const base::FilePath& local_src_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -424,8 +425,8 @@ void CopyOperation::TransferFileFromLocalToRemoteAfterGetEntryInfo( } void CopyOperation::TransferFileForResourceId( - const FilePath& local_file_path, - const FilePath& remote_dest_file_path, + const base::FilePath& local_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback, const std::string& resource_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); diff --git a/chrome/browser/chromeos/drive/file_system/drive_operations.cc b/chrome/browser/chromeos/drive/file_system/drive_operations.cc index 7cf8952..5db8ae0 100644 --- a/chrome/browser/chromeos/drive/file_system/drive_operations.cc +++ b/chrome/browser/chromeos/drive/file_system/drive_operations.cc @@ -71,8 +71,8 @@ void DriveOperations::InitForTesting(CopyOperation* copy_operation, update_operation_.reset(update_operation); } -void DriveOperations::Copy(const FilePath& src_file_path, - const FilePath& dest_file_path, +void DriveOperations::Copy(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -81,8 +81,8 @@ void DriveOperations::Copy(const FilePath& src_file_path, } void DriveOperations::TransferFileFromRemoteToLocal( - const FilePath& remote_src_file_path, - const FilePath& local_dest_file_path, + const base::FilePath& remote_src_file_path, + const base::FilePath& local_dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -93,8 +93,8 @@ void DriveOperations::TransferFileFromRemoteToLocal( } void DriveOperations::TransferFileFromLocalToRemote( - const FilePath& local_src_file_path, - const FilePath& remote_dest_file_path, + const base::FilePath& local_src_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -105,8 +105,8 @@ void DriveOperations::TransferFileFromLocalToRemote( } void DriveOperations::TransferRegularFile( - const FilePath& local_src_file_path, - const FilePath& remote_dest_file_path, + const base::FilePath& local_src_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -117,7 +117,7 @@ void DriveOperations::TransferRegularFile( } void DriveOperations::CreateDirectory( - const FilePath& directory_path, + const base::FilePath& directory_path, bool is_exclusive, bool is_recursive, const FileOperationCallback& callback) { @@ -128,8 +128,8 @@ void DriveOperations::CreateDirectory( directory_path, is_exclusive, is_recursive, callback); } -void DriveOperations::Move(const FilePath& src_file_path, - const FilePath& dest_file_path, +void DriveOperations::Move(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -137,7 +137,7 @@ void DriveOperations::Move(const FilePath& src_file_path, move_operation_->Move(src_file_path, dest_file_path, callback); } -void DriveOperations::Remove(const FilePath& file_path, +void DriveOperations::Remove(const base::FilePath& file_path, bool is_recursive, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); diff --git a/chrome/browser/chromeos/drive/file_system/move_operation.cc b/chrome/browser/chromeos/drive/file_system/move_operation.cc index 138eef6..f0248ef 100644 --- a/chrome/browser/chromeos/drive/file_system/move_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/move_operation.cc @@ -31,8 +31,8 @@ MoveOperation::~MoveOperation() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); } -void MoveOperation::Move(const FilePath& src_file_path, - const FilePath& dest_file_path, +void MoveOperation::Move(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -47,7 +47,7 @@ void MoveOperation::Move(const FilePath& src_file_path, } void MoveOperation::MoveAfterGetEntryInfoPair( - const FilePath& dest_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback, scoped_ptr<EntryInfoPairResult> result) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -69,8 +69,8 @@ void MoveOperation::MoveAfterGetEntryInfoPair( } // If the file/directory is moved to the same directory, just rename it. - const FilePath& src_file_path = result->first.path; - const FilePath& dest_parent_path = result->second.path; + const base::FilePath& src_file_path = result->first.path; + const base::FilePath& dest_parent_path = result->second.path; DCHECK_EQ(dest_parent_path.value(), dest_file_path.DirName().value()); if (src_file_path.DirName() == dest_parent_path) { FileMoveCallback final_file_path_update_callback = @@ -113,15 +113,15 @@ void MoveOperation::MoveAfterGetEntryInfoPair( void MoveOperation::OnFilePathUpdated(const FileOperationCallback& callback, DriveFileError error, - const FilePath& /* file_path */) { + const base::FilePath& /* file_path */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); callback.Run(error); } -void MoveOperation::Rename(const FilePath& file_path, - const FilePath::StringType& new_name, +void MoveOperation::Rename(const base::FilePath& file_path, + const base::FilePath::StringType& new_name, const FileMoveCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -144,8 +144,8 @@ void MoveOperation::Rename(const FilePath& file_path, } void MoveOperation::RenameAfterGetEntryInfo( - const FilePath& file_path, - const FilePath::StringType& new_name, + const base::FilePath& file_path, + const base::FilePath::StringType& new_name, const FileMoveCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -161,10 +161,10 @@ void MoveOperation::RenameAfterGetEntryInfo( // Drop the .g<something> extension from |new_name| if the file being // renamed is a hosted document and |new_name| has the same .g<something> // extension as the file. - FilePath::StringType file_name = new_name; + base::FilePath::StringType file_name = new_name; if (entry_proto->has_file_specific_info() && entry_proto->file_specific_info().is_hosted_document()) { - FilePath new_file(file_name); + base::FilePath new_file(file_name); if (new_file.Extension() == entry_proto->file_specific_info().document_extension()) { file_name = new_file.RemoveExtension().value(); @@ -173,7 +173,7 @@ void MoveOperation::RenameAfterGetEntryInfo( drive_scheduler_->RenameResource( entry_proto->resource_id(), - FilePath(file_name).AsUTF8Unsafe(), + base::FilePath(file_name).AsUTF8Unsafe(), base::Bind(&MoveOperation::RenameEntryLocally, weak_ptr_factory_.GetWeakPtr(), file_path, @@ -182,8 +182,8 @@ void MoveOperation::RenameAfterGetEntryInfo( } void MoveOperation::RenameEntryLocally( - const FilePath& file_path, - const FilePath::StringType& new_name, + const base::FilePath& file_path, + const base::FilePath::StringType& new_name, const FileMoveCallback& callback, google_apis::GDataErrorCode status) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -191,7 +191,7 @@ void MoveOperation::RenameEntryLocally( const DriveFileError error = util::GDataToDriveFileError(status); if (error != DRIVE_FILE_OK) { - callback.Run(error, FilePath()); + callback.Run(error, base::FilePath()); return; } @@ -206,7 +206,7 @@ void MoveOperation::RenameEntryLocally( void MoveOperation::RemoveEntryFromDirectory( const FileMoveCallback& callback, DriveFileError error, - const FilePath& file_path) { + const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -226,7 +226,7 @@ void MoveOperation::RemoveEntryFromDirectoryAfterEntryInfoPair( DCHECK(!callback.is_null()); DCHECK(result.get()); - const FilePath& file_path = result->first.path; + const base::FilePath& file_path = result->first.path; if (result->first.error != DRIVE_FILE_OK) { callback.Run(result->first.error, file_path); return; @@ -250,7 +250,7 @@ void MoveOperation::RemoveEntryFromDirectoryAfterEntryInfoPair( base::Bind(&MoveOperation::MoveEntryToDirectory, weak_ptr_factory_.GetWeakPtr(), file_path, - FilePath(kDriveRootDirectory), + base::FilePath(kDriveRootDirectory), base::Bind(&MoveOperation::NotifyAndRunFileMoveCallback, weak_ptr_factory_.GetWeakPtr(), callback))); @@ -258,10 +258,10 @@ void MoveOperation::RemoveEntryFromDirectoryAfterEntryInfoPair( // TODO(zork): Share with CopyOperation. // See: crbug.com/150050 -void MoveOperation::AddEntryToDirectory(const FilePath& directory_path, +void MoveOperation::AddEntryToDirectory(const base::FilePath& directory_path, const FileOperationCallback& callback, DriveFileError error, - const FilePath& file_path) { + const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -299,8 +299,8 @@ void MoveOperation::AddEntryToDirectoryAfterGetEntryInfoPair( return; } - const FilePath& file_path = result->first.path; - const FilePath& dir_path = result->second.path; + const base::FilePath& file_path = result->first.path; + const base::FilePath& dir_path = result->second.path; drive_scheduler_->AddResourceToDirectory( dir_proto->resource_id(), src_proto->resource_id(), @@ -316,8 +316,8 @@ void MoveOperation::AddEntryToDirectoryAfterGetEntryInfoPair( // TODO(zork): Share with CopyOperation. // See: crbug.com/150050 void MoveOperation::MoveEntryToDirectory( - const FilePath& file_path, - const FilePath& directory_path, + const base::FilePath& file_path, + const base::FilePath& directory_path, const FileMoveCallback& callback, google_apis::GDataErrorCode status) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -325,7 +325,7 @@ void MoveOperation::MoveEntryToDirectory( const DriveFileError error = util::GDataToDriveFileError(status); if (error != DRIVE_FILE_OK) { - callback.Run(error, FilePath()); + callback.Run(error, base::FilePath()); return; } @@ -337,7 +337,7 @@ void MoveOperation::MoveEntryToDirectory( void MoveOperation::NotifyAndRunFileOperationCallback( const FileOperationCallback& callback, DriveFileError error, - const FilePath& moved_file_path) { + const base::FilePath& moved_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -350,7 +350,7 @@ void MoveOperation::NotifyAndRunFileOperationCallback( void MoveOperation::NotifyAndRunFileMoveCallback( const FileMoveCallback& callback, DriveFileError error, - const FilePath& moved_file_path) { + const base::FilePath& moved_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); diff --git a/chrome/browser/chromeos/drive/file_system/remove_operation.cc b/chrome/browser/chromeos/drive/file_system/remove_operation.cc index 99d651b..9879b7b 100644 --- a/chrome/browser/chromeos/drive/file_system/remove_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/remove_operation.cc @@ -40,7 +40,7 @@ RemoveOperation::~RemoveOperation() { } void RemoveOperation::Remove( - const FilePath& file_path, + const base::FilePath& file_path, bool is_recursive, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -101,7 +101,7 @@ void RemoveOperation::RemoveResourceLocally( void RemoveOperation::NotifyDirectoryChanged( const FileOperationCallback& callback, DriveFileError error, - const FilePath& directory_path) { + const base::FilePath& directory_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); diff --git a/chrome/browser/chromeos/drive/file_system/update_operation.cc b/chrome/browser/chromeos/drive/file_system/update_operation.cc index e1c9c44..b88cd2a 100644 --- a/chrome/browser/chromeos/drive/file_system/update_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/update_operation.cc @@ -55,7 +55,7 @@ void UpdateOperation::UpdateFileByResourceId( void UpdateOperation::UpdateFileByEntryInfo( const FileOperationCallback& callback, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -84,10 +84,10 @@ void UpdateOperation::UpdateFileByEntryInfo( void UpdateOperation::OnGetFileCompleteForUpdateFile( const FileOperationCallback& callback, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto, DriveFileError error, - const FilePath& cache_file_path) { + const base::FilePath& cache_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -110,8 +110,8 @@ void UpdateOperation::OnGetFileCompleteForUpdateFile( void UpdateOperation::OnUpdatedFileUploaded( const FileOperationCallback& callback, google_apis::DriveUploadError error, - const FilePath& drive_path, - const FilePath& file_path, + const base::FilePath& drive_path, + const base::FilePath& file_path, scoped_ptr<google_apis::ResourceEntry> resource_entry) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -131,7 +131,7 @@ void UpdateOperation::OnUpdatedFileUploaded( void UpdateOperation::OnUpdatedFileRefreshed( const FileOperationCallback& callback, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); diff --git a/chrome/browser/chromeos/drive/file_write_helper.cc b/chrome/browser/chromeos/drive/file_write_helper.cc index 8b890b6..39126e6 100644 --- a/chrome/browser/chromeos/drive/file_write_helper.cc +++ b/chrome/browser/chromeos/drive/file_write_helper.cc @@ -14,7 +14,7 @@ namespace drive { namespace { // Emits debug log when DriveFileSystem::CloseFile() is complete. -void EmitDebugLogForCloseFile(const FilePath& file_path, +void EmitDebugLogForCloseFile(const base::FilePath& file_path, DriveFileError file_error) { if (file_error != DRIVE_FILE_OK) { LOG(WARNING) << "CloseFile failed: " << file_path.AsUTF8Unsafe() << ": " @@ -37,7 +37,7 @@ FileWriteHelper::~FileWriteHelper() { } void FileWriteHelper::PrepareWritableFileAndRun( - const FilePath& file_path, + const base::FilePath& file_path, const OpenFileCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -52,7 +52,7 @@ void FileWriteHelper::PrepareWritableFileAndRun( } void FileWriteHelper::PrepareWritableFileAndRunAfterCreateFile( - const FilePath& file_path, + const base::FilePath& file_path, const OpenFileCallback& callback, DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -61,7 +61,7 @@ void FileWriteHelper::PrepareWritableFileAndRunAfterCreateFile( if (error != DRIVE_FILE_OK) { content::BrowserThread::GetBlockingPool()->PostTask( FROM_HERE, - base::Bind(callback, error, FilePath())); + base::Bind(callback, error, base::FilePath())); return; } file_system_->OpenFile( @@ -73,17 +73,17 @@ void FileWriteHelper::PrepareWritableFileAndRunAfterCreateFile( } void FileWriteHelper::PrepareWritableFileAndRunAfterOpenFile( - const FilePath& file_path, + const base::FilePath& file_path, const OpenFileCallback& callback, DriveFileError error, - const FilePath& local_cache_path) { + const base::FilePath& local_cache_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); if (error != DRIVE_FILE_OK) { content::BrowserThread::GetBlockingPool()->PostTask( FROM_HERE, - base::Bind(callback, error, FilePath())); + base::Bind(callback, error, base::FilePath())); return; } @@ -96,7 +96,7 @@ void FileWriteHelper::PrepareWritableFileAndRunAfterOpenFile( } void FileWriteHelper::PrepareWritableFileAndRunAfterCallback( - const FilePath& file_path) { + const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); file_system_->CloseFile(file_path, base::Bind(&EmitDebugLogForCloseFile, file_path)); diff --git a/chrome/browser/chromeos/drive/file_write_helper_unittest.cc b/chrome/browser/chromeos/drive/file_write_helper_unittest.cc index f217180..594c8c0 100644 --- a/chrome/browser/chromeos/drive/file_write_helper_unittest.cc +++ b/chrome/browser/chromeos/drive/file_write_helper_unittest.cc @@ -37,9 +37,9 @@ ACTION_P(MockCloseFile, error) { } void RecordOpenFileCallbackArguments(DriveFileError* error, - FilePath* path, + base::FilePath* path, DriveFileError error_arg, - const FilePath& path_arg) { + const base::FilePath& path_arg) { base::ThreadRestrictions::AssertIOAllowed(); *error = error_arg; *path = path_arg; @@ -61,8 +61,8 @@ class FileWriteHelperTest : public testing::Test { }; TEST_F(FileWriteHelperTest, PrepareFileForWritingSuccess) { - const FilePath kDrivePath("/drive/file.txt"); - const FilePath kLocalPath("/tmp/dummy.txt"); + const base::FilePath kDrivePath("/drive/file.txt"); + const base::FilePath kLocalPath("/tmp/dummy.txt"); EXPECT_CALL(*mock_file_system_, CreateFile(kDrivePath, false, _)) .WillOnce(MockCreateFile(DRIVE_FILE_OK)); @@ -73,7 +73,7 @@ TEST_F(FileWriteHelperTest, PrepareFileForWritingSuccess) { FileWriteHelper file_write_helper(mock_file_system_.get()); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath path; + base::FilePath path; file_write_helper.PrepareWritableFileAndRun( kDrivePath, base::Bind(&RecordOpenFileCallbackArguments, &error, &path)); google_apis::test_util::RunBlockingPoolTask(); @@ -83,7 +83,7 @@ TEST_F(FileWriteHelperTest, PrepareFileForWritingSuccess) { } TEST_F(FileWriteHelperTest, PrepareFileForWritingCreateFail) { - const FilePath kDrivePath("/drive/file.txt"); + const base::FilePath kDrivePath("/drive/file.txt"); EXPECT_CALL(*mock_file_system_, CreateFile(kDrivePath, false, _)) .WillOnce(MockCreateFile(DRIVE_FILE_ERROR_ACCESS_DENIED)); @@ -92,33 +92,33 @@ TEST_F(FileWriteHelperTest, PrepareFileForWritingCreateFail) { FileWriteHelper file_write_helper(mock_file_system_.get()); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath path; + base::FilePath path; file_write_helper.PrepareWritableFileAndRun( kDrivePath, base::Bind(&RecordOpenFileCallbackArguments, &error, &path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_ACCESS_DENIED, error); - EXPECT_EQ(FilePath(), path); + EXPECT_EQ(base::FilePath(), path); } TEST_F(FileWriteHelperTest, PrepareFileForWritingOpenFail) { - const FilePath kDrivePath("/drive/file.txt"); + const base::FilePath kDrivePath("/drive/file.txt"); EXPECT_CALL(*mock_file_system_, CreateFile(kDrivePath, false, _)) .WillOnce(MockCreateFile(DRIVE_FILE_OK)); EXPECT_CALL(*mock_file_system_, OpenFile(kDrivePath, _)) - .WillOnce(MockOpenFile(DRIVE_FILE_ERROR_IN_USE, FilePath())); + .WillOnce(MockOpenFile(DRIVE_FILE_ERROR_IN_USE, base::FilePath())); EXPECT_CALL(*mock_file_system_, CloseFile(_, _)).Times(0); FileWriteHelper file_write_helper(mock_file_system_.get()); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath path; + base::FilePath path; file_write_helper.PrepareWritableFileAndRun( kDrivePath, base::Bind(&RecordOpenFileCallbackArguments, &error, &path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_IN_USE, error); - EXPECT_EQ(FilePath(), path); + EXPECT_EQ(base::FilePath(), path); } } // namespace drive diff --git a/chrome/browser/chromeos/drive/mock_directory_change_observer.h b/chrome/browser/chromeos/drive/mock_directory_change_observer.h index ba71384..65068c5 100644 --- a/chrome/browser/chromeos/drive/mock_directory_change_observer.h +++ b/chrome/browser/chromeos/drive/mock_directory_change_observer.h @@ -18,7 +18,7 @@ class MockDirectoryChangeObserver : public DriveFileSystemObserver { virtual ~MockDirectoryChangeObserver(); // DriveFileSystemInterface::Observer overrides. - MOCK_METHOD1(OnDirectoryChanged, void(const FilePath& directory_path)); + MOCK_METHOD1(OnDirectoryChanged, void(const base::FilePath& directory_path)); }; } // namespace drive diff --git a/chrome/browser/chromeos/drive/mock_drive_file_system.h b/chrome/browser/chromeos/drive/mock_drive_file_system.h index a0947bf..f1edb91 100644 --- a/chrome/browser/chromeos/drive/mock_drive_file_system.h +++ b/chrome/browser/chromeos/drive/mock_drive_file_system.h @@ -40,37 +40,37 @@ class MockDriveFileSystem : public DriveFileSystemInterface { const GURL& next_feed, const SearchCallback& callback)); MOCK_METHOD3(TransferFileFromRemoteToLocal, - void(const FilePath& local_src_file_path, - const FilePath& remote_dest_file_path, + void(const base::FilePath& local_src_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback)); MOCK_METHOD3(TransferFileFromLocalToRemote, - void(const FilePath& local_src_file_path, - const FilePath& remote_dest_file_path, + void(const base::FilePath& local_src_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback)); - MOCK_METHOD2(OpenFile, void(const FilePath& file_path, + MOCK_METHOD2(OpenFile, void(const base::FilePath& file_path, const OpenFileCallback& callback)); - MOCK_METHOD2(CloseFile, void(const FilePath& file_path, + MOCK_METHOD2(CloseFile, void(const base::FilePath& file_path, const FileOperationCallback& callback)); - MOCK_METHOD3(Copy, void(const FilePath& src_file_path, - const FilePath& dest_file_path, + MOCK_METHOD3(Copy, void(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback)); - MOCK_METHOD3(Move, void(const FilePath& src_file_path, - const FilePath& dest_file_path, + MOCK_METHOD3(Move, void(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback)); - MOCK_METHOD3(Remove, void(const FilePath& file_path, + MOCK_METHOD3(Remove, void(const base::FilePath& file_path, bool is_recursive, const FileOperationCallback& callback)); MOCK_METHOD4(CreateDirectory, - void(const FilePath& directory_path, + void(const base::FilePath& directory_path, bool is_exclusive, bool is_recursive, const FileOperationCallback& callback)); MOCK_METHOD3(CreateFile, - void(const FilePath& file_path, + void(const base::FilePath& file_path, bool is_exclusive, const FileOperationCallback& callback)); MOCK_METHOD2(GetFileByPath, - void(const FilePath& file_path, + void(const base::FilePath& file_path, const GetFileCallback& callback)); MOCK_METHOD3( GetFileByResourceId, @@ -80,19 +80,19 @@ class MockDriveFileSystem : public DriveFileSystemInterface { MOCK_METHOD2(UpdateFileByResourceId, void(const std::string& resource_id, const FileOperationCallback& callback)); - MOCK_METHOD2(GetEntryInfoByPath, void(const FilePath& file_path, + MOCK_METHOD2(GetEntryInfoByPath, void(const base::FilePath& file_path, const GetEntryInfoCallback& callback)); MOCK_METHOD2(ReadDirectoryByPath, - void(const FilePath& file_path, + void(const base::FilePath& file_path, const ReadDirectoryWithSettingCallback& callback)); MOCK_METHOD1(RequestDirectoryRefresh, - void(const FilePath& file_path)); + void(const base::FilePath& file_path)); MOCK_METHOD1(GetAvailableSpace, void(const GetAvailableSpaceCallback& callback)); // This function is not mockable by gmock because scoped_ptr is not supported. - virtual void AddUploadedFile(const FilePath& file, + virtual void AddUploadedFile(const base::FilePath& file, scoped_ptr<google_apis::ResourceEntry> entry, - const FilePath& file_content_path, + const base::FilePath& file_content_path, const FileOperationCallback& callback) OVERRIDE { } MOCK_METHOD1(GetMetadata, diff --git a/chrome/browser/chromeos/drive/search_metadata.cc b/chrome/browser/chromeos/drive/search_metadata.cc index ae4cd20..bc13d24 100644 --- a/chrome/browser/chromeos/drive/search_metadata.cc +++ b/chrome/browser/chromeos/drive/search_metadata.cc @@ -53,7 +53,7 @@ class SearchMetadataHelper { // Starts searching the local resource metadata by reading the root // directory. void Start() { - const FilePath root(kDriveRootDirectory); + const base::FilePath root(kDriveRootDirectory); ++num_pending_reads_; file_system_->ReadDirectoryByPath( root, @@ -66,7 +66,7 @@ class SearchMetadataHelper { private: // Called when a directory is read. Continues searching the local resource // metadata by recursively reading sub directories. - void DidReadDirectoryByPath(const FilePath& parent_path, + void DidReadDirectoryByPath(const base::FilePath& parent_path, DriveFileError error, bool hide_hosted_documents, scoped_ptr<DriveEntryProtoVector> entries) { @@ -82,8 +82,8 @@ class SearchMetadataHelper { --num_pending_reads_; for (size_t i = 0; i < entries->size(); ++i) { const DriveEntryProto& entry = entries->at(i); - const FilePath current_path = parent_path.Append( - FilePath::FromUTF8Unsafe(entry.base_name())); + const base::FilePath current_path = parent_path.Append( + base::FilePath::FromUTF8Unsafe(entry.base_name())); // Skip the hosted document if "hide hosted documents" setting is // enabled. if (hide_hosted_documents && diff --git a/chrome/browser/chromeos/drive/search_metadata.h b/chrome/browser/chromeos/drive/search_metadata.h index 2012f01..9cb7beb 100644 --- a/chrome/browser/chromeos/drive/search_metadata.h +++ b/chrome/browser/chromeos/drive/search_metadata.h @@ -14,7 +14,7 @@ namespace drive { // Struct to represent a search result for SearchMetadata(). struct MetadataSearchResult { - MetadataSearchResult(const FilePath& in_path, + MetadataSearchResult(const base::FilePath& in_path, const DriveEntryProto& in_entry_proto, const std::string& in_highlighted_base_name) : path(in_path), @@ -23,7 +23,7 @@ struct MetadataSearchResult { } // The two members are used to create FileEntry object. - FilePath path; + base::FilePath path; DriveEntryProto entry_proto; // The base name to be displayed in the UI. The parts matched the search diff --git a/chrome/browser/chromeos/drive/search_metadata_unittest.cc b/chrome/browser/chromeos/drive/search_metadata_unittest.cc index 6c4b2a4..20a86d8 100644 --- a/chrome/browser/chromeos/drive/search_metadata_unittest.cc +++ b/chrome/browser/chromeos/drive/search_metadata_unittest.cc @@ -89,9 +89,8 @@ TEST_F(SearchMetadataTest, SearchMetadata_RegularFile) { google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); ASSERT_EQ(1U, result->size()); - EXPECT_EQ( - FilePath::FromUTF8Unsafe("drive/Directory 1/SubDirectory File 1.txt"), - result->at(0).path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe( + "drive/Directory 1/SubDirectory File 1.txt"), result->at(0).path); } // This test checks if |FindAndHighlight| does case-insensitive search. @@ -111,9 +110,8 @@ TEST_F(SearchMetadataTest, SearchMetadata_CaseInsensitiveSearch) { google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); ASSERT_EQ(1U, result->size()); - EXPECT_EQ( - FilePath::FromUTF8Unsafe("drive/Directory 1/SubDirectory File 1.txt"), - result->at(0).path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe( + "drive/Directory 1/SubDirectory File 1.txt"), result->at(0).path); } TEST_F(SearchMetadataTest, SearchMetadata_RegularFiles) { @@ -139,12 +137,11 @@ TEST_F(SearchMetadataTest, SearchMetadata_RegularFiles) { // All base names should contain "File". EXPECT_EQ( - FilePath::FromUTF8Unsafe( + base::FilePath::FromUTF8Unsafe( "drive/Slash \xE2\x88\x95 in directory/Slash SubDir File.txt"), result->at(0).path); - EXPECT_EQ( - FilePath::FromUTF8Unsafe("drive/Directory 1/SubDirectory File 1.txt"), - result->at(1).path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe( + "drive/Directory 1/SubDirectory File 1.txt"), result->at(1).path); } TEST_F(SearchMetadataTest, SearchMetadata_AtMostOneFile) { @@ -164,7 +161,7 @@ TEST_F(SearchMetadataTest, SearchMetadata_AtMostOneFile) { EXPECT_EQ(DRIVE_FILE_OK, error); ASSERT_EQ(1U, result->size()); EXPECT_EQ( - FilePath::FromUTF8Unsafe( + base::FilePath::FromUTF8Unsafe( "drive/Slash \xE2\x88\x95 in directory/Slash SubDir File.txt"), result->at(0).path); } @@ -184,7 +181,7 @@ TEST_F(SearchMetadataTest, SearchMetadata_Directory) { EXPECT_EQ(DRIVE_FILE_OK, error); ASSERT_EQ(1U, result->size()); EXPECT_EQ( - FilePath::FromUTF8Unsafe("drive/Directory 1"), + base::FilePath::FromUTF8Unsafe("drive/Directory 1"), result->at(0).path); } @@ -203,7 +200,7 @@ TEST_F(SearchMetadataTest, SearchMetadata_HostedDocument) { EXPECT_EQ(DRIVE_FILE_OK, error); ASSERT_EQ(1U, result->size()); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/Document 1.gdoc"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/Document 1.gdoc"), result->at(0).path); } diff --git a/chrome/browser/chromeos/drive/stale_cache_files_remover.cc b/chrome/browser/chromeos/drive/stale_cache_files_remover.cc index f444707..a6fb378 100644 --- a/chrome/browser/chromeos/drive/stale_cache_files_remover.cc +++ b/chrome/browser/chromeos/drive/stale_cache_files_remover.cc @@ -69,7 +69,7 @@ void StaleCacheFilesRemover::RemoveCacheIfNecessary( const std::string& resource_id, const std::string& cache_md5, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); diff --git a/chrome/browser/chromeos/drive/stale_cache_files_remover.h b/chrome/browser/chromeos/drive/stale_cache_files_remover.h index 5c34328..d3f4350 100644 --- a/chrome/browser/chromeos/drive/stale_cache_files_remover.h +++ b/chrome/browser/chromeos/drive/stale_cache_files_remover.h @@ -46,7 +46,7 @@ class StaleCacheFilesRemover : public DriveFileSystemObserver { const std::string& resource_id, const std::string& cache_md5, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto); DriveCache* cache_; // Not owned. diff --git a/chrome/browser/chromeos/drive/stale_cache_files_remover_unittest.cc b/chrome/browser/chromeos/drive/stale_cache_files_remover_unittest.cc index fabff76..f6e2f57 100644 --- a/chrome/browser/chromeos/drive/stale_cache_files_remover_unittest.cc +++ b/chrome/browser/chromeos/drive/stale_cache_files_remover_unittest.cc @@ -133,7 +133,7 @@ class StaleCacheFilesRemoverTest : public testing::Test { }; TEST_F(StaleCacheFilesRemoverTest, RemoveStaleCacheFiles) { - FilePath dummy_file = + base::FilePath dummy_file = google_apis::test_util::GetTestFilePath("gdata/root_feed.json"); std::string resource_id("pdf:1a2b3c"); std::string md5("abcdef0123456789"); @@ -149,13 +149,13 @@ TEST_F(StaleCacheFilesRemoverTest, RemoveStaleCacheFiles) { EXPECT_EQ(DRIVE_FILE_OK, error); // Verify that the cache file exists. - FilePath path = cache_->GetCacheFilePath(resource_id, + base::FilePath path = cache_->GetCacheFilePath(resource_id, md5, DriveCache::CACHE_TYPE_TMP, DriveCache::CACHED_FILE_FROM_SERVER); EXPECT_TRUE(file_util::PathExists(path)); - FilePath unused; + base::FilePath unused; scoped_ptr<DriveEntryProto> entry_proto; file_system_->GetEntryInfoByResourceId( resource_id, diff --git a/chrome/browser/chromeos/enterprise_extension_observer.cc b/chrome/browser/chromeos/enterprise_extension_observer.cc index 63ac62e..add3b7f 100644 --- a/chrome/browser/chromeos/enterprise_extension_observer.cc +++ b/chrome/browser/chromeos/enterprise_extension_observer.cc @@ -50,7 +50,7 @@ void EnterpriseExtensionObserver::Observe( // static void EnterpriseExtensionObserver::CheckExtensionAndNotifyEntd( - const FilePath& path) { + const base::FilePath& path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); if (file_util::PathExists( path.Append(FILE_PATH_LITERAL("isa-cros-policy")))) { diff --git a/chrome/browser/chromeos/extensions/default_app_order.cc b/chrome/browser/chromeos/extensions/default_app_order.cc index 3d3e06a..d9acdc5 100644 --- a/chrome/browser/chromeos/extensions/default_app_order.cc +++ b/chrome/browser/chromeos/extensions/default_app_order.cc @@ -26,7 +26,7 @@ ExternalLoader* loader_instance = NULL; // Reads external ordinal json file and returned the parsed value. Returns NULL // if the file does not exist or could not be parsed properly. Caller takes // ownership of the returned value. -base::ListValue* ReadExternalOrdinalFile(const FilePath& path) { +base::ListValue* ReadExternalOrdinalFile(const base::FilePath& path) { if (!file_util::PathExists(path)) return NULL; @@ -108,7 +108,7 @@ const std::vector<std::string>& ExternalLoader::GetAppIds() { } void ExternalLoader::Load() { - FilePath ordinals_file; + base::FilePath ordinals_file; CHECK(PathService::Get(chrome::FILE_DEFAULT_APP_ORDER, &ordinals_file)); scoped_ptr<base::ListValue> ordinals_value( diff --git a/chrome/browser/chromeos/extensions/default_app_order_unittest.cc b/chrome/browser/chromeos/extensions/default_app_order_unittest.cc index 56d1a56..73ada42 100644 --- a/chrome/browser/chromeos/extensions/default_app_order_unittest.cc +++ b/chrome/browser/chromeos/extensions/default_app_order_unittest.cc @@ -20,7 +20,7 @@ namespace chromeos { namespace { -const FilePath::CharType kTestFile[] = +const base::FilePath::CharType kTestFile[] = FILE_PATH_LITERAL("test_default_app_order.json"); } @@ -48,14 +48,14 @@ class DefaultAppOrderTest : public testing::Test { return true; } - void SetExternalFile(const FilePath& path) { + void SetExternalFile(const base::FilePath& path) { path_override_.reset(new base::ScopedPathOverride( chrome::FILE_DEFAULT_APP_ORDER, path)); } void CreateExternalOrderFile(const std::string& content) { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - FilePath external_file = temp_dir_.path().Append(kTestFile); + base::FilePath external_file = temp_dir_.path().Append(kTestFile); file_util::WriteFile(external_file, content.c_str(), content.size()); SetExternalFile(external_file); } @@ -95,7 +95,7 @@ TEST_F(DefaultAppOrderTest, ExternalOrder) { // Tests none-existent order file gives built-in default. TEST_F(DefaultAppOrderTest, NoExternalFile) { - SetExternalFile(FilePath(FILE_PATH_LITERAL("none_existent_file"))); + SetExternalFile(base::FilePath(FILE_PATH_LITERAL("none_existent_file"))); scoped_ptr<default_app_order::ExternalLoader> loader( new default_app_order::ExternalLoader(false)); diff --git a/chrome/browser/chromeos/extensions/echo_private_api.cc b/chrome/browser/chromeos/extensions/echo_private_api.cc index 51f195d..84986a0 100644 --- a/chrome/browser/chromeos/extensions/echo_private_api.cc +++ b/chrome/browser/chromeos/extensions/echo_private_api.cc @@ -87,7 +87,7 @@ bool GetOobeTimestampFunction::GetOobeTimestampOnFileThread() { const char kOobeTimestampFile[] = "/home/chronos/.oobe_completed"; std::string timestamp = ""; base::PlatformFileInfo fileInfo; - if (file_util::GetFileInfo(FilePath(kOobeTimestampFile), &fileInfo)) { + if (file_util::GetFileInfo(base::FilePath(kOobeTimestampFile), &fileInfo)) { base::Time::Exploded ctime; fileInfo.creation_time.UTCExplode(&ctime); timestamp += base::StringPrintf("%u-%u-%u", diff --git a/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc b/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc index f4b4262..e4e1c53 100644 --- a/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc +++ b/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc @@ -80,7 +80,8 @@ class BackgroundObserver { }; // Creates a cache representation of the test file with predetermined content. -void CreateFileWithContent(const FilePath& path, const std::string& content) { +void CreateFileWithContent(const base::FilePath& path, + const std::string& content) { int content_size = static_cast<int>(content.length()); ASSERT_EQ(content_size, file_util::WriteFile(path, content.c_str(), content_size)); @@ -143,7 +144,7 @@ class FileSystemExtensionApiTest : public ExtensionApiTest { } protected: - FilePath mount_point_dir_; + base::FilePath mount_point_dir_; private: base::ScopedTempDir tmp_dir_; @@ -161,10 +162,10 @@ class RestrictedFileSystemExtensionApiTest : public ExtensionApiTest { // Create the mount point. file_util::CreateDirectory(mount_point_dir_); - FilePath test_dir = mount_point_dir_.Append("test_dir"); + base::FilePath test_dir = mount_point_dir_.Append("test_dir"); file_util::CreateDirectory(test_dir); - FilePath test_file = test_dir.AppendASCII("test_file.foo"); + base::FilePath test_file = test_dir.AppendASCII("test_file.foo"); CreateFileWithContent(test_file, kTestFileContent); test_file = test_dir.AppendASCII("mutable_test_file.foo"); @@ -195,7 +196,7 @@ class RestrictedFileSystemExtensionApiTest : public ExtensionApiTest { protected: base::ScopedTempDir tmp_dir_; - FilePath mount_point_dir_; + base::FilePath mount_point_dir_; }; @@ -210,7 +211,7 @@ class RemoteFileSystemExtensionApiTest : public ExtensionApiTest { // system service. This has to be done early on (before the browser is // created) because the system service instance is initialized very early // by FileBrowserEventRouter. - FilePath tmp_dir_path; + base::FilePath tmp_dir_path; PathService::Get(base::DIR_TEMP, &tmp_dir_path); ASSERT_TRUE(test_cache_root_.CreateUniqueTempDirUnderPath(tmp_dir_path)); @@ -269,7 +270,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTestLazy) { #if defined(ENABLE_WEB_INTENTS) IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserWebIntentTest) { // Create a test file inside the ScopedTempDir. - FilePath test_file = mount_point_dir_.AppendASCII("text_file.xul"); + base::FilePath test_file = mount_point_dir_.AppendASCII("text_file.xul"); CreateFileWithContent(test_file, kTestFileContent); ASSERT_TRUE(RunFileBrowserHandlerTest("intent.html#/tmp/text_file.xul", diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.cc b/chrome/browser/chromeos/extensions/file_browser_event_router.cc index 1ea5f47..921be57 100644 --- a/chrome/browser/chromeos/extensions/file_browser_event_router.cc +++ b/chrome/browser/chromeos/extensions/file_browser_event_router.cc @@ -93,7 +93,7 @@ const char* MountErrorToString(chromeos::MountError error) { void RelayFileWatcherCallbackToUIThread( const base::FilePathWatcher::Callback& callback, - const FilePath& local_path, + const base::FilePath& local_path, bool got_error) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, @@ -264,13 +264,13 @@ void FileBrowserEventRouter::ObserveFileSystemEvents() { // File watch setup routines. bool FileBrowserEventRouter::AddFileWatch( - const FilePath& local_path, - const FilePath& virtual_path, + const base::FilePath& local_path, + const base::FilePath& virtual_path, const std::string& extension_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); base::AutoLock lock(lock_); - FilePath watch_path = local_path; + base::FilePath watch_path = local_path; bool is_remote_watch = false; // Tweak watch path for remote sources - we need to drop leading /special // directory from there in order to be able to pair these events with @@ -302,12 +302,12 @@ bool FileBrowserEventRouter::AddFileWatch( } void FileBrowserEventRouter::RemoveFileWatch( - const FilePath& local_path, + const base::FilePath& local_path, const std::string& extension_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); base::AutoLock lock(lock_); - FilePath watch_path = local_path; + base::FilePath watch_path = local_path; // Tweak watch path for remote sources - we need to drop leading /special // directory from there in order to be able to pair these events with // their change notifications. @@ -440,7 +440,7 @@ void FileBrowserEventRouter::OnMountEvent( // when mounting failed or unmounting succeeded. if ((event == DiskMountManager::MOUNTING) != (error_code == chromeos::MOUNT_ERROR_NONE)) { - FilePath source_path(mount_info.source_path); + base::FilePath source_path(mount_info.source_path); DriveSystemService* system_service = DriveSystemServiceFactory::GetForProfile(profile_); drive::DriveCache* cache = @@ -524,7 +524,7 @@ void FileBrowserEventRouter::OnProgressUpdate( } void FileBrowserEventRouter::OnDirectoryChanged( - const FilePath& directory_path) { + const base::FilePath& directory_path) { HandleFileWatchNotification(directory_path, false); } @@ -573,7 +573,7 @@ void FileBrowserEventRouter::OnRefreshTokenInvalid() { } void FileBrowserEventRouter::HandleFileWatchNotification( - const FilePath& local_path, bool got_error) { + const base::FilePath& local_path, bool got_error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); base::AutoLock lock(lock_); @@ -586,7 +586,7 @@ void FileBrowserEventRouter::HandleFileWatchNotification( } void FileBrowserEventRouter::DispatchDirectoryChangeEvent( - const FilePath& virtual_path, + const base::FilePath& virtual_path, bool got_error, const FileBrowserEventRouter::ExtensionUsageRegistry& extensions) { if (!profile_) { @@ -636,7 +636,7 @@ void FileBrowserEventRouter::DispatchMountEvent( // Add sourcePath to the event. mount_info_value->SetString("sourcePath", mount_info.source_path); - FilePath relative_mount_path; + base::FilePath relative_mount_path; // If there were no error or some special conditions occurred, add mountPath // to the event. @@ -648,7 +648,7 @@ void FileBrowserEventRouter::DispatchMountEvent( if (file_manager_util::ConvertFileToRelativeFileSystemPath( profile_, kFileBrowserDomain, - FilePath(mount_info.mount_path), + base::FilePath(mount_info.mount_path), &relative_mount_path)) { mount_info_value->SetString("mountPath", "/" + relative_mount_path.value()); @@ -675,7 +675,7 @@ void FileBrowserEventRouter::ShowRemovableDeviceInFileManager( // To enable Photo Import call file_manager_util::OpenActionChoiceDialog // instead. - file_manager_util::ViewRemovableDrive(FilePath(mount_path)); + file_manager_util::ViewRemovableDrive(base::FilePath(mount_path)); } void FileBrowserEventRouter::OnDiskAdded( @@ -803,7 +803,7 @@ void FileBrowserEventRouter::OnFormatCompleted( } FileBrowserEventRouter::FileWatcherExtensions::FileWatcherExtensions( - const FilePath& path, const std::string& extension_id, + const base::FilePath& path, const std::string& extension_id, bool is_remote_file_system) : ref_count_(0), is_remote_file_system_(is_remote_file_system) { @@ -859,7 +859,7 @@ FileBrowserEventRouter::FileWatcherExtensions::GetRefCount() const { return ref_count_; } -const FilePath& +const base::FilePath& FileBrowserEventRouter::FileWatcherExtensions::GetVirtualPath() const { return virtual_path_; } @@ -873,7 +873,7 @@ FileBrowserEventRouter::GetRemoteFileSystem() const { } bool FileBrowserEventRouter::FileWatcherExtensions::Watch( - const FilePath& path, + const base::FilePath& path, const base::FilePathWatcher::Callback& callback) { if (is_remote_file_system_) return true; diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.h b/chrome/browser/chromeos/extensions/file_browser_event_router.h index a5aa407..3c856e4 100644 --- a/chrome/browser/chromeos/extensions/file_browser_event_router.h +++ b/chrome/browser/chromeos/extensions/file_browser_event_router.h @@ -61,10 +61,10 @@ class FileBrowserEventRouter void ObserveFileSystemEvents(); // File watch setup routines. - bool AddFileWatch(const FilePath& file_path, - const FilePath& virtual_path, + bool AddFileWatch(const base::FilePath& file_path, + const base::FilePath& virtual_path, const std::string& extension_id); - void RemoveFileWatch(const FilePath& file_path, + void RemoveFileWatch(const base::FilePath& file_path, const std::string& extension_id); // Mounts Drive on File browser. |callback| will be called after raising a @@ -98,7 +98,8 @@ class FileBrowserEventRouter virtual void OnRefreshTokenInvalid() OVERRIDE; // drive::DriveFileSystemInterface::Observer overrides. - virtual void OnDirectoryChanged(const FilePath& directory_path) OVERRIDE; + virtual void OnDirectoryChanged( + const base::FilePath& directory_path) OVERRIDE; virtual void OnResourceListFetched(int num_accumulated_entries) OVERRIDE; virtual void OnFileSystemMounted() OVERRIDE; virtual void OnFileSystemBeingUnmounted() OVERRIDE; @@ -111,7 +112,7 @@ class FileBrowserEventRouter class FileWatcherExtensions { public: - FileWatcherExtensions(const FilePath& path, + FileWatcherExtensions(const base::FilePath& path, const std::string& extension_id, bool is_remote_file_system); @@ -125,21 +126,21 @@ class FileBrowserEventRouter unsigned int GetRefCount() const; - const FilePath& GetVirtualPath() const; + const base::FilePath& GetVirtualPath() const; - bool Watch(const FilePath& path, + bool Watch(const base::FilePath& path, const base::FilePathWatcher::Callback& callback); private: linked_ptr<base::FilePathWatcher> file_watcher_; - FilePath local_path_; - FilePath virtual_path_; + base::FilePath local_path_; + base::FilePath virtual_path_; ExtensionUsageRegistry extensions_; unsigned int ref_count_; bool is_remote_file_system_; }; - typedef std::map<FilePath, FileWatcherExtensions*> WatcherMap; + typedef std::map<base::FilePath, FileWatcherExtensions*> WatcherMap; explicit FileBrowserEventRouter(Profile* profile); virtual ~FileBrowserEventRouter(); @@ -162,11 +163,11 @@ class FileBrowserEventRouter void OnFileBrowserPrefsChanged(); // Process file watch notifications. - void HandleFileWatchNotification(const FilePath& path, + void HandleFileWatchNotification(const base::FilePath& path, bool got_error); // Sends directory change event. - void DispatchDirectoryChangeEvent(const FilePath& path, bool error, + void DispatchDirectoryChangeEvent(const base::FilePath& path, bool error, const ExtensionUsageRegistry& extensions); void DispatchMountEvent( diff --git a/chrome/browser/chromeos/extensions/file_browser_handler_api.cc b/chrome/browser/chromeos/extensions/file_browser_handler_api.cc index 4e287ed..977d0c5 100644 --- a/chrome/browser/chromeos/extensions/file_browser_handler_api.cc +++ b/chrome/browser/chromeos/extensions/file_browser_handler_api.cc @@ -76,12 +76,12 @@ ui::SelectFileDialog::FileTypeInfo ConvertExtensionsToFileTypeInfo( ui::SelectFileDialog::FileTypeInfo file_type_info; for (size_t i = 0; i < extensions.size(); ++i) { - FilePath::StringType allowed_extension = - FilePath::FromUTF8Unsafe(extensions[i]).value(); + base::FilePath::StringType allowed_extension = + base::FilePath::FromUTF8Unsafe(extensions[i]).value(); // FileTypeInfo takes a nested vector like [["htm", "html"], ["txt"]] to // group equivalent extensions, but we don't use this feature here. - std::vector<FilePath::StringType> inner_vector; + std::vector<base::FilePath::StringType> inner_vector; inner_vector.push_back(allowed_extension); file_type_info.extensions.push_back(inner_vector); } @@ -116,16 +116,16 @@ class FileSelectorImpl : public FileSelector, // deleted by the caller. It will delete itself after it receives response // from SelectFielDialog. virtual void SelectFile( - const FilePath& suggested_name, + const base::FilePath& suggested_name, const std::vector<std::string>& allowed_extensions, Browser* browser, FileBrowserHandlerInternalSelectFileFunction* function) OVERRIDE; // ui::SelectFileDialog::Listener overrides. - virtual void FileSelected(const FilePath& path, + virtual void FileSelected(const base::FilePath& path, int index, void* params) OVERRIDE; - virtual void MultiFilesSelected(const std::vector<FilePath>& files, + virtual void MultiFilesSelected(const std::vector<base::FilePath>& files, void* params) OVERRIDE; virtual void FileSelectionCanceled(void* params) OVERRIDE; @@ -139,7 +139,7 @@ class FileSelectorImpl : public FileSelector, // // Returns boolean indicating whether the dialog has been successfully shown // to the user. - bool StartSelectFile(const FilePath& suggested_name, + bool StartSelectFile(const base::FilePath& suggested_name, const std::vector<std::string>& allowed_extensions, Browser* browser); @@ -149,7 +149,7 @@ class FileSelectorImpl : public FileSelector, // |success| indicates whether user has selectd the file. // |selected_path| is path that was selected. It is empty if the file wasn't // selected. - void SendResponse(bool success, const FilePath& selected_path); + void SendResponse(bool success, const base::FilePath& selected_path); // Dialog that is shown by selector. scoped_refptr<ui::SelectFileDialog> dialog_; @@ -167,11 +167,11 @@ FileSelectorImpl::~FileSelectorImpl() { dialog_->ListenerDestroyed(); // Send response if needed. if (function_) - SendResponse(false, FilePath()); + SendResponse(false, base::FilePath()); } void FileSelectorImpl::SelectFile( - const FilePath& suggested_name, + const base::FilePath& suggested_name, const std::vector<std::string>& allowed_extensions, Browser* browser, FileBrowserHandlerInternalSelectFileFunction* function) { @@ -189,7 +189,7 @@ void FileSelectorImpl::SelectFile( } bool FileSelectorImpl::StartSelectFile( - const FilePath& suggested_name, + const base::FilePath& suggested_name, const std::vector<std::string>& allowed_extensions, Browser* browser) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -224,13 +224,13 @@ bool FileSelectorImpl::StartSelectFile( } void FileSelectorImpl::FileSelected( - const FilePath& path, int index, void* params) { + const base::FilePath& path, int index, void* params) { SendResponse(true, path); delete this; } void FileSelectorImpl::MultiFilesSelected( - const std::vector<FilePath>& files, + const std::vector<base::FilePath>& files, void* params) { // Only single file should be selected in save-as dialog. NOTREACHED(); @@ -238,12 +238,12 @@ void FileSelectorImpl::MultiFilesSelected( void FileSelectorImpl::FileSelectionCanceled( void* params) { - SendResponse(false, FilePath()); + SendResponse(false, base::FilePath()); delete this; } void FileSelectorImpl::SendResponse(bool success, - const FilePath& selected_path) { + const base::FilePath& selected_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // We don't want to send multiple responses. @@ -307,7 +307,7 @@ FileBrowserHandlerInternalSelectFileFunction:: bool FileBrowserHandlerInternalSelectFileFunction::RunImpl() { scoped_ptr<SelectFile::Params> params(SelectFile::Params::Create(*args_)); - FilePath suggested_name(params->selection_params.suggested_name); + base::FilePath suggested_name(params->selection_params.suggested_name); std::vector<std::string> allowed_extensions; if (params->selection_params.allowed_file_extensions.get()) allowed_extensions = *params->selection_params.allowed_file_extensions; @@ -327,7 +327,7 @@ bool FileBrowserHandlerInternalSelectFileFunction::RunImpl() { void FileBrowserHandlerInternalSelectFileFunction::OnFilePathSelected( bool success, - const FilePath& full_path) { + const base::FilePath& full_path) { if (!success) { Respond(false); return; diff --git a/chrome/browser/chromeos/extensions/file_browser_handler_api.h b/chrome/browser/chromeos/extensions/file_browser_handler_api.h index bcc10f2..565cf32 100644 --- a/chrome/browser/chromeos/extensions/file_browser_handler_api.h +++ b/chrome/browser/chromeos/extensions/file_browser_handler_api.h @@ -49,7 +49,7 @@ class FileSelector { // The interface implementation should delete itself after the extension // function is notified of file selection result. virtual void SelectFile( - const FilePath& suggested_name, + const base::FilePath& suggested_name, const std::vector<std::string>& allowed_extensions, Browser* browser, FileBrowserHandlerInternalSelectFileFunction* function) = 0; @@ -92,7 +92,7 @@ class FileBrowserHandlerInternalSelectFileFunction // |success| Whether the path was selected. // |full_path| The selected file path if one was selected. It is ignored if // the selection did not succeed. - void OnFilePathSelected(bool success, const FilePath& full_path); + void OnFilePathSelected(bool success, const base::FilePath& full_path); protected: // The class is ref counted, so destructor should not be public. @@ -141,9 +141,9 @@ class FileBrowserHandlerInternalSelectFileFunction bool user_gesture_check_enabled_; // Full file system path of the selected file. - FilePath full_path_; + base::FilePath full_path_; // Selected file's virtual path in extension function caller's file system. - FilePath virtual_path_; + base::FilePath virtual_path_; // Extension function caller's file system name. std::string file_system_name_; // Extension function caller's file system root URL. @@ -151,7 +151,7 @@ class FileBrowserHandlerInternalSelectFileFunction // List of permissions and paths that have to be granted for the selected // files. - std::vector<std::pair<FilePath, int> > permissions_to_grant_; + std::vector<std::pair<base::FilePath, int> > permissions_to_grant_; DECLARE_EXTENSION_FUNCTION("fileBrowserHandlerInternal.selectFile", FILEBROWSERHANDLERINTERNAL_SELECTFILE) diff --git a/chrome/browser/chromeos/extensions/file_browser_handler_api_test.cc b/chrome/browser/chromeos/extensions/file_browser_handler_api_test.cc index d05e1c9..2ff20d1 100644 --- a/chrome/browser/chromeos/extensions/file_browser_handler_api_test.cc +++ b/chrome/browser/chromeos/extensions/file_browser_handler_api_test.cc @@ -34,10 +34,10 @@ namespace { // Data that defines FileSelector behaviour in each test case. struct TestCase { - TestCase(const FilePath& suggested_name, + TestCase(const base::FilePath& suggested_name, const std::vector<std::string>& allowed_extensions, bool success, - const FilePath& selected_path) + const base::FilePath& selected_path) : suggested_name(suggested_name), allowed_extensions(allowed_extensions), success(success), @@ -46,7 +46,7 @@ struct TestCase { ~TestCase() {} // Path that we expect to be suggested to the file selector. - FilePath suggested_name; + base::FilePath suggested_name; // Extensions that we expect to be allowed to the file selector. std::vector<std::string> allowed_extensions; @@ -54,12 +54,12 @@ struct TestCase { // Whether file selector should fail. bool success; // The path file selector should return back to the function. - FilePath selected_path; + base::FilePath selected_path; }; // Checks that file under path |selected_path| contains |expected_contents|. // Must be called on the file thread. -void ExpectFileContentEquals(const FilePath& selected_path, +void ExpectFileContentEquals(const base::FilePath& selected_path, const std::string& expected_contents) { std::string test_file_contents; ASSERT_TRUE(file_util::ReadFileToString(selected_path, &test_file_contents)); @@ -72,10 +72,10 @@ void ExpectFileContentEquals(const FilePath& selected_path, // results. class MockFileSelector : public file_handler::FileSelector { public: - MockFileSelector(const FilePath& suggested_name, + MockFileSelector(const base::FilePath& suggested_name, const std::vector<std::string>& allowed_extensions, bool success, - const FilePath& selected_path) + const base::FilePath& selected_path) : suggested_name_(suggested_name), allowed_extensions_(allowed_extensions), success_(success), @@ -86,7 +86,7 @@ class MockFileSelector : public file_handler::FileSelector { // file_handler::FileSelector implementation. // |browser| is not used. virtual void SelectFile( - const FilePath& suggested_name, + const base::FilePath& suggested_name, const std::vector<std::string>& allowed_extensions, Browser* browser, FileBrowserHandlerInternalSelectFileFunction* function) OVERRIDE { @@ -111,7 +111,7 @@ class MockFileSelector : public file_handler::FileSelector { private: // File name that is expected to be suggested by the function. - FilePath suggested_name_; + base::FilePath suggested_name_; // Extensions that is expected to be allowed by the function. std::vector<std::string> allowed_extensions_; @@ -119,7 +119,7 @@ class MockFileSelector : public file_handler::FileSelector { // Whether the selection should succeed. bool success_; // File path that should be returned to the function. - FilePath selected_path_; + base::FilePath selected_path_; DISALLOW_COPY_AND_ASSIGN(MockFileSelector); }; @@ -147,13 +147,13 @@ class MockFileSelectorFactory : public file_handler::FileSelectorFactory { private: // File name that is expected to be suggested by the function. - FilePath suggested_name_; + base::FilePath suggested_name_; // Extensions that is expected to be allowed by the function. std::vector<std::string> allowed_extensions_; // Whether the selection should succeed. bool success_; // File path that should be returned to the function. - FilePath selected_path_; + base::FilePath selected_path_; DISALLOW_COPY_AND_ASSIGN(MockFileSelectorFactory); }; @@ -165,7 +165,7 @@ class FileBrowserHandlerExtensionTest : public ExtensionApiTest { // Create mount point directory that will be used in the test. // Mount point will be called "tmp", and it will be located in a tmp // directory with an unique name. - FilePath tmp_dir_path; + base::FilePath tmp_dir_path; PathService::Get(base::DIR_TEMP, &tmp_dir_path); ASSERT_TRUE(scoped_tmp_dir_.CreateUniqueTempDirUnderPath(tmp_dir_path)); tmp_mount_point_ = scoped_tmp_dir_.path().Append("tmp"); @@ -182,7 +182,8 @@ class FileBrowserHandlerExtensionTest : public ExtensionApiTest { tmp_mount_point_); } - FilePath GetFullPathOnTmpMountPoint(const FilePath& relative_path) { + base::FilePath GetFullPathOnTmpMountPoint( + const base::FilePath& relative_path) { return tmp_mount_point_.Append(relative_path); } @@ -224,7 +225,7 @@ class FileBrowserHandlerExtensionTest : public ExtensionApiTest { base::ScopedTempDir scoped_tmp_dir_; // Our test mount point path. - FilePath tmp_mount_point_; + base::FilePath tmp_mount_point_; }; const std::vector<TestCase>* FileBrowserHandlerExtensionTest::test_cases_ = @@ -241,8 +242,8 @@ size_t FileBrowserHandlerExtensionTest::current_test_case_ = 0; // create, read and write the file under the selected file path. IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, EndToEnd) { // Path that will be "selected" by file selector. - const FilePath selected_path = - GetFullPathOnTmpMountPoint(FilePath("test_file.txt")); + const base::FilePath selected_path = + GetFullPathOnTmpMountPoint(base::FilePath("test_file.txt")); std::vector<std::string> allowed_extensions; allowed_extensions.push_back("txt"); @@ -250,15 +251,15 @@ IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, EndToEnd) { std::vector<TestCase> test_cases; test_cases.push_back( - TestCase(FilePath("some_file_name.txt"), + TestCase(base::FilePath("some_file_name.txt"), allowed_extensions, true, selected_path)); test_cases.push_back( - TestCase(FilePath("fail"), + TestCase(base::FilePath("fail"), std::vector<std::string>(), false, - FilePath())); + base::FilePath())); SetTestCases(&test_cases); @@ -322,10 +323,10 @@ IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, NoUserGesture) { // dictionary with |success == false| and no file entry when user cancels file // selection. IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, SelectionFailed) { - TestCase test_case(FilePath("some_file_name.txt"), + TestCase test_case(base::FilePath("some_file_name.txt"), std::vector<std::string>(), false, - FilePath()); + base::FilePath()); scoped_refptr<FileBrowserHandlerInternalSelectFileFunction> select_file_function( @@ -351,10 +352,10 @@ IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, SelectionFailed) { // only a file name (i.e. that extension function caller has no influence on // which directory contents will be initially displayed in selection dialog). IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, SuggestedFullPath) { - TestCase test_case(FilePath("some_file_name.txt"), + TestCase test_case(base::FilePath("some_file_name.txt"), std::vector<std::string>(), false, - FilePath()); + base::FilePath()); scoped_refptr<FileBrowserHandlerInternalSelectFileFunction> select_file_function( diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_browser_private_api.cc index 43c255a..a9fee5f 100644 --- a/chrome/browser/chromeos/extensions/file_browser_private_api.cc +++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc @@ -154,9 +154,10 @@ base::DictionaryValue* CreateValueFromDisk( std::string mount_path; if (!volume->mount_path().empty()) { - FilePath relative_mount_path; - file_manager_util::ConvertFileToRelativeFileSystemPath(profile, - extension_id, FilePath(volume->mount_path()), &relative_mount_path); + base::FilePath relative_mount_path; + file_manager_util::ConvertFileToRelativeFileSystemPath( + profile, extension_id, base::FilePath(volume->mount_path()), + &relative_mount_path); mount_path = relative_mount_path.value(); } @@ -189,13 +190,13 @@ base::DictionaryValue* CreateValueFromMountPoint(Profile* profile, mount_point_info.mount_type)); mount_info->SetString("sourcePath", mount_point_info.source_path); - FilePath relative_mount_path; + base::FilePath relative_mount_path; // Convert mount point path to relative path with the external file system // exposed within File API. if (file_manager_util::ConvertFileToRelativeFileSystemPath( profile, extension_id, - FilePath(mount_point_info.mount_path), + base::FilePath(mount_point_info.mount_path), &relative_mount_path)) { mount_info->SetString("mountPath", relative_mount_path.value()); } @@ -209,7 +210,7 @@ base::DictionaryValue* CreateValueFromMountPoint(Profile* profile, // Gives the extension renderer |host| file |permissions| for the given |path|. void GrantFilePermissionsToHost(content::RenderViewHost* host, - const FilePath& path, + const base::FilePath& path, int permissions) { ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( host->GetProcess()->GetID(), path, permissions); @@ -226,7 +227,7 @@ void AddDriveMountPoint( if (!provider) return; - const FilePath mount_point = drive::util::GetDriveMountPointPath(); + const base::FilePath mount_point = drive::util::GetDriveMountPointPath(); if (!render_view_host || !render_view_host->GetProcess()) return; @@ -258,7 +259,7 @@ void AddDriveMountPoint( drive::DriveCache::CACHE_TYPE_PERSISTENT), file_handler_util::GetReadOnlyPermissions()); - FilePath mount_point_virtual; + base::FilePath mount_point_virtual; if (provider->GetVirtualPath(mount_point, &mount_point_virtual)) provider->GrantFileAccessToExtension(extension_id, mount_point_virtual); } @@ -347,11 +348,11 @@ void GetSizeStatsOnFileThread(const std::string& mount_path, // isn't of the type CrosMountPointProvider handles, return an empty FilePath. // // Virtual paths will look like "Downloads/foo/bar.txt" or "drive/foo/bar.txt". -FilePath GetVirtualPathFromURL(fileapi::FileSystemContext* context, - const GURL& url) { +base::FilePath GetVirtualPathFromURL(fileapi::FileSystemContext* context, + const GURL& url) { fileapi::FileSystemURL filesystem_url(context->CrackURL(url)); if (!chromeos::CrosMountPointProvider::CanHandleURL(filesystem_url)) - return FilePath(); + return base::FilePath(); return filesystem_url.virtual_path(); } @@ -360,11 +361,11 @@ FilePath GetVirtualPathFromURL(fileapi::FileSystemContext* context, // // Local paths will look like "/home/chronos/user/Downloads/foo/bar.txt" or // "/special/drive/foo/bar.txt". -FilePath GetLocalPathFromURL(fileapi::FileSystemContext* context, - const GURL& url) { +base::FilePath GetLocalPathFromURL(fileapi::FileSystemContext* context, + const GURL& url) { fileapi::FileSystemURL filesystem_url(context->CrackURL(url)); if (!chromeos::CrosMountPointProvider::CanHandleURL(filesystem_url)) - return FilePath(); + return base::FilePath(); return filesystem_url.path(); } @@ -464,11 +465,11 @@ void FillDriveFilePropertiesValue( file_specific_info.content_mime_type()); } -void GetMimeTypesForFileURLs(const std::vector<FilePath>& file_paths, +void GetMimeTypesForFileURLs(const std::vector<base::FilePath>& file_paths, std::set<std::string>* mime_types) { - for (std::vector<FilePath>::const_iterator iter = file_paths.begin(); + for (std::vector<base::FilePath>::const_iterator iter = file_paths.begin(); iter != file_paths.end(); ++iter) { - const FilePath::StringType file_extension = + const base::FilePath::StringType file_extension = StringToLowerASCII(iter->Extension()); // TODO(thorogood): Rearchitect this call so it can run on the File thread; @@ -584,7 +585,7 @@ class RequestLocalFileSystemFunction::LocalFileSystemCallbackDispatcher { // Grant R/W file permissions to the renderer hosting component // extension for all paths exposed by our local file system provider. - std::vector<FilePath> root_dirs = provider->GetRootDirectories(); + std::vector<base::FilePath> root_dirs = provider->GetRootDirectories(); for (size_t i = 0; i < root_dirs.size(); ++i) { ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( child_id_, root_dirs[i], @@ -757,8 +758,8 @@ bool FileWatchBrowserFunctionBase::RunImpl() { void FileWatchBrowserFunctionBase::RunFileWatchOperationOnFileThread( scoped_refptr<FileBrowserEventRouter> event_router, const FileSystemURL& file_url, const std::string& extension_id) { - FilePath local_path = file_url.path(); - FilePath virtual_path = file_url.virtual_path(); + base::FilePath local_path = file_url.path(); + base::FilePath virtual_path = file_url.virtual_path(); bool result = !local_path.empty() && PerformFileWatchOperation( event_router, local_path, virtual_path, extension_id); @@ -770,14 +771,14 @@ void FileWatchBrowserFunctionBase::RunFileWatchOperationOnFileThread( bool AddFileWatchBrowserFunction::PerformFileWatchOperation( scoped_refptr<FileBrowserEventRouter> event_router, - const FilePath& local_path, const FilePath& virtual_path, + const base::FilePath& local_path, const base::FilePath& virtual_path, const std::string& extension_id) { return event_router->AddFileWatch(local_path, virtual_path, extension_id); } bool RemoveFileWatchBrowserFunction::PerformFileWatchOperation( scoped_refptr<FileBrowserEventRouter> event_router, - const FilePath& local_path, const FilePath& unused, + const base::FilePath& local_path, const base::FilePath& unused, const std::string& extension_id) { event_router->RemoveFileWatch(local_path, extension_id); return true; @@ -944,7 +945,7 @@ bool GetFileTasksFileBrowserFunction::FindDriveAppTasks( } bool GetFileTasksFileBrowserFunction::FindAppTasks( - const std::vector<FilePath>& file_paths, + const std::vector<base::FilePath>& file_paths, ListValue* result_list) { DCHECK(!file_paths.empty()); ExtensionService* service = profile_->GetExtensionService(); @@ -1002,7 +1003,7 @@ bool GetFileTasksFileBrowserFunction::FindAppTasks( // Find Web Intent platform apps that support the View task, and add them to // the |result_list|. These will be marked as kTaskWebIntent. bool GetFileTasksFileBrowserFunction::FindWebIntentTasks( - const std::vector<FilePath>& file_paths, + const std::vector<base::FilePath>& file_paths, ListValue* result_list) { DCHECK(!file_paths.empty()); ExtensionService* service = profile_->GetExtensionService(); @@ -1077,7 +1078,7 @@ bool GetFileTasksFileBrowserFunction::RunImpl() { // file paths. FileInfoList info_list; std::vector<GURL> file_urls; - std::vector<FilePath> file_paths; + std::vector<base::FilePath> file_paths; for (size_t i = 0; i < files_list->GetSize(); ++i) { FileInfo info; std::string file_url_str; @@ -1377,7 +1378,7 @@ void FileBrowserFunction::GetLocalPathsOnFileThread( size_t len = file_urls.size(); selected_files.reserve(len); for (size_t i = 0; i < len; ++i) { - FilePath local_path; + base::FilePath local_path; const GURL& file_url = file_urls[i]; // If "localPath" parameter is set, use it as the real path. @@ -1399,7 +1400,7 @@ void FileBrowserFunction::GetLocalPathsOnFileThread( const std::string unescaped_value = net::UnescapeURLComponent(parameters[i].second, kUnescapeRuleForQueryParameters); - local_path = FilePath::FromUTF8Unsafe(unescaped_value); + local_path = base::FilePath::FromUTF8Unsafe(unescaped_value); break; } } @@ -1476,11 +1477,11 @@ bool ViewFilesFunction::RunImpl() { BrowserContext::GetStoragePartition(profile(), site_instance)-> GetFileSystemContext(); - std::vector<FilePath> files; + std::vector<base::FilePath> files; for (size_t i = 0; i < path_list->GetSize(); ++i) { std::string url_as_string; path_list->GetString(i, &url_as_string); - FilePath path = GetLocalPathFromURL(file_system_context, + base::FilePath path = GetLocalPathFromURL(file_system_context, GURL(url_as_string)); if (path.empty()) return false; @@ -1621,8 +1622,8 @@ void AddMountFunction::GetLocalPathsResponseOnUIThread( return; } - const FilePath& source_path = files[0].file_path; - const FilePath::StringType& display_name = files[0].display_name; + const base::FilePath& source_path = files[0].file_path; + const base::FilePath::StringType& display_name = files[0].display_name; // Check if the source path is under Drive cache directory. if (drive::util::IsUnderDriveMountPoint(source_path)) { @@ -1646,7 +1647,7 @@ void AddMountFunction::GetLocalPathsResponseOnUIThread( void AddMountFunction::MarkCacheAsMounted( const std::string& mount_type, - const FilePath::StringType& display_name, + const base::FilePath::StringType& display_name, drive::DriveFileError error, scoped_ptr<drive::DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -1668,10 +1669,11 @@ void AddMountFunction::MarkCacheAsMounted( this, mount_type, display_name)); } -void AddMountFunction::OnMountedStateSet(const std::string& mount_type, - const FilePath::StringType& file_name, - drive::DriveFileError error, - const FilePath& file_path) { +void AddMountFunction::OnMountedStateSet( + const std::string& mount_type, + const base::FilePath::StringType& file_name, + drive::DriveFileError error, + const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (error != drive::DRIVE_FILE_OK) { @@ -1684,10 +1686,9 @@ void AddMountFunction::OnMountedStateSet(const std::string& mount_type, SetResult(new base::StringValue(file_path.value())); SendResponse(true); // MountPath() takes a std::string. - disk_mount_manager->MountPath(file_path.AsUTF8Unsafe(), - FilePath(file_name).Extension(), file_name, - DiskMountManager::MountTypeFromString( - mount_type)); + disk_mount_manager->MountPath( + file_path.AsUTF8Unsafe(), base::FilePath(file_name).Extension(), + file_name, DiskMountManager::MountTypeFromString(mount_type)); } RemoveMountFunction::RemoveMountFunction() { @@ -1781,7 +1782,7 @@ bool SetLastModifiedFunction::RunImpl() { scoped_refptr<fileapi::FileSystemContext> file_system_context = BrowserContext::GetStoragePartition(profile(), site_instance)-> GetFileSystemContext(); - FilePath local_path = GetLocalPathFromURL(file_system_context, + base::FilePath local_path = GetLocalPathFromURL(file_system_context, GURL(file_url)); BrowserThread::PostTask( @@ -1796,7 +1797,7 @@ bool SetLastModifiedFunction::RunImpl() { } void SetLastModifiedFunction::RunOperationOnFileThread( - const FilePath& local_path, + const base::FilePath& local_path, time_t timestamp) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); @@ -1842,7 +1843,7 @@ bool GetSizeStatsFunction::RunImpl() { BrowserContext::GetStoragePartition(profile(), site_instance)-> GetFileSystemContext(); - FilePath file_path = GetLocalPathFromURL(file_system_context, + base::FilePath file_path = GetLocalPathFromURL(file_system_context, GURL(mount_url)); if (file_path.empty()) return false; @@ -1944,7 +1945,7 @@ bool FormatDeviceFunction::RunImpl() { BrowserContext::GetStoragePartition(profile(), site_instance)-> GetFileSystemContext(); - FilePath file_path = GetLocalPathFromURL(file_system_context, + base::FilePath file_path = GetLocalPathFromURL(file_system_context, GURL(volume_file_url)); if (file_path.empty()) return false; @@ -1977,7 +1978,7 @@ bool GetVolumeMetadataFunction::RunImpl() { BrowserContext::GetStoragePartition(profile(), site_instance)-> GetFileSystemContext(); - FilePath file_path = GetLocalPathFromURL(file_system_context, + base::FilePath file_path = GetLocalPathFromURL(file_system_context, GURL(volume_mount_url)); if (file_path.empty()) { error_ = "Invalid mount path."; @@ -2391,7 +2392,7 @@ GetDriveFilePropertiesFunction::~GetDriveFilePropertiesFunction() { } void GetDriveFilePropertiesFunction::DoOperation( - const FilePath& file_path, + const base::FilePath& file_path, base::DictionaryValue* property_dict, scoped_ptr<drive::DriveEntryProto> entry_proto) { DCHECK(property_dict); @@ -2438,7 +2439,7 @@ void GetDriveFilePropertiesFunction::GetNextFileProperties() { std::string file_str; path_list_->GetString(current_index_, &file_str); GURL file_url = GURL(file_str); - FilePath file_path = GetVirtualPathFromURL(file_system_context, + base::FilePath file_path = GetVirtualPathFromURL(file_system_context, file_url); base::DictionaryValue* property_dict = new base::DictionaryValue; @@ -2474,7 +2475,7 @@ void GetDriveFilePropertiesFunction::CompleteGetFileProperties() { } void GetDriveFilePropertiesFunction::OnGetFileInfo( - const FilePath& file_path, + const base::FilePath& file_path, base::DictionaryValue* property_dict, drive::DriveFileError error, scoped_ptr<drive::DriveEntryProto> entry_proto) { @@ -2490,7 +2491,7 @@ void GetDriveFilePropertiesFunction::OnGetFileInfo( } void GetDriveFilePropertiesFunction::OnOperationComplete( - const FilePath& file_path, + const base::FilePath& file_path, base::DictionaryValue* property_dict, drive::DriveFileError error, scoped_ptr<drive::DriveEntryProto> entry_proto) { @@ -2602,7 +2603,7 @@ bool PinDriveFileFunction::RunImpl() { } void PinDriveFileFunction::DoOperation( - const FilePath& file_path, + const base::FilePath& file_path, base::DictionaryValue* properties, scoped_ptr<drive::DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -2637,7 +2638,7 @@ void PinDriveFileFunction::DoOperation( } void PinDriveFileFunction::OnPinStateSet( - const FilePath& path, + const base::FilePath& path, base::DictionaryValue* properties, scoped_ptr<drive::DriveEntryProto> entry_proto, drive::DriveFileError error) { @@ -2716,7 +2717,8 @@ void GetDriveFilesFunction::GetLocalPathsResponseOnUIThread( for (size_t i = 0; i < files.size(); ++i) { DCHECK(drive::util::IsUnderDriveMountPoint(files[i].file_path)); - FilePath drive_path = drive::util::ExtractDrivePath(files[i].file_path); + base::FilePath drive_path = + drive::util::ExtractDrivePath(files[i].file_path); remaining_drive_paths_.push(drive_path); } @@ -2733,7 +2735,7 @@ void GetDriveFilesFunction::GetFileOrSendResponse() { } // Get the file on the top of the queue. - FilePath drive_path = remaining_drive_paths_.front(); + base::FilePath drive_path = remaining_drive_paths_.front(); drive::DriveSystemService* system_service = drive::DriveSystemServiceFactory::GetForProfile(profile_); @@ -2754,10 +2756,10 @@ void GetDriveFilesFunction::GetFileOrSendResponse() { void GetDriveFilesFunction::OnFileReady( drive::DriveFileError error, - const FilePath& local_path, + const base::FilePath& local_path, const std::string& unused_mime_type, drive::DriveFileType file_type) { - FilePath drive_path = remaining_drive_paths_.front(); + base::FilePath drive_path = remaining_drive_paths_.front(); if (error == drive::DRIVE_FILE_OK) { local_paths_->Append(new base::StringValue(local_path.value())); @@ -2834,7 +2836,7 @@ bool CancelFileTransfersFunction::RunImpl() { std::string url_as_string; url_list->GetString(i, &url_as_string); - FilePath file_path = GetLocalPathFromURL(file_system_context, + base::FilePath file_path = GetLocalPathFromURL(file_system_context, GURL(url_as_string)); if (file_path.empty()) continue; @@ -2882,9 +2884,9 @@ bool TransferFileFunction::RunImpl() { BrowserContext::GetStoragePartition(profile(), site_instance)-> GetFileSystemContext(); - FilePath source_file = GetLocalPathFromURL(file_system_context, + base::FilePath source_file = GetLocalPathFromURL(file_system_context, GURL(source_file_url)); - FilePath destination_file = GetLocalPathFromURL(file_system_context, + base::FilePath destination_file = GetLocalPathFromURL(file_system_context, GURL(destination_file_url)); if (source_file.empty() || destination_file.empty()) return false; @@ -3227,7 +3229,7 @@ bool RequestDirectoryRefreshFunction::RunImpl() { BrowserContext::GetStoragePartition(profile(), site_instance)-> GetFileSystemContext(); - FilePath directory_path = GetVirtualPathFromURL(file_system_context, + base::FilePath directory_path = GetVirtualPathFromURL(file_system_context, GURL(file_url_as_string)); system_service->file_system()->RequestDirectoryRefresh(directory_path); @@ -3255,7 +3257,7 @@ bool ZipSelectionFunction::RunImpl() { BrowserContext::GetStoragePartition(profile(), site_instance)-> GetFileSystemContext(); - FilePath src_dir = GetLocalPathFromURL(file_system_context, + base::FilePath src_dir = GetLocalPathFromURL(file_system_context, GURL(dir_url)); if (src_dir.empty()) return false; @@ -3266,11 +3268,12 @@ bool ZipSelectionFunction::RunImpl() { if (!selection_urls || !selection_urls->GetSize()) return false; - std::vector<FilePath> files; + std::vector<base::FilePath> files; for (size_t i = 0; i < selection_urls->GetSize(); ++i) { std::string file_url; selection_urls->GetString(i, &file_url); - FilePath path = GetLocalPathFromURL(file_system_context, GURL(file_url)); + base::FilePath path = + GetLocalPathFromURL(file_system_context, GURL(file_url)); if (path.empty()) return false; files.push_back(path); @@ -3289,13 +3292,13 @@ bool ZipSelectionFunction::RunImpl() { if (cache && cache->IsUnderDriveCacheDirectory(src_dir)) return false; - FilePath dest_file = src_dir.Append(dest_name); - std::vector<FilePath> src_relative_paths; + base::FilePath dest_file = src_dir.Append(dest_name); + std::vector<base::FilePath> src_relative_paths; for (size_t i = 0; i != files.size(); ++i) { - const FilePath& file_path = files[i]; + const base::FilePath& file_path = files[i]; // Obtain the relative path of |file_path| under |src_dir|. - FilePath relative_path; + base::FilePath relative_path; if (!src_dir.AppendRelativePath(file_path, &relative_path)) return false; src_relative_paths.push_back(relative_path); diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.h b/chrome/browser/chromeos/extensions/file_browser_private_api.h index b259df5..1e9dae7 100644 --- a/chrome/browser/chromeos/extensions/file_browser_private_api.h +++ b/chrome/browser/chromeos/extensions/file_browser_private_api.h @@ -95,7 +95,7 @@ class FileWatchBrowserFunctionBase : public AsyncExtensionFunction { virtual bool PerformFileWatchOperation( scoped_refptr<FileBrowserEventRouter> event_router, - const FilePath& local_path, const FilePath& virtual_path, + const base::FilePath& local_path, const base::FilePath& virtual_path, const std::string& extension_id) = 0; // AsyncExtensionFunction overrides. @@ -120,7 +120,7 @@ class AddFileWatchBrowserFunction : public FileWatchBrowserFunctionBase { virtual bool PerformFileWatchOperation( scoped_refptr<FileBrowserEventRouter> event_router, - const FilePath& local_path, const FilePath& virtual_path, + const base::FilePath& local_path, const base::FilePath& virtual_path, const std::string& extension_id) OVERRIDE; }; @@ -136,7 +136,7 @@ class RemoveFileWatchBrowserFunction : public FileWatchBrowserFunctionBase { virtual bool PerformFileWatchOperation( scoped_refptr<FileBrowserEventRouter> event_router, - const FilePath& local_path, const FilePath& virtual_path, + const base::FilePath& local_path, const base::FilePath& virtual_path, const std::string& extension_id) OVERRIDE; }; @@ -155,7 +155,7 @@ class GetFileTasksFileBrowserFunction : public AsyncExtensionFunction { private: struct FileInfo { GURL file_url; - FilePath file_path; + base::FilePath file_path; std::string mime_type; }; typedef std::vector<FileInfo> FileInfoList; @@ -202,13 +202,13 @@ class GetFileTasksFileBrowserFunction : public AsyncExtensionFunction { #if defined(ENABLE_WEB_INTENTS) // Find the list of Web Intent tasks that can be used with the given file // types, appending them to the |result_list|. - bool FindWebIntentTasks(const std::vector<FilePath>& file_paths, + bool FindWebIntentTasks(const std::vector<base::FilePath>& file_paths, ListValue* result_list); #endif // Find the list of app file handlers that can be used with the given file // types, appending them to the |result_list|. - bool FindAppTasks(const std::vector<FilePath>& file_paths, + bool FindAppTasks(const std::vector<base::FilePath>& file_paths, ListValue* result_list); }; @@ -369,15 +369,15 @@ class AddMountFunction : public FileBrowserFunction { // Calls DriveCache::MarkCacheAsMounted. void MarkCacheAsMounted(const std::string& mount_type, - const FilePath::StringType& display_name, + const base::FilePath::StringType& display_name, drive::DriveFileError error, scoped_ptr<drive::DriveEntryProto> entry_proto); // A callback method to handle the result of MarkCacheAsMounted. void OnMountedStateSet(const std::string& mount_type, - const FilePath::StringType& file_name, + const base::FilePath::StringType& file_name, drive::DriveFileError error, - const FilePath& file_path); + const base::FilePath& file_path); }; // Unmounts selected device. Expects mount point path as an argument. @@ -440,7 +440,7 @@ class SetLastModifiedFunction : public FileBrowserFunction { protected: virtual ~SetLastModifiedFunction(); - void RunOperationOnFileThread(const FilePath& local_path, + void RunOperationOnFileThread(const base::FilePath& local_path, time_t timestamp); // AsyncExtensionFunction overrides. @@ -545,11 +545,11 @@ class GetDriveFilePropertiesFunction : public FileBrowserFunction { // Virtual function that can be overridden to do operations on each virtual // file path and update its the properties. - virtual void DoOperation(const FilePath& file_path, + virtual void DoOperation(const base::FilePath& file_path, base::DictionaryValue* properties, scoped_ptr<drive::DriveEntryProto> entry_proto); - void OnOperationComplete(const FilePath& file_path, + void OnOperationComplete(const base::FilePath& file_path, base::DictionaryValue* properties, drive::DriveFileError error, scoped_ptr<drive::DriveEntryProto> entry_proto); @@ -561,7 +561,7 @@ class GetDriveFilePropertiesFunction : public FileBrowserFunction { void PrepareResults(); private: - void OnGetFileInfo(const FilePath& file_path, + void OnGetFileInfo(const base::FilePath& file_path, base::DictionaryValue* property_dict, drive::DriveFileError error, scoped_ptr<drive::DriveEntryProto> entry_proto); @@ -597,12 +597,12 @@ class PinDriveFileFunction : public GetDriveFilePropertiesFunction { private: // Actually do the pinning/unpinning of each file. virtual void DoOperation( - const FilePath& file_path, + const base::FilePath& file_path, base::DictionaryValue* properties, scoped_ptr<drive::DriveEntryProto> entry_proto) OVERRIDE; // Callback for SetPinState. Updates properties with error. - void OnPinStateSet(const FilePath& path, + void OnPinStateSet(const base::FilePath& path, base::DictionaryValue* properties, scoped_ptr<drive::DriveEntryProto> entry_proto, drive::DriveFileError error); @@ -661,11 +661,11 @@ class GetDriveFilesFunction : public FileBrowserFunction { // Called by DriveFileSystem::GetFile(). Pops the file from // |remaining_drive_paths_|, and calls GetFileOrSendResponse(). void OnFileReady(drive::DriveFileError error, - const FilePath& local_path, + const base::FilePath& local_path, const std::string& unused_mime_type, drive::DriveFileType file_type); - std::queue<FilePath> remaining_drive_paths_; + std::queue<base::FilePath> remaining_drive_paths_; ListValue* local_paths_; }; diff --git a/chrome/browser/chromeos/extensions/file_browser_resource_throttle_browsertest.cc b/chrome/browser/chromeos/extensions/file_browser_resource_throttle_browsertest.cc index b041420..fc58288 100644 --- a/chrome/browser/chromeos/extensions/file_browser_resource_throttle_browsertest.cc +++ b/chrome/browser/chromeos/extensions/file_browser_resource_throttle_browsertest.cc @@ -362,7 +362,7 @@ IN_PROC_BROWSER_TEST_F(FileBrowserResourceThrottleExtensionApiTest, GURL url = test_server_->GetURL("/text_path.txt"); // The download's target file path. - FilePath target_path = + base::FilePath target_path = downloads_dir_.path().Append(FILE_PATH_LITERAL("download_target.txt")); // Set the downloads parameters. diff --git a/chrome/browser/chromeos/extensions/file_handler_util.cc b/chrome/browser/chromeos/extensions/file_handler_util.cc index b6b56e4..3349718 100644 --- a/chrome/browser/chromeos/extensions/file_handler_util.cc +++ b/chrome/browser/chromeos/extensions/file_handler_util.cc @@ -348,14 +348,14 @@ FileBrowserHandlerSet::iterator FindHandler( // Given the list of selected files, returns array of file action tasks // that are shared between them. void FindDefaultTasks(Profile* profile, - const std::vector<FilePath>& files_list, + const std::vector<base::FilePath>& files_list, const FileBrowserHandlerSet& common_tasks, FileBrowserHandlerSet* default_tasks) { DCHECK(default_tasks); default_tasks->clear(); std::set<std::string> default_ids; - for (std::vector<FilePath>::const_iterator it = files_list.begin(); + for (std::vector<base::FilePath>::const_iterator it = files_list.begin(); it != files_list.end(); ++it) { std::string task_id = file_handler_util::GetDefaultTaskIdFromPrefs( profile, "", it->Extension()); @@ -449,7 +449,7 @@ bool FindCommonTasks(Profile* profile, bool GetTaskForURLAndPath(Profile* profile, const GURL& url, - const FilePath& file_path, + const base::FilePath& file_path, const FileBrowserHandler** handler) { std::vector<GURL> file_urls; file_urls.push_back(url); @@ -462,7 +462,7 @@ bool GetTaskForURLAndPath(Profile* profile, if (common_tasks.empty()) return false; - std::vector<FilePath> file_paths; + std::vector<base::FilePath> file_paths; file_paths.push_back(file_path); FindDefaultTasks(profile, file_paths, common_tasks, &default_tasks); @@ -505,8 +505,8 @@ class ExtensionTaskExecutor : public FileTaskExecutor { FileDefinition(); ~FileDefinition(); - FilePath virtual_path; - FilePath absolute_path; + base::FilePath virtual_path; + base::FilePath absolute_path; bool is_directory; }; @@ -787,8 +787,8 @@ class ExtensionTaskExecutor::ExecuteTasksFileSystemCallbackDispatcher { // Check if this file system entry exists first. base::PlatformFileInfo file_info; - FilePath local_path = url.path(); - FilePath virtual_path = url.virtual_path(); + base::FilePath local_path = url.path(); + base::FilePath virtual_path = url.virtual_path(); bool is_drive_file = url.type() == fileapi::kFileSystemTypeDrive; DCHECK(!is_drive_file || drive::util::IsUnderDriveMountPoint(local_path)); @@ -982,8 +982,8 @@ void ExtensionTaskExecutor::SetupPermissionsAndDispatchEvent( files_urls->Append(file_def); file_def->SetString("fileSystemName", file_system_name); file_def->SetString("fileSystemRoot", file_system_root.spec()); - FilePath root(FILE_PATH_LITERAL("/")); - FilePath full_path = root.Append(iter->virtual_path); + base::FilePath root(FILE_PATH_LITERAL("/")); + base::FilePath full_path = root.Append(iter->virtual_path); file_def->SetString("fileFullPath", full_path.value()); file_def->SetBoolean("fileIsDirectory", iter->is_directory); } diff --git a/chrome/browser/chromeos/extensions/file_handler_util.h b/chrome/browser/chromeos/extensions/file_handler_util.h index f14a715..fb29e2a3 100644 --- a/chrome/browser/chromeos/extensions/file_handler_util.h +++ b/chrome/browser/chromeos/extensions/file_handler_util.h @@ -74,7 +74,7 @@ bool CrackTaskID(const std::string& task_id, // This generates a list of default tasks (tasks set as default by the user in // prefs) from the |common_tasks|. void FindDefaultTasks(Profile* profile, - const std::vector<FilePath>& files_list, + const std::vector<base::FilePath>& files_list, const std::set<const FileBrowserHandler*>& common_tasks, std::set<const FileBrowserHandler*>* default_tasks); @@ -89,7 +89,7 @@ bool FindCommonTasks(Profile* profile, // found, tries to match the url with one of the builtin tasks. bool GetTaskForURLAndPath(Profile* profile, const GURL& url, - const FilePath& path, + const base::FilePath& path, const FileBrowserHandler** handler); // Used for returning success or failure from task executions. diff --git a/chrome/browser/chromeos/extensions/file_manager_util.cc b/chrome/browser/chromeos/extensions/file_manager_util.cc index 44e7d2b..a68e93e 100644 --- a/chrome/browser/chromeos/extensions/file_manager_util.cc +++ b/chrome/browser/chromeos/extensions/file_manager_util.cc @@ -196,7 +196,7 @@ DictionaryValue* ProgessStatusToDictionaryValue( GURL file_url; if (file_manager_util::ConvertFileToFileSystemUrl(profile, drive::util::GetSpecialRemoteRootPath().Append( - FilePath(status.file_path)), + base::FilePath(status.file_path)), extension_id, &file_url)) { result->SetString("fileUrl", file_url.spec()); @@ -223,7 +223,7 @@ void OpenNewTab(const GURL& url, Profile* profile) { } // Shows a warning message box saying that the file could not be opened. -void ShowWarningMessageBox(Profile* profile, const FilePath& path) { +void ShowWarningMessageBox(Profile* profile, const base::FilePath& path) { // TODO: if FindOrCreateTabbedBrowser creates a new browser the returned // browser is leaked. Browser* browser = @@ -241,7 +241,7 @@ void ShowWarningMessageBox(Profile* profile, const FilePath& path) { // Called when a file on Drive was found. Opens the file found at |file_path| // in a new tab with a URL computed based on the |file_type| void OnDriveFileFound(Profile* profile, - const FilePath& file_path, + const base::FilePath& file_path, drive::DriveFileType file_type, drive::DriveFileError error, scoped_ptr<drive::DriveEntryProto> entry_proto) { @@ -267,7 +267,7 @@ void OnDriveFileFound(Profile* profile, } } -void InstallCRX(Browser* browser, const FilePath& path) { +void InstallCRX(Browser* browser, const base::FilePath& path) { ExtensionService* service = extensions::ExtensionSystem::Get(browser->profile())->extension_service(); CHECK(service); @@ -287,7 +287,7 @@ void InstallCRX(Browser* browser, const FilePath& path) { // Called when a crx file on Drive was downloaded. void OnCRXDownloadCallback(Browser* browser, drive::DriveFileError error, - const FilePath& file, + const base::FilePath& file, const std::string& unused_mime_type, drive::DriveFileType file_type) { if (error != drive::DRIVE_FILE_OK || file_type != drive::REGULAR_FILE) @@ -301,7 +301,7 @@ enum TAB_REUSE_MODE { REUSE_NEVER }; -bool FileManageTabExists(const FilePath& path, TAB_REUSE_MODE mode) { +bool FileManageTabExists(const base::FilePath& path, TAB_REUSE_MODE mode) { if (mode == REUSE_NEVER) return false; @@ -379,7 +379,7 @@ void ExecuteHandler(Profile* profile, executor->Execute(urls); } -void OpenFileBrowser(const FilePath& path, +void OpenFileBrowser(const base::FilePath& path, TAB_REUSE_MODE mode, const std::string& action_id) { content::RecordAction(UserMetricsAction("ShowFileBrowserFullTab")); @@ -409,7 +409,7 @@ void OpenFileBrowser(const FilePath& path, url += "?" + net::EscapeUrlEncodedData(query, false); } if (!path.empty()) { - FilePath virtual_path; + base::FilePath virtual_path; if (!ConvertFileToRelativeFileSystemPath(profile, kFileBrowserDomain, path, &virtual_path)) return; @@ -448,7 +448,7 @@ Browser* GetBrowserForUrl(GURL target_url) { return NULL; } -bool ExecuteDefaultHandler(Profile* profile, const FilePath& path) { +bool ExecuteDefaultHandler(Profile* profile, const base::FilePath& path) { GURL url; if (!ConvertFileToFileSystemUrl(profile, path, kFileBrowserDomain, &url)) return false; @@ -498,7 +498,7 @@ bool ExecuteDefaultHandler(Profile* profile, const FilePath& path) { } // Reads an entire file into a string. Fails is the file is 4K or longer. -bool ReadSmallFileToString(const FilePath& path, std::string* contents) { +bool ReadSmallFileToString(const base::FilePath& path, std::string* contents) { FILE* file = file_util::OpenFile(path, "rb"); if (!file) { return false; @@ -516,7 +516,7 @@ bool ReadSmallFileToString(const FilePath& path, std::string* contents) { // Reads JSON from a Google Docs file, extracts a document url and opens it // in a tab. -void ReadUrlFromGDocOnFileThread(const FilePath& file_path) { +void ReadUrlFromGDocOnFileThread(const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); std::string contents; if (!ReadSmallFileToString(file_path, &contents)) { @@ -542,7 +542,7 @@ void ReadUrlFromGDocOnFileThread(const FilePath& file_path) { // Used to implement ViewItem(). void ContinueViewItem(Profile* profile, - const FilePath& path, + const base::FilePath& path, base::PlatformFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -607,11 +607,11 @@ GURL GetVideoPlayerUrl(const GURL& source_url) { } bool ConvertFileToFileSystemUrl(Profile* profile, - const FilePath& full_file_path, + const base::FilePath& full_file_path, const std::string& extension_id, GURL* url) { GURL origin_url = Extension::GetBaseURLFromExtensionId(extension_id); - FilePath virtual_path; + base::FilePath virtual_path; if (!ConvertFileToRelativeFileSystemPath(profile, extension_id, full_file_path, &virtual_path)) { return false; @@ -626,8 +626,8 @@ bool ConvertFileToFileSystemUrl(Profile* profile, bool ConvertFileToRelativeFileSystemPath( Profile* profile, const std::string& extension_id, - const FilePath& full_file_path, - FilePath* virtual_path) { + const base::FilePath& full_file_path, + base::FilePath* virtual_path) { ExtensionService* service = extensions::ExtensionSystem::Get(profile)->extension_service(); // May be NULL during unit_tests. @@ -654,10 +654,10 @@ bool ConvertFileToRelativeFileSystemPath( GURL GetFileBrowserUrlWithParams( ui::SelectFileDialog::Type type, const string16& title, - const FilePath& default_virtual_path, + const base::FilePath& default_virtual_path, const ui::SelectFileDialog::FileTypeInfo* file_types, int file_type_index, - const FilePath::StringType& default_extension) { + const base::FilePath::StringType& default_extension) { DictionaryValue arg_value; arg_value.SetString("type", GetDialogTypeAsString(type)); arg_value.SetString("title", title); @@ -740,11 +740,11 @@ string16 GetTitleFromType(ui::SelectFileDialog::Type dialog_type) { return title; } -void ViewRemovableDrive(const FilePath& path) { +void ViewRemovableDrive(const base::FilePath& path) { OpenFileBrowser(path, REUSE_ANY_FILE_MANAGER, "auto-open"); } -void OpenActionChoiceDialog(const FilePath& path) { +void OpenActionChoiceDialog(const base::FilePath& path) { const int kDialogWidth = 394; // TODO(dgozman): remove 50, which is a title height once popup window // will have no title. @@ -752,7 +752,7 @@ void OpenActionChoiceDialog(const FilePath& path) { Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); - FilePath virtual_path; + base::FilePath virtual_path; if (!ConvertFileToRelativeFileSystemPath(profile, kFileBrowserDomain, path, &virtual_path)) return; @@ -781,7 +781,7 @@ void OpenActionChoiceDialog(const FilePath& path) { browser->window()->Show(); } -void ViewItem(const FilePath& path) { +void ViewItem(const base::FilePath& path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); @@ -802,12 +802,12 @@ void ViewItem(const FilePath& path) { base::Bind(&ContinueViewItem, profile, path)); } -void ShowFileInFolder(const FilePath& path) { +void ShowFileInFolder(const base::FilePath& path) { // This action changes the selection so we do not reuse existing tabs. OpenFileBrowser(path, REUSE_NEVER, "select"); } -bool ExecuteBuiltinHandler(Browser* browser, const FilePath& path, +bool ExecuteBuiltinHandler(Browser* browser, const base::FilePath& path, const std::string& internal_task_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -922,7 +922,7 @@ bool ShouldBeOpenedWithPdfPlugin(Profile* profile, const char* file_extension) { if (base::strcasecmp(file_extension, kPdfExtension) != 0) return false; - FilePath pdf_path; + base::FilePath pdf_path; PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path); content::PepperPluginInfo* pepper_info = diff --git a/chrome/browser/chromeos/extensions/file_manager_util.h b/chrome/browser/chromeos/extensions/file_manager_util.h index e70c029..00743b8 100644 --- a/chrome/browser/chromeos/extensions/file_manager_util.h +++ b/chrome/browser/chromeos/extensions/file_manager_util.h @@ -35,7 +35,7 @@ GURL GetVideoPlayerUrl(); // Converts |full_file_path| into external filesystem: url. Returns false // if |full_file_path| is not managed by the external filesystem provider. bool ConvertFileToFileSystemUrl(Profile* profile, - const FilePath& full_file_path, + const base::FilePath& full_file_path, const std::string& extension_id, GURL* url); @@ -44,17 +44,17 @@ bool ConvertFileToFileSystemUrl(Profile* profile, // external filesystem provider. bool ConvertFileToRelativeFileSystemPath(Profile* profile, const std::string& extension_id, - const FilePath& full_file_path, - FilePath* relative_path); + const base::FilePath& full_file_path, + base::FilePath* relative_path); // Gets base file browser url for. GURL GetFileBrowserUrlWithParams( ui::SelectFileDialog::Type type, const string16& title, - const FilePath& default_virtual_path, + const base::FilePath& default_virtual_path, const ui::SelectFileDialog::FileTypeInfo* file_types, int file_type_index, - const FilePath::StringType& default_extension); + const base::FilePath::StringType& default_extension); // Get file dialog title string from its type. string16 GetTitleFromType(ui::SelectFileDialog::Type type); @@ -65,23 +65,23 @@ string16 GetTitleFromType(ui::SelectFileDialog::Type type); // the left panel, and that is all we want. // If there is no File Browser open, this call opens a new one pointing to // |path|. In this case the tab will automatically close on |path| unmount. -void ViewRemovableDrive(const FilePath& path); +void ViewRemovableDrive(const base::FilePath& path); // Opens an action choice dialog for an external drive. // One of the actions is opening the File Manager. -void OpenActionChoiceDialog(const FilePath& path); +void OpenActionChoiceDialog(const base::FilePath& path); // Opens item with the default File Browser handler. -void ViewItem(const FilePath& path); +void ViewItem(const base::FilePath& path); // Opens file browser on the folder containing the file, with the file selected. -void ShowFileInFolder(const FilePath& path); +void ShowFileInFolder(const base::FilePath& path); // Executes the built-in File Manager handler or tries to open |file| directly // in the browser. Returns false if neither is possible. bool ExecuteBuiltinHandler( Browser* browser, - const FilePath& path, + const base::FilePath& path, const std::string& internal_task_id); bool ShouldBeOpenedWithPdfPlugin(Profile* profile, const char* file_extension); diff --git a/chrome/browser/chromeos/extensions/install_limiter.cc b/chrome/browser/chromeos/extensions/install_limiter.cc index 8cfc652..b25d820 100644 --- a/chrome/browser/chromeos/extensions/install_limiter.cc +++ b/chrome/browser/chromeos/extensions/install_limiter.cc @@ -20,7 +20,7 @@ using content::BrowserThread; namespace { // Gets the file size of |file| and stores it in |size| on the blocking pool. -void GetFileSizeOnBlockingPool(const FilePath& file, int64* size) { +void GetFileSizeOnBlockingPool(const base::FilePath& file, int64* size) { DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); // Get file size. In case of error, sets 0 as file size to let the installer @@ -38,7 +38,7 @@ namespace extensions { InstallLimiter::DeferredInstall::DeferredInstall( const scoped_refptr<CrxInstaller>& installer, - const FilePath& path) + const base::FilePath& path) : installer(installer), path(path) { } @@ -64,7 +64,7 @@ void InstallLimiter::DisableForTest() { } void InstallLimiter::Add(const scoped_refptr<CrxInstaller>& installer, - const FilePath& path) { + const base::FilePath& path) { // No deferred installs when disabled for test. if (disabled_for_test_) { installer->InstallCrx(path); @@ -81,7 +81,7 @@ void InstallLimiter::Add(const scoped_refptr<CrxInstaller>& installer, void InstallLimiter::AddWithSize( const scoped_refptr<CrxInstaller>& installer, - const FilePath& path, + const base::FilePath& path, int64* size) { const int64 kBigAppSizeThreshold = 1048576; // 1MB @@ -117,7 +117,7 @@ void InstallLimiter::CheckAndRunDeferrredInstalls() { } void InstallLimiter::RunInstall(const scoped_refptr<CrxInstaller>& installer, - const FilePath& path) { + const base::FilePath& path) { registrar_.Add(this, chrome::NOTIFICATION_CRX_INSTALLER_DONE, content::Source<CrxInstaller>(installer.get())); diff --git a/chrome/browser/chromeos/extensions/install_limiter.h b/chrome/browser/chromeos/extensions/install_limiter.h index 194af4c..9b59dd4 100644 --- a/chrome/browser/chromeos/extensions/install_limiter.h +++ b/chrome/browser/chromeos/extensions/install_limiter.h @@ -35,17 +35,18 @@ class InstallLimiter : public ProfileKeyedService, void DisableForTest(); - void Add(const scoped_refptr<CrxInstaller>& installer, const FilePath& path); + void Add(const scoped_refptr<CrxInstaller>& installer, + const base::FilePath& path); private: // DeferredInstall holds info to run a CrxInstaller later. struct DeferredInstall { DeferredInstall(const scoped_refptr<CrxInstaller>& installer, - const FilePath& path); + const base::FilePath& path); ~DeferredInstall(); const scoped_refptr<CrxInstaller> installer; - const FilePath path; + const base::FilePath path; }; typedef std::queue<DeferredInstall> DeferredInstallList; @@ -55,7 +56,7 @@ class InstallLimiter : public ProfileKeyedService, // it stores the install info into |deferred_installs_| to run it later. // Otherwise, it just runs the installer. void AddWithSize(const scoped_refptr<CrxInstaller>& installer, - const FilePath& path, + const base::FilePath& path, int64* size); // Checks and runs deferred big app installs when appropriate. @@ -64,7 +65,7 @@ class InstallLimiter : public ProfileKeyedService, // Starts install using passed-in info and observes |installer|'s done // notification. void RunInstall(const scoped_refptr<CrxInstaller>& installer, - const FilePath& path); + const base::FilePath& path); // content::NotificationObserver overrides: virtual void Observe(int type, diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc index c6daa7f..d9c09db 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc +++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc @@ -64,13 +64,13 @@ ash::WallpaperLayout GetLayoutEnum(const std::string& layout) { // Saves |data| as |file_name| to directory with |key|. Return false if the // directory can not be found/created or failed to write file. bool SaveData(int key, const std::string& file_name, const std::string& data) { - FilePath data_dir; + base::FilePath data_dir; CHECK(PathService::Get(key, &data_dir)); if (!file_util::DirectoryExists(data_dir) && !file_util::CreateDirectory(data_dir)) { return false; } - FilePath file_path = data_dir.Append(file_name); + base::FilePath file_path = data_dir.Append(file_name); return file_util::PathExists(file_path) || (file_util::WriteFile(file_path, data.c_str(), @@ -82,13 +82,13 @@ bool SaveData(int key, const std::string& file_name, const std::string& data) { // can not be found in the directory, return true with empty |data|. It is // expected that we may try to access file which did not saved yet. bool GetData(int key, const std::string& file_name, std::string* data) { - FilePath data_dir; + base::FilePath data_dir; CHECK(PathService::Get(key, &data_dir)); if (!file_util::DirectoryExists(data_dir) && !file_util::CreateDirectory(data_dir)) return false; - FilePath file_path = data_dir.Append(file_name); + base::FilePath file_path = data_dir.Append(file_name); return !file_util::PathExists(file_path) || file_util::ReadFileToString(file_path, data); @@ -335,10 +335,10 @@ void WallpaperSetWallpaperIfExistFunction::ReadFileAndInitiateStartDecode( DCHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread( sequence_token_)); std::string data; - FilePath data_dir; + base::FilePath data_dir; CHECK(PathService::Get(chrome::DIR_CHROMEOS_WALLPAPERS, &data_dir)); - FilePath file_path = data_dir.Append(file_name); + base::FilePath file_path = data_dir.Append(file_name); if (file_util::PathExists(file_path) && file_util::ReadFileToString(file_path, &data)) { @@ -435,10 +435,10 @@ void WallpaperSetWallpaperFunction::SaveToFile() { this, base::Passed(&deep_copy))); chromeos::UserImage wallpaper(wallpaper_); - FilePath wallpaper_dir; + base::FilePath wallpaper_dir; CHECK(PathService::Get(chrome::DIR_CHROMEOS_WALLPAPERS, &wallpaper_dir)); - FilePath file_path = wallpaper_dir.Append(file_name).InsertBeforeExtension( - chromeos::kSmallWallpaperSuffix); + base::FilePath file_path = wallpaper_dir.Append( + file_name).InsertBeforeExtension(chromeos::kSmallWallpaperSuffix); if (file_util::PathExists(file_path)) return; // Generates and saves small resolution wallpaper. Uses CENTER_CROPPED to @@ -680,13 +680,13 @@ bool WallpaperGetOfflineWallpaperListFunction::RunImpl() { void WallpaperGetOfflineWallpaperListFunction::GetList() { DCHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread( sequence_token_)); - FilePath wallpaper_dir; + base::FilePath wallpaper_dir; std::vector<std::string> file_list; CHECK(PathService::Get(chrome::DIR_CHROMEOS_WALLPAPERS, &wallpaper_dir)); if (file_util::DirectoryExists(wallpaper_dir)) { file_util::FileEnumerator files(wallpaper_dir, false, file_util::FileEnumerator::FILES); - for (FilePath current = files.Next(); !current.empty(); + for (base::FilePath current = files.Next(); !current.empty(); current = files.Next()) { std::string file_name = current.BaseName().RemoveExtension().value(); // Do not add file name of small resolution wallpaper to the list. diff --git a/chrome/browser/chromeos/extensions/zip_file_creator.cc b/chrome/browser/chromeos/extensions/zip_file_creator.cc index bd03e00..7a2ac45 100644 --- a/chrome/browser/chromeos/extensions/zip_file_creator.cc +++ b/chrome/browser/chromeos/extensions/zip_file_creator.cc @@ -28,9 +28,9 @@ namespace extensions { ZipFileCreator::ZipFileCreator( Observer* observer, - const FilePath& src_dir, - const std::vector<FilePath>& src_relative_paths, - const FilePath& dest_file) + const base::FilePath& src_dir, + const std::vector<base::FilePath>& src_relative_paths, + const base::FilePath& dest_file) : thread_identifier_(BrowserThread::ID_COUNT), observer_(observer), src_dir_(src_dir), diff --git a/chrome/browser/chromeos/extensions/zip_file_creator.h b/chrome/browser/chromeos/extensions/zip_file_creator.h index 75146af..d43e8d2 100644 --- a/chrome/browser/chromeos/extensions/zip_file_creator.h +++ b/chrome/browser/chromeos/extensions/zip_file_creator.h @@ -40,9 +40,9 @@ class ZipFileCreator : public content::UtilityProcessHostClient { // Creates a zip file from the specified list of files and directories. ZipFileCreator(Observer* observer, - const FilePath& src_dir, - const std::vector<FilePath>& src_relative_paths, - const FilePath& dest_file); + const base::FilePath& src_dir, + const std::vector<base::FilePath>& src_relative_paths, + const base::FilePath& dest_file); // Start creating the zip file. The client is called with the results. void Start(); @@ -76,14 +76,14 @@ class ZipFileCreator : public content::UtilityProcessHostClient { Observer* observer_; // The source directory for input files. - FilePath src_dir_; + base::FilePath src_dir_; // The list of source files paths to be included in the zip file. // Entries are relative paths under directory |src_dir_|. - std::vector<FilePath> src_relative_paths_; + std::vector<base::FilePath> src_relative_paths_; // The output zip file. - FilePath dest_file_; + base::FilePath dest_file_; // Whether we've received a response from the utility process yet. bool got_response_; diff --git a/chrome/browser/chromeos/external_metrics.h b/chrome/browser/chromeos/external_metrics.h index 4e2982a..42a1378 100644 --- a/chrome/browser/chromeos/external_metrics.h +++ b/chrome/browser/chromeos/external_metrics.h @@ -82,7 +82,7 @@ class ExternalMetrics : public base::RefCountedThreadSafe<ExternalMetrics> { // Used for testing only. RecorderType test_recorder_; - FilePath test_path_; + base::FilePath test_path_; DISALLOW_COPY_AND_ASSIGN(ExternalMetrics); }; diff --git a/chrome/browser/chromeos/external_metrics_unittest.cc b/chrome/browser/chromeos/external_metrics_unittest.cc index d1ff75d..0487953 100644 --- a/chrome/browser/chromeos/external_metrics_unittest.cc +++ b/chrome/browser/chromeos/external_metrics_unittest.cc @@ -73,7 +73,7 @@ TEST(ExternalMetricsTest, ParseExternalMetricsFile) { scoped_refptr<chromeos::ExternalMetrics> external_metrics(new chromeos::ExternalMetrics()); external_metrics->test_recorder_ = &ReceiveMessage; - external_metrics->test_path_ = FilePath(path); + external_metrics->test_path_ = base::FilePath(path); EXPECT_TRUE(unlink(path) == 0 || errno == ENOENT); // Sends a few valid messages. Once in a while, collects them and checks the diff --git a/chrome/browser/chromeos/imageburner/burn_controller.cc b/chrome/browser/chromeos/imageburner/burn_controller.cc index cef84d9..9167196 100644 --- a/chrome/browser/chromeos/imageburner/burn_controller.cc +++ b/chrome/browser/chromeos/imageburner/burn_controller.cc @@ -161,7 +161,7 @@ class BurnControllerImpl ProcessError(IDS_IMAGEBURN_USER_ERROR); } else if (state != StateMachine::INITIAL && !working_) { // User has started burn process, so let's start observing. - StartBurnImage(FilePath(), FilePath()); + StartBurnImage(base::FilePath(), base::FilePath()); } } @@ -209,7 +209,7 @@ class BurnControllerImpl BurnImage(); } else if (state_machine_->state() != StateMachine::INITIAL) { // User has started burn process, so let's start observing. - StartBurnImage(FilePath(), FilePath()); + StartBurnImage(base::FilePath(), base::FilePath()); } } @@ -237,8 +237,8 @@ class BurnControllerImpl // BurnController override. // May be called with empty values if there is a handler that has started // burning, and thus set the target paths. - virtual void StartBurnImage(const FilePath& target_device_path, - const FilePath& target_file_path) OVERRIDE { + virtual void StartBurnImage(const base::FilePath& target_device_path, + const base::FilePath& target_file_path) OVERRIDE { if (!target_device_path.empty() && !target_file_path.empty() && state_machine_->new_burn_posible()) { if (!CheckNetwork()) { @@ -347,7 +347,7 @@ class BurnControllerImpl return CrosLibrary::Get()->GetNetworkLibrary()->Connected(); } - FilePath zip_image_file_path_; + base::FilePath zip_image_file_path_; std::string image_file_name_; BurnManager* burn_manager_; StateMachine* state_machine_; diff --git a/chrome/browser/chromeos/imageburner/burn_manager.cc b/chrome/browser/chromeos/imageburner/burn_manager.cc index c2d035d..e030b7e 100644 --- a/chrome/browser/chromeos/imageburner/burn_manager.cc +++ b/chrome/browser/chromeos/imageburner/burn_manager.cc @@ -34,7 +34,7 @@ const int64 kBytesImageDownloadProgressReportInterval = 10240; BurnManager* g_burn_manager = NULL; // Cretes a directory and calls |callback| with the result on UI thread. -void CreateDirectory(const FilePath& path, +void CreateDirectory(const base::FilePath& path, base::Callback<void(bool success)> callback) { const bool success = file_util::CreateDirectory(path); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, @@ -267,7 +267,7 @@ void BurnManager::OnImageDirCreated(Delegate* delegate, bool success) { delegate->OnImageDirCreated(success); } -const FilePath& BurnManager::GetImageDir() { +const base::FilePath& BurnManager::GetImageDir() { return image_dir_; } @@ -288,7 +288,8 @@ void BurnManager::FetchConfigFile(Delegate* delegate) { config_fetcher_->Start(); } -void BurnManager::FetchImage(const GURL& image_url, const FilePath& file_path) { +void BurnManager::FetchImage(const GURL& image_url, + const base::FilePath& file_path) { tick_image_download_start_ = base::TimeTicks::Now(); bytes_image_download_progress_last_reported_ = 0; image_fetcher_.reset(net::URLFetcher::Create(image_url, diff --git a/chrome/browser/chromeos/imageburner/burn_manager.h b/chrome/browser/chromeos/imageburner/burn_manager.h index cebed12..383912f 100644 --- a/chrome/browser/chromeos/imageburner/burn_manager.h +++ b/chrome/browser/chromeos/imageburner/burn_manager.h @@ -199,7 +199,7 @@ class BurnManager : net::URLFetcherDelegate { void FetchConfigFile(Delegate* delegate); // Fetch a zipped recovery image. - void FetchImage(const GURL& image_url, const FilePath& file_path); + void FetchImage(const GURL& image_url, const base::FilePath& file_path); // Cancel fetching image. void CancelImageFetch(); @@ -216,15 +216,15 @@ class BurnManager : net::URLFetcherDelegate { // Returns directory image should be dopwnloaded to. // The directory has to be previously created. - const FilePath& GetImageDir(); + const base::FilePath& GetImageDir(); - const FilePath& target_device_path() { return target_device_path_; } - void set_target_device_path(const FilePath& path) { + const base::FilePath& target_device_path() { return target_device_path_; } + void set_target_device_path(const base::FilePath& path) { target_device_path_ = path; } - const FilePath& target_file_path() { return target_file_path_; } - void set_target_file_path(const FilePath& path) { + const base::FilePath& target_file_path() { return target_file_path_; } + void set_target_file_path(const base::FilePath& path) { target_file_path_ = path; } @@ -244,9 +244,9 @@ class BurnManager : net::URLFetcherDelegate { base::WeakPtrFactory<BurnManager> weak_ptr_factory_; - FilePath image_dir_; - FilePath target_device_path_; - FilePath target_file_path_; + base::FilePath image_dir_; + base::FilePath target_device_path_; + base::FilePath target_file_path_; GURL config_file_url_; bool config_file_fetched_; diff --git a/chrome/browser/chromeos/input_method/ibus_controller_impl.cc b/chrome/browser/chromeos/input_method/ibus_controller_impl.cc index 46c5e32..13e4f94 100644 --- a/chrome/browser/chromeos/input_method/ibus_controller_impl.cc +++ b/chrome/browser/chromeos/input_method/ibus_controller_impl.cc @@ -190,7 +190,7 @@ base::FilePathWatcher* g_file_path_watcher = NULL; // Called when the ibus-daemon address file is modified. void OnFilePathChanged(const base::Closure& closure, - const FilePath& file_path, + const base::FilePath& file_path, bool failed) { if (failed) return; // Can't recover, do nothing. @@ -213,7 +213,7 @@ void StartWatch(const std::string& address_file_path, delete g_file_path_watcher; g_file_path_watcher = new base::FilePathWatcher; bool result = g_file_path_watcher->Watch( - FilePath::FromUTF8Unsafe(address_file_path), + base::FilePath::FromUTF8Unsafe(address_file_path), false, // do not watch child directory. base::Bind(&OnFilePathChanged, callback)); DCHECK(result); diff --git a/chrome/browser/chromeos/input_method/textinput_browsertest.cc b/chrome/browser/chromeos/input_method/textinput_browsertest.cc index 7ba6994..b065d03 100644 --- a/chrome/browser/chromeos/input_method/textinput_browsertest.cc +++ b/chrome/browser/chromeos/input_method/textinput_browsertest.cc @@ -64,8 +64,8 @@ class TextInputTest : public InProcessBrowserTest, IN_PROC_BROWSER_TEST_F(TextInputTest, SwitchToPasswordFieldTest) { GetInputMethod()->AddObserver(this); GURL url = ui_test_utils::GetTestUrl( - FilePath("textinput"), - FilePath("ime_enable_disable_test.html")); + base::FilePath("textinput"), + base::FilePath("ime_enable_disable_test.html")); ui_test_utils::NavigateToURL(browser(), url); content::WebContents* tab = diff --git a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc index 6f80408..d07bab9 100644 --- a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc +++ b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc @@ -37,18 +37,18 @@ namespace { typedef base::Callback<void( scoped_refptr<Extension>, - const FilePath&)> UnpackCallback; + const base::FilePath&)> UnpackCallback; class ScreensaverUnpackerClient : public extensions::SandboxedUnpackerClient { public: - ScreensaverUnpackerClient(const FilePath& crx_path, + ScreensaverUnpackerClient(const base::FilePath& crx_path, const UnpackCallback& unpacker_callback) : crx_path_(crx_path), unpack_callback_(unpacker_callback) {} - virtual void OnUnpackSuccess(const FilePath& temp_dir, - const FilePath& extension_root, + virtual void OnUnpackSuccess(const base::FilePath& temp_dir, + const base::FilePath& extension_root, const base::DictionaryValue* original_manifest, const Extension* extension) OVERRIDE; virtual void OnUnpackFailure(const string16& error) OVERRIDE; @@ -58,20 +58,20 @@ class ScreensaverUnpackerClient private: void LoadScreensaverExtension( - const FilePath& extension_base_path, - const FilePath& screensaver_extension_path); + const base::FilePath& extension_base_path, + const base::FilePath& screensaver_extension_path); void NotifyAppPackOfDamagedFile(); - FilePath crx_path_; + base::FilePath crx_path_; UnpackCallback unpack_callback_; DISALLOW_COPY_AND_ASSIGN(ScreensaverUnpackerClient); }; void ScreensaverUnpackerClient::OnUnpackSuccess( - const FilePath& temp_dir, - const FilePath& extension_root, + const base::FilePath& temp_dir, + const base::FilePath& extension_root, const base::DictionaryValue* original_manifest, const Extension* extension) { content::BrowserThread::PostTask( @@ -89,8 +89,8 @@ void ScreensaverUnpackerClient::OnUnpackFailure(const string16& error) { } void ScreensaverUnpackerClient::LoadScreensaverExtension( - const FilePath& extension_base_path, - const FilePath& screensaver_extension_path) { + const base::FilePath& extension_base_path, + const base::FilePath& screensaver_extension_path) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); std::string error; @@ -173,15 +173,15 @@ void KioskModeScreensaver::GetScreensaverCrxPath() { } void KioskModeScreensaver::ScreensaverPathCallback( - const FilePath& screensaver_crx) { + const base::FilePath& screensaver_crx) { if (screensaver_crx.empty()) return; Profile* default_profile = ProfileManager::GetDefaultProfile(); if (!default_profile) return; - FilePath extensions_dir = extensions::ExtensionSystem::Get(default_profile)-> - extension_service()->install_directory(); + base::FilePath extensions_dir = extensions::ExtensionSystem::Get( + default_profile)->extension_service()->install_directory(); scoped_refptr<SandboxedUnpacker> screensaver_unpacker( new SandboxedUnpacker( screensaver_crx, @@ -207,7 +207,7 @@ void KioskModeScreensaver::ScreensaverPathCallback( void KioskModeScreensaver::SetupScreensaver( scoped_refptr<Extension> extension, - const FilePath& extension_base_path) { + const base::FilePath& extension_base_path) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); extension_base_path_ = extension_base_path; diff --git a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h index 5b4ca4f..949247e 100644 --- a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h +++ b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h @@ -33,16 +33,16 @@ class KioskModeScreensaver : public ash::UserActivityObserver { // Callback to receive the path to the screensaver extension's crx and call // the unpacker to unpack and load the crx. - void ScreensaverPathCallback(const FilePath& screensaver_crx); + void ScreensaverPathCallback(const base::FilePath& screensaver_crx); // Called back on the UI thread to Setup the screensaver with the now unpacked // and loaded extension. void SetupScreensaver(scoped_refptr<extensions::Extension> extension, - const FilePath& extension_base_path); + const base::FilePath& extension_base_path); base::WeakPtrFactory<KioskModeScreensaver> weak_ptr_factory_; - FilePath extension_base_path_; + base::FilePath extension_base_path_; DISALLOW_COPY_AND_ASSIGN(KioskModeScreensaver); }; diff --git a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.cc b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.cc index c9dd847..5169dcc 100644 --- a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.cc +++ b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.cc @@ -103,7 +103,7 @@ bool KioskModeSettings::is_initialized() const { void KioskModeSettings::GetScreensaverPath( policy::AppPackUpdater::ScreenSaverUpdateCallback callback) const { if (!is_initialized_) { - callback.Run(FilePath()); + callback.Run(base::FilePath()); return; } @@ -111,7 +111,7 @@ void KioskModeSettings::GetScreensaverPath( // for testing and dev workflows. if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kKioskModeScreensaverPath)) { - callback.Run(FilePath( + callback.Run(base::FilePath( CommandLine::ForCurrentProcess()-> GetSwitchValueASCII(switches::kKioskModeScreensaverPath))); return; diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc index c4094bb..4e6f8dd 100644 --- a/chrome/browser/chromeos/login/login_utils.cc +++ b/chrome/browser/chromeos/login/login_utils.cc @@ -119,7 +119,7 @@ const char kGuestUserName[] = ""; // Flag file that disables RLZ tracking, when present. const char kRLZDisabledFlagName[] = FILE_PATH_LITERAL(".rlz_disabled"); -FilePath GetRlzDisabledFlagPath() { +base::FilePath GetRlzDisabledFlagPath() { return file_util::GetHomeDir().Append(kRLZDisabledFlagName); } #endif @@ -355,7 +355,7 @@ void LoginUtilsImpl::DoBrowserLaunch(Profile* profile, chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; browser_creator.LaunchBrowser(*CommandLine::ForCurrentProcess(), profile, - FilePath(), + base::FilePath(), chrome::startup::IS_PROCESS_STARTUP, first_run, &return_code); diff --git a/chrome/browser/chromeos/login/mock_user_image_manager.h b/chrome/browser/chromeos/login/mock_user_image_manager.h index 8bcd97b..658c53b 100644 --- a/chrome/browser/chromeos/login/mock_user_image_manager.h +++ b/chrome/browser/chromeos/login/mock_user_image_manager.h @@ -22,7 +22,7 @@ class MockUserImageManager : public UserImageManager { MOCK_METHOD2(SaveUserDefaultImageIndex, void(const std::string&, int)); MOCK_METHOD2(SaveUserImage, void(const std::string&, const UserImage&)); MOCK_METHOD2(SaveUserImageFromFile, void(const std::string&, - const FilePath&)); + const base::FilePath&)); MOCK_METHOD1(SaveUserImageFromProfileImage, void(const std::string&)); MOCK_METHOD1(DownloadProfileImage, void(const std::string&)); MOCK_CONST_METHOD0(DownloadedProfileImage, const gfx::ImageSkia& (void)); diff --git a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc index b17403c..556f9b7 100644 --- a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc +++ b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc @@ -109,8 +109,8 @@ class ParallelAuthenticatorTest : public testing::Test { mock_caller_ = NULL; } - FilePath PopulateTempFile(const char* data, int data_len) { - FilePath out; + base::FilePath PopulateTempFile(const char* data, int data_len) { + base::FilePath out; FILE* tmp_file = file_util::CreateAndOpenTemporaryFile(&out); EXPECT_NE(tmp_file, static_cast<FILE*>(NULL)); EXPECT_EQ(file_util::WriteFile(out, data, data_len), data_len); diff --git a/chrome/browser/chromeos/login/update_screen.cc b/chrome/browser/chromeos/login/update_screen.cc index 2c57c0b..41805bc 100644 --- a/chrome/browser/chromeos/login/update_screen.cc +++ b/chrome/browser/chromeos/login/update_screen.cc @@ -381,7 +381,7 @@ bool UpdateScreen::HasCriticalUpdate() { // Checking for update flag file causes us to do blocking IO on UI thread. // Temporarily allow it until we fix http://crosbug.com/11106 base::ThreadRestrictions::ScopedAllowIO allow_io; - FilePath update_deadline_file_path(kUpdateDeadlineFile); + base::FilePath update_deadline_file_path(kUpdateDeadlineFile); if (!file_util::ReadFileToString(update_deadline_file_path, &deadline) || deadline.empty()) { return false; diff --git a/chrome/browser/chromeos/login/user_image_loader.cc b/chrome/browser/chromeos/login/user_image_loader.cc index bd451d2..7ba6b1a 100644 --- a/chrome/browser/chromeos/login/user_image_loader.cc +++ b/chrome/browser/chromeos/login/user_image_loader.cc @@ -71,7 +71,7 @@ void UserImageLoader::LoadImage( DCHECK(task_runner->RunsTasksOnCurrentThread()); std::string image_data; - file_util::ReadFileToString(FilePath(filepath), &image_data); + file_util::ReadFileToString(base::FilePath(filepath), &image_data); scoped_refptr<ImageDecoder> image_decoder = new ImageDecoder(this, image_data, image_codec_); diff --git a/chrome/browser/chromeos/login/user_image_manager_browsertest.cc b/chrome/browser/chromeos/login/user_image_manager_browsertest.cc index 6ac8ef9..3a3e764 100644 --- a/chrome/browser/chromeos/login/user_image_manager_browsertest.cc +++ b/chrome/browser/chromeos/login/user_image_manager_browsertest.cc @@ -89,7 +89,7 @@ class UserImageManagerTest : public CrosInProcessBrowserTest, // Stores old (pre-migration) user image info. void SetOldUserImageInfo(const std::string& username, int image_index, - const FilePath& image_path) { + const base::FilePath& image_path) { AddUser(username); DictionaryPrefUpdate images_pref(local_state_, "UserImages"); base::DictionaryValue* image_properties = new base::DictionaryValue(); @@ -104,7 +104,7 @@ class UserImageManagerTest : public CrosInProcessBrowserTest, void ExpectUserImageInfo(const base::DictionaryValue* images_pref, const std::string& username, int image_index, - const FilePath& image_path) { + const base::FilePath& image_path) { ASSERT_TRUE(images_pref); const base::DictionaryValue* image_properties = NULL; images_pref->GetDictionaryWithoutPathExpansion(username, &image_properties); @@ -131,7 +131,7 @@ class UserImageManagerTest : public CrosInProcessBrowserTest, // and that new user image info does not exist. void ExpectOldUserImageInfo(const std::string& username, int image_index, - const FilePath& image_path) { + const base::FilePath& image_path) { ExpectUserImageInfo(local_state_->GetDictionary("UserImages"), username, image_index, image_path); ExpectNoUserImageInfo(local_state_->GetDictionary("user_image_info"), @@ -142,7 +142,7 @@ class UserImageManagerTest : public CrosInProcessBrowserTest, // and that old user image info does not exist. void ExpectNewUserImageInfo(const std::string& username, int image_index, - const FilePath& image_path) { + const base::FilePath& image_path) { ExpectUserImageInfo(local_state_->GetDictionary("user_image_info"), username, image_index, image_path); ExpectNoUserImageInfo(local_state_->GetDictionary("UserImages"), @@ -152,7 +152,7 @@ class UserImageManagerTest : public CrosInProcessBrowserTest, // Sets bitmap |resource_id| as image for |username| and saves it to disk. void SaveUserImagePNG(const std::string& username, int resource_id) { - FilePath image_path = GetUserImagePath(username, "png"); + base::FilePath image_path = GetUserImagePath(username, "png"); scoped_refptr<base::RefCountedStaticMemory> image_data( ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( resource_id, ui::SCALE_FACTOR_100P)); @@ -165,9 +165,9 @@ class UserImageManagerTest : public CrosInProcessBrowserTest, } // Returns the image path for user |username| with specified |extension|. - FilePath GetUserImagePath(const std::string& username, + base::FilePath GetUserImagePath(const std::string& username, const std::string& extension) { - FilePath user_data_dir; + base::FilePath user_data_dir; PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); return user_data_dir.Append(username).AddExtension(extension); } @@ -183,38 +183,41 @@ class UserImageManagerTest : public CrosInProcessBrowserTest, IN_PROC_BROWSER_TEST_F(UserImageManagerTest, PRE_DefaultUserImagePreserved) { // Setup an old default (stock) user image. ScopedMockUserManagerEnabler mock_user_manager; - SetOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, FilePath()); + SetOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath()); } IN_PROC_BROWSER_TEST_F(UserImageManagerTest, DefaultUserImagePreserved) { UserManager::Get()->GetUsers(); // Load users. // Old info preserved. - ExpectOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, FilePath()); + ExpectOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath()); LogIn(kTestUser1); // Wait for migration. content::RunMessageLoop(); // Image info is migrated now. - ExpectNewUserImageInfo(kTestUser1, kFirstDefaultImageIndex, FilePath()); + ExpectNewUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath()); } IN_PROC_BROWSER_TEST_F(UserImageManagerTest, PRE_OtherUsersUnaffected) { // Setup two users with stock images. ScopedMockUserManagerEnabler mock_user_manager; - SetOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, FilePath()); - SetOldUserImageInfo(kTestUser2, kFirstDefaultImageIndex + 1, FilePath()); + SetOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath()); + SetOldUserImageInfo(kTestUser2, kFirstDefaultImageIndex + 1, + base::FilePath()); } IN_PROC_BROWSER_TEST_F(UserImageManagerTest, OtherUsersUnaffected) { UserManager::Get()->GetUsers(); // Load users. // Old info preserved. - ExpectOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, FilePath()); - ExpectOldUserImageInfo(kTestUser2, kFirstDefaultImageIndex + 1, FilePath()); + ExpectOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath()); + ExpectOldUserImageInfo(kTestUser2, kFirstDefaultImageIndex + 1, + base::FilePath()); LogIn(kTestUser1); // Wait for migration. content::RunMessageLoop(); // Image info is migrated for the first user and unaffected for the rest. - ExpectNewUserImageInfo(kTestUser1, kFirstDefaultImageIndex, FilePath()); - ExpectOldUserImageInfo(kTestUser2, kFirstDefaultImageIndex + 1, FilePath()); + ExpectNewUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath()); + ExpectOldUserImageInfo(kTestUser2, kFirstDefaultImageIndex + 1, + base::FilePath()); } IN_PROC_BROWSER_TEST_F(UserImageManagerTest, PRE_PRE_NonJPEGImageFromFile) { diff --git a/chrome/browser/chromeos/login/user_image_manager_impl.cc b/chrome/browser/chromeos/login/user_image_manager_impl.cc index 37a1ac3..4e5aaf5 100644 --- a/chrome/browser/chromeos/login/user_image_manager_impl.cc +++ b/chrome/browser/chromeos/login/user_image_manager_impl.cc @@ -141,7 +141,7 @@ void AddProfileImageTimeHistogram(ProfileDownloadResult result, void DeleteImageFile(const std::string& image_path) { if (image_path.empty()) return; - FilePath fp(image_path); + base::FilePath fp(image_path); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, @@ -320,7 +320,7 @@ void UserImageManagerImpl::SaveUserImage(const std::string& username, } void UserImageManagerImpl::SaveUserImageFromFile(const std::string& username, - const FilePath& path) { + const base::FilePath& path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // Always use unsafe image loader because we resize the image when saving // anyway. @@ -373,10 +373,10 @@ const gfx::ImageSkia& UserImageManagerImpl::DownloadedProfileImage() const { return downloaded_profile_image_; } -FilePath UserImageManagerImpl::GetImagePathForUser( +base::FilePath UserImageManagerImpl::GetImagePathForUser( const std::string& username) { std::string filename = username + kSafeImagePathExtension; - FilePath user_data_dir; + base::FilePath user_data_dir; PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); return user_data_dir.AppendASCII(filename); } @@ -433,7 +433,7 @@ void UserImageManagerImpl::SaveUserImageInternal(const std::string& username, if (UserManager::Get()->IsUserNonCryptohomeDataEphemeral(username)) return; - FilePath image_path = GetImagePathForUser(username); + base::FilePath image_path = GetImagePathForUser(username); DVLOG(1) << "Saving user image to " << image_path.value(); last_image_set_async_ = true; @@ -448,7 +448,7 @@ void UserImageManagerImpl::SaveUserImageInternal(const std::string& username, void UserImageManagerImpl::SaveImageToFile(const std::string& username, const UserImage& user_image, - const FilePath& image_path, + const base::FilePath& image_path, int image_index, const GURL& image_url) { if (!SaveBitmapToFile(user_image, image_path)) @@ -509,7 +509,7 @@ void UserImageManagerImpl::SaveImageToLocalState(const std::string& username, } bool UserImageManagerImpl::SaveBitmapToFile(const UserImage& user_image, - const FilePath& image_path) { + const base::FilePath& image_path) { UserImage safe_image; const UserImage::RawImage* encoded_image = NULL; if (!user_image.is_safe_format()) { diff --git a/chrome/browser/chromeos/login/wallpaper_manager.cc b/chrome/browser/chromeos/login/wallpaper_manager.cc index 28a1df0..87a9e44 100644 --- a/chrome/browser/chromeos/login/wallpaper_manager.cc +++ b/chrome/browser/chromeos/login/wallpaper_manager.cc @@ -210,23 +210,24 @@ bool WallpaperManager::GetWallpaperFromCache(const std::string& email, return false; } -FilePath WallpaperManager::GetOriginalWallpaperPathForUser( +base::FilePath WallpaperManager::GetOriginalWallpaperPathForUser( const std::string& username) { std::string filename = username + kOriginalCustomWallpaperSuffix; - FilePath user_data_dir; + base::FilePath user_data_dir; PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); return user_data_dir.AppendASCII(filename); } -FilePath WallpaperManager::GetWallpaperPathForUser(const std::string& username, - bool is_small) { +base::FilePath WallpaperManager::GetWallpaperPathForUser( + const std::string& username, + bool is_small) { const char* suffix = is_small ? kSmallWallpaperSuffix : kLargeWallpaperSuffix; std::string filename = base::StringPrintf("%s_wallpaper%s", username.c_str(), suffix); - FilePath user_data_dir; + base::FilePath user_data_dir; PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); return user_data_dir.AppendASCII(filename); } @@ -332,7 +333,7 @@ void WallpaperManager::RemoveUserWallpaperInfo(const std::string& email) { } void WallpaperManager::ResizeAndSaveWallpaper(const UserImage& wallpaper, - const FilePath& path, + const base::FilePath& path, ash::WallpaperLayout layout, int preferred_width, int preferred_height) { @@ -562,8 +563,8 @@ void WallpaperManager::SetUserWallpaper(const std::string& email) { desktop_background_controller()->GetAppropriateResolution(); const char* sub_dir = (resolution == ash::WALLPAPER_RESOLUTION_SMALL) ? kSmallWallpaperSubDir : kLargeWallpaperSubDir; - FilePath wallpaper_path = GetCustomWallpaperPath(sub_dir, email, - info.file); + base::FilePath wallpaper_path = GetCustomWallpaperPath(sub_dir, email, + info.file); if (current_wallpaper_path_ == wallpaper_path) return; current_wallpaper_path_ = wallpaper_path; @@ -632,15 +633,15 @@ void WallpaperManager::CacheUserWallpaper(const std::string& email) { return; WallpaperInfo info; if (GetUserWallpaperInfo(email, &info)) { - FilePath wallpaper_dir; - FilePath wallpaper_path; + base::FilePath wallpaper_dir; + base::FilePath wallpaper_path; if (info.type == User::CUSTOMIZED) { ash::WallpaperResolution resolution = ash::Shell::GetInstance()-> desktop_background_controller()->GetAppropriateResolution(); const char* sub_dir = (resolution == ash::WALLPAPER_RESOLUTION_SMALL) ? kSmallWallpaperSubDir : kLargeWallpaperSubDir; - FilePath wallpaper_path = GetCustomWallpaperPath(sub_dir, email, - info.file); + base::FilePath wallpaper_path = GetCustomWallpaperPath(sub_dir, email, + info.file); task_runner_->PostTask(FROM_HERE, base::Bind(&WallpaperManager::GetCustomWallpaperInternal, base::Unretained(this), email, info, wallpaper_path, @@ -661,10 +662,10 @@ void WallpaperManager::ClearObsoleteWallpaperPrefs() { } void WallpaperManager::DeleteWallpaperInList( - const std::vector<FilePath>& file_list) { - for (std::vector<FilePath>::const_iterator it = file_list.begin(); + const std::vector<base::FilePath>& file_list) { + for (std::vector<base::FilePath>::const_iterator it = file_list.begin(); it != file_list.end(); ++it) { - FilePath path = *it; + base::FilePath path = *it; // Some users may still have legacy wallpapers with png extension. We need // to delete these wallpapers too. if (!file_util::Delete(path, true) && @@ -675,9 +676,9 @@ void WallpaperManager::DeleteWallpaperInList( } void WallpaperManager::DeleteUserWallpapers(const std::string& email) { - std::vector<FilePath> file_to_remove; + std::vector<base::FilePath> file_to_remove; // Remove small user wallpaper. - FilePath wallpaper_path = GetWallpaperPathForUser(email, true); + base::FilePath wallpaper_path = GetWallpaperPathForUser(email, true); file_to_remove.push_back(wallpaper_path); wallpaper_path = GetCustomWallpaperDir(kSmallWallpaperSubDir, email); file_to_remove.push_back(wallpaper_path); @@ -766,8 +767,8 @@ void WallpaperManager::InitializeRegisteredDeviceWallpaper() { void WallpaperManager::LoadWallpaper(const std::string& email, const WallpaperInfo& info, bool update_wallpaper) { - FilePath wallpaper_dir; - FilePath wallpaper_path; + base::FilePath wallpaper_dir; + base::FilePath wallpaper_path; if (info.type == User::ONLINE) { std::string file_name = GURL(info.file).ExtractFileName(); ash::WallpaperResolution resolution = ash::Shell::GetInstance()-> @@ -776,7 +777,7 @@ void WallpaperManager::LoadWallpaper(const std::string& email, // resolution. if (info.layout != ash::WALLPAPER_LAYOUT_STRETCH && resolution == ash::WALLPAPER_RESOLUTION_SMALL) { - file_name = FilePath(file_name).InsertBeforeExtension( + file_name = base::FilePath(file_name).InsertBeforeExtension( kSmallWallpaperSuffix).value(); } CHECK(PathService::Get(chrome::DIR_CHROMEOS_WALLPAPERS, &wallpaper_dir)); @@ -792,7 +793,7 @@ void WallpaperManager::LoadWallpaper(const std::string& email, // overlooked that case and caused these wallpapers not being loaded at all. // On some slow devices, it caused login webui not visible after upgrade to // M26 from M21. See crosbug.com/38429 for details. - FilePath user_data_dir; + base::FilePath user_data_dir; PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); wallpaper_path = user_data_dir.Append(info.file); StartLoad(email, info, update_wallpaper, wallpaper_path); @@ -895,7 +896,7 @@ bool WallpaperManager::GetUserWallpaperInfo(const std::string& email, void WallpaperManager::GetCustomWallpaperInternalOld( const std::string& email, const WallpaperInfo& info, - const FilePath& wallpaper_path, + const base::FilePath& wallpaper_path, bool update_wallpaper) { DCHECK(BrowserThread::GetBlockingPool()-> IsRunningSequenceOnCurrentThread(sequence_token_)); @@ -913,7 +914,7 @@ void WallpaperManager::GetCustomWallpaperInternalOld( } } - FilePath valid_path = wallpaper_path.DirName().Append(file_name); + base::FilePath valid_path = wallpaper_path.DirName().Append(file_name); if (!file_util::PathExists(valid_path)) valid_path = valid_path.AddExtension(".png"); BrowserThread::PostTask( @@ -1006,27 +1007,26 @@ void WallpaperManager::ProcessCustomWallpaper( DCHECK(BrowserThread::GetBlockingPool()-> IsRunningSequenceOnCurrentThread(sequence_token_)); UserImage wallpaper(*image.get(), raw_image); - if (persistent) - SaveCustomWallpaper(email, FilePath(info.file), info.layout, wallpaper); + if (persistent) { + SaveCustomWallpaper(email, base::FilePath(info.file), info.layout, + wallpaper); + } } void WallpaperManager::SaveCustomWallpaper(const std::string& email, - const FilePath& original_path, + const base::FilePath& original_path, ash::WallpaperLayout layout, const UserImage& wallpaper) { DCHECK(BrowserThread::GetBlockingPool()-> IsRunningSequenceOnCurrentThread(sequence_token_)); EnsureCustomWallpaperDirectories(email); std::string file_name = original_path.BaseName().value(); - FilePath small_wallpaper_path = GetCustomWallpaperPath(kSmallWallpaperSubDir, - email, - file_name); - FilePath large_wallpaper_path = GetCustomWallpaperPath(kLargeWallpaperSubDir, - email, - file_name); - FilePath thumbnail_path = GetCustomWallpaperPath(kThumbnailWallpaperSubDir, - email, - file_name); + base::FilePath small_wallpaper_path = + GetCustomWallpaperPath(kSmallWallpaperSubDir, email, file_name); + base::FilePath large_wallpaper_path = + GetCustomWallpaperPath(kLargeWallpaperSubDir, email, file_name); + base::FilePath thumbnail_path = + GetCustomWallpaperPath(kThumbnailWallpaperSubDir, email, file_name); std::vector<unsigned char> image_data = wallpaper.raw_image(); // Saves the original file in case that resized wallpaper is not generated @@ -1052,7 +1052,7 @@ void WallpaperManager::RecordUma(User::WallpaperType type, int index) { User::WALLPAPER_TYPE_COUNT); } -void WallpaperManager::SaveWallpaperInternal(const FilePath& path, +void WallpaperManager::SaveWallpaperInternal(const base::FilePath& path, const char* data, int size) { int written_bytes = file_util::WriteFile(path, data, size); @@ -1062,7 +1062,7 @@ void WallpaperManager::SaveWallpaperInternal(const FilePath& path, void WallpaperManager::StartLoad(const std::string& email, const WallpaperInfo& info, bool update_wallpaper, - const FilePath& wallpaper_path) { + const base::FilePath& wallpaper_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // All wallpaper related operation should run on the same thread. So we pass diff --git a/chrome/browser/chromeos/login/wallpaper_manager.h b/chrome/browser/chromeos/login/wallpaper_manager.h index bbd4ad8..aa8ec23 100644 --- a/chrome/browser/chromeos/login/wallpaper_manager.h +++ b/chrome/browser/chromeos/login/wallpaper_manager.h @@ -101,15 +101,15 @@ class WallpaperManager: public system::TimezoneSettings::Observer, gfx::ImageSkia* wallpaper); // Returns filepath to save original custom wallpaper for the given user. - FilePath GetOriginalWallpaperPathForUser(const std::string& username); + base::FilePath GetOriginalWallpaperPathForUser(const std::string& username); // Returns small resolution custom wallpaper filepath for the given user when // |is_small| is ture. Otherwise, returns large resolution custom wallpaper // path. // TODO(bshe): Remove this function when all custom wallpapers moved to the // new direcotry. crbug.com/174925 - FilePath GetWallpaperPathForUser(const std::string& username, - bool is_small); + base::FilePath GetWallpaperPathForUser(const std::string& username, + bool is_small); // Gets wallpaper information of logged in user. bool GetLoggedInUserWallpaperInfo(WallpaperInfo* info); @@ -131,7 +131,7 @@ class WallpaperManager: public system::TimezoneSettings::Observer, // and |preferred_height| while maintaining aspect ratio. And saves the // resized wallpaper to |path|. void ResizeAndSaveWallpaper(const UserImage& wallpaper, - const FilePath& path, + const base::FilePath& path, ash::WallpaperLayout layout, int preferred_width, int preferred_height); @@ -205,7 +205,7 @@ class WallpaperManager: public system::TimezoneSettings::Observer, void ClearObsoleteWallpaperPrefs(); // Deletes a list of wallpaper files in |file_list|. - void DeleteWallpaperInList(const std::vector<FilePath>& file_list); + void DeleteWallpaperInList(const std::vector<base::FilePath>& file_list); // Deletes all |email| related custom or converted wallpapers. void DeleteUserWallpapers(const std::string& email); @@ -258,7 +258,7 @@ class WallpaperManager: public system::TimezoneSettings::Observer, // loaded wallpaper. Must run on wallpaper sequenced worker thread. void GetCustomWallpaperInternal(const std::string& email, const WallpaperInfo& info, - const FilePath& wallpaper_path, + const base::FilePath& wallpaper_path, bool update_wallpaper); // Gets wallpaper information of |email| from Local State or memory. Returns @@ -287,19 +287,20 @@ class WallpaperManager: public system::TimezoneSettings::Observer, // Saves original custom wallpaper to |path| (absolute path) on filesystem // and starts resizing operation of the custom wallpaper if necessary. void SaveCustomWallpaper(const std::string& email, - const FilePath& path, + const base::FilePath& path, ash::WallpaperLayout layout, const UserImage& wallpaper); // Saves wallpaper image raw |data| to |path| (absolute path) in file system. - void SaveWallpaperInternal(const FilePath& path, const char* data, int size); + void SaveWallpaperInternal(const base::FilePath& path, const char* data, + int size); // Starts to load wallpaper at |wallpaper_path|. If |wallpaper_path| is the // same as |current_wallpaper_path_|, do nothing. Must be called on UI thread. void StartLoad(const std::string& email, const WallpaperInfo& info, bool update_wallpaper, - const FilePath& wallpaper_path); + const base::FilePath& wallpaper_path); // Overridden from chromeos::PowerManagerObserver. virtual void SystemResumed(const base::TimeDelta& sleep_duration) OVERRIDE; @@ -320,7 +321,7 @@ class WallpaperManager: public system::TimezoneSettings::Observer, scoped_refptr<base::SequencedTaskRunner> task_runner_; // The file path of current loaded/loading custom/online wallpaper. - FilePath current_wallpaper_path_; + base::FilePath current_wallpaper_path_; // Loads user wallpaper from its file. scoped_refptr<UserImageLoader> wallpaper_loader_; diff --git a/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc b/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc index ea4c5e7..5a8017e 100644 --- a/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc +++ b/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc @@ -111,7 +111,7 @@ class WallpaperManagerBrowserTest : public CrosInProcessBrowserTest, // Saves bitmap |resource_id| to disk. void SaveUserWallpaperData(const std::string& username, - const FilePath& wallpaper_path, + const base::FilePath& wallpaper_path, int resource_id) { scoped_refptr<base::RefCountedStaticMemory> image_data( ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( @@ -188,12 +188,14 @@ IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, // Wait for default wallpaper loaded. WaitAsyncWallpaperLoad(); std::string id = base::Int64ToString(base::Time::Now().ToInternalValue()); - FilePath small_wallpaper_path = GetCustomWallpaperPath(kSmallWallpaperSubDir, - kTestUser1, - id); - FilePath large_wallpaper_path = GetCustomWallpaperPath(kLargeWallpaperSubDir, - kTestUser1, - id); + base::FilePath small_wallpaper_path = GetCustomWallpaperPath( + kSmallWallpaperSubDir, + kTestUser1, + id); + base::FilePath large_wallpaper_path = GetCustomWallpaperPath( + kLargeWallpaperSubDir, + kTestUser1, + id); // Saves the small/large resolution wallpapers to small/large custom // wallpaper paths. @@ -276,9 +278,10 @@ IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, // Change wallpaper to a custom wallpaper. std::string id = base::Int64ToString(base::Time::Now().ToInternalValue()); - FilePath small_wallpaper_path = GetCustomWallpaperPath(kSmallWallpaperSubDir, - kTestUser1, - id); + base::FilePath small_wallpaper_path = GetCustomWallpaperPath( + kSmallWallpaperSubDir, + kTestUser1, + id); SaveUserWallpaperData(kTestUser1, small_wallpaper_path, ash::kDefaultSmallWallpaper.idr); diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc index 4066f70..616218e 100644 --- a/chrome/browser/chromeos/login/wizard_controller.cc +++ b/chrome/browser/chromeos/login/wizard_controller.cc @@ -661,24 +661,24 @@ void WizardController::MarkOobeCompleted() { // completed. // On chrome device, returns /home/chronos/.oobe_completed. // On Linux desktop, returns $HOME/.oobe_completed. -static FilePath GetOobeCompleteFlagPath() { +static base::FilePath GetOobeCompleteFlagPath() { // The constant is defined here so it won't be referenced directly. const char kOobeCompleteFlagFilePath[] = "/home/chronos/.oobe_completed"; if (base::chromeos::IsRunningOnChromeOS()) { - return FilePath(kOobeCompleteFlagFilePath); + return base::FilePath(kOobeCompleteFlagFilePath); } else { const char* home = getenv("HOME"); // Unlikely but if HOME is not defined, use the current directory. if (!home) home = ""; - return FilePath(home).AppendASCII(".oobe_completed"); + return base::FilePath(home).AppendASCII(".oobe_completed"); } } static void CreateOobeCompleteFlagFile() { // Create flag file for boot-time init scripts. - FilePath oobe_complete_path = GetOobeCompleteFlagPath(); + base::FilePath oobe_complete_path = GetOobeCompleteFlagPath(); if (!file_util::PathExists(oobe_complete_path)) { FILE* oobe_flag_file = file_util::OpenFile(oobe_complete_path, "w+b"); if (oobe_flag_file == NULL) @@ -704,7 +704,7 @@ bool WizardController::IsDeviceRegistered() { // Pref is not set. For compatibility check flag file. It causes blocking // IO on UI thread. But it's required for update from old versions. base::ThreadRestrictions::ScopedAllowIO allow_io; - FilePath oobe_complete_flag_file_path = GetOobeCompleteFlagPath(); + base::FilePath oobe_complete_flag_file_path = GetOobeCompleteFlagPath(); bool file_exists = file_util::PathExists(oobe_complete_flag_file_path); SaveIntegerPreferenceForced(kDeviceRegistered, file_exists ? 1 : 0); return file_exists; diff --git a/chrome/browser/chromeos/mobile/mobile_activator.cc b/chrome/browser/chromeos/mobile/mobile_activator.cc index 71cb8f3..b55f041 100644 --- a/chrome/browser/chromeos/mobile/mobile_activator.cc +++ b/chrome/browser/chromeos/mobile/mobile_activator.cc @@ -88,7 +88,7 @@ std::string CellularConfigDocument::GetErrorMessage(const std::string& code) { void CellularConfigDocument::LoadCellularConfigFile() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); // Load partner customization startup manifest if it is available. - FilePath config_path(kCellularConfigPath); + base::FilePath config_path(kCellularConfigPath); if (!file_util::PathExists(config_path)) return; @@ -107,7 +107,7 @@ void CellularConfigDocument::SetErrorMap( error_map_.insert(map.begin(), map.end()); } -bool CellularConfigDocument::LoadFromFile(const FilePath& config_path) { +bool CellularConfigDocument::LoadFromFile(const base::FilePath& config_path) { std::string config; if (!file_util::ReadFileToString(config_path, &config)) return false; diff --git a/chrome/browser/chromeos/mobile/mobile_activator.h b/chrome/browser/chromeos/mobile/mobile_activator.h index c378f29..5848a55 100644 --- a/chrome/browser/chromeos/mobile/mobile_activator.h +++ b/chrome/browser/chromeos/mobile/mobile_activator.h @@ -37,7 +37,7 @@ class CellularConfigDocument virtual ~CellularConfigDocument(); void SetErrorMap(const ErrorMap& map); - bool LoadFromFile(const FilePath& config_path); + bool LoadFromFile(const base::FilePath& config_path); std::string version_; ErrorMap error_map_; diff --git a/chrome/browser/chromeos/mobile_config.cc b/chrome/browser/chromeos/mobile_config.cc index 0fbb479..eec29c7 100644 --- a/chrome/browser/chromeos/mobile_config.cc +++ b/chrome/browser/chromeos/mobile_config.cc @@ -323,8 +323,8 @@ void MobileConfig::LoadConfig() { BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(&MobileConfig::ReadConfigInBackground, base::Unretained(this), // this class is a singleton. - FilePath(kGlobalCarrierConfigPath), - FilePath(kLocalCarrierConfigPath))); + base::FilePath(kGlobalCarrierConfigPath), + base::FilePath(kLocalCarrierConfigPath))); } void MobileConfig::ProcessConfig(const std::string& global_config, @@ -353,8 +353,9 @@ void MobileConfig::ProcessConfig(const std::string& global_config, } } -void MobileConfig::ReadConfigInBackground(const FilePath& global_config_file, - const FilePath& local_config_file) { +void MobileConfig::ReadConfigInBackground( + const base::FilePath& global_config_file, + const base::FilePath& local_config_file) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); std::string global_config; std::string local_config; diff --git a/chrome/browser/chromeos/process_proxy/process_proxy.cc b/chrome/browser/chromeos/process_proxy/process_proxy.cc index b0d627a..ead1377 100644 --- a/chrome/browser/chromeos/process_proxy/process_proxy.cc +++ b/chrome/browser/chromeos/process_proxy/process_proxy.cc @@ -217,7 +217,8 @@ bool ProcessProxy::LaunchProcess(const std::string& command, int slave_fd, options.ctrl_terminal_fd = slave_fd; // Launch the process. - return base::LaunchProcess(CommandLine(FilePath(command)), options, pid); + return base::LaunchProcess(CommandLine(base::FilePath(command)), options, + pid); } void ProcessProxy::CloseAllFdPairs() { diff --git a/chrome/browser/chromeos/screensaver/screensaver_controller_browsertest.cc b/chrome/browser/chromeos/screensaver/screensaver_controller_browsertest.cc index 656ef80..a763b34 100644 --- a/chrome/browser/chromeos/screensaver/screensaver_controller_browsertest.cc +++ b/chrome/browser/chromeos/screensaver/screensaver_controller_browsertest.cc @@ -17,7 +17,7 @@ namespace { scoped_refptr<extensions::Extension> CreateTestScreensaverExtension() { scoped_refptr<extensions::Extension> extension = extensions::ExtensionBuilder() - .SetPath(FilePath()) + .SetPath(base::FilePath()) .SetManifest(extensions::DictionaryBuilder() .Set("name", "Screensaver Extension") .Set("version", "1") diff --git a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc index d9d6c69..f316153 100644 --- a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc +++ b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc @@ -245,7 +245,7 @@ TEST_F(DeviceSettingsProviderTest, PolicyLoadNotification) { TEST_F(DeviceSettingsProviderTest, StatsReportingMigration) { // Create the legacy consent file. - FilePath consent_file; + base::FilePath consent_file; ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &consent_file)); consent_file = consent_file.AppendASCII("Consent To Send Stats"); ASSERT_EQ(1, file_util::WriteFile(consent_file, "0", 1)); diff --git a/chrome/browser/chromeos/settings/owner_key_util.cc b/chrome/browser/chromeos/settings/owner_key_util.cc index 8bbdc01..e5aee02 100644 --- a/chrome/browser/chromeos/settings/owner_key_util.cc +++ b/chrome/browser/chromeos/settings/owner_key_util.cc @@ -17,7 +17,7 @@ namespace chromeos { // OwnerKeyUtil OwnerKeyUtil* OwnerKeyUtil::Create() { - return new OwnerKeyUtilImpl(FilePath(OwnerKeyUtilImpl::kOwnerKeyFile)); + return new OwnerKeyUtilImpl(base::FilePath(OwnerKeyUtilImpl::kOwnerKeyFile)); } OwnerKeyUtil::OwnerKeyUtil() {} @@ -30,7 +30,7 @@ OwnerKeyUtil::~OwnerKeyUtil() {} // static const char OwnerKeyUtilImpl::kOwnerKeyFile[] = "/var/lib/whitelist/owner.key"; -OwnerKeyUtilImpl::OwnerKeyUtilImpl(const FilePath& key_file) +OwnerKeyUtilImpl::OwnerKeyUtilImpl(const base::FilePath& key_file) : key_file_(key_file) {} OwnerKeyUtilImpl::~OwnerKeyUtilImpl() {} diff --git a/chrome/browser/chromeos/settings/owner_key_util_unittest.cc b/chrome/browser/chromeos/settings/owner_key_util_unittest.cc index 8f62299..9ac917c 100644 --- a/chrome/browser/chromeos/settings/owner_key_util_unittest.cc +++ b/chrome/browser/chromeos/settings/owner_key_util_unittest.cc @@ -59,7 +59,7 @@ class OwnerKeyUtilTest : public testing::Test { } base::ScopedTempDir tmpdir_; - FilePath key_file_; + base::FilePath key_file_; scoped_refptr<OwnerKeyUtil> util_; private: diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc index 0c5b636..d69e280 100644 --- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc +++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc @@ -597,7 +597,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, ActivateInputMethodProperty(key); } - virtual void CancelDriveOperation(const FilePath& file_path) OVERRIDE { + virtual void CancelDriveOperation(const base::FilePath& file_path) OVERRIDE { DriveSystemService* system_service = FindDriveSystemService(); if (!system_service) return; diff --git a/chrome/browser/chromeos/system/drm_settings.cc b/chrome/browser/chromeos/system/drm_settings.cc index d290859..7bb6fd7 100644 --- a/chrome/browser/chromeos/system/drm_settings.cc +++ b/chrome/browser/chromeos/system/drm_settings.cc @@ -40,10 +40,10 @@ void ManageDrmIdentifierOnFileThread(bool enable, const std::string& email) { // Drop the file under <data>/<profile>/<drm id file>. // TODO(wad) get the profile directory in a more succinct fashion. - FilePath drm_id_file; + base::FilePath drm_id_file; PathService::Get(chrome::DIR_USER_DATA, &drm_id_file); const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); - FilePath profile = cmd_line.GetSwitchValuePath(switches::kLoginProfile); + base::FilePath profile = cmd_line.GetSwitchValuePath(switches::kLoginProfile); if (profile.empty()) { LOG(ERROR) << "called with no login-profile!"; return; diff --git a/chrome/browser/chromeos/system/input_device_settings.cc b/chrome/browser/chromeos/system/input_device_settings.cc index 6b2f925..da16565 100644 --- a/chrome/browser/chromeos/system/input_device_settings.cc +++ b/chrome/browser/chromeos/system/input_device_settings.cc @@ -28,7 +28,7 @@ const char kMouseControl[] = "/opt/google/mouse/mousecontrol"; bool ScriptExists(const std::string& script) { DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); - return file_util::PathExists(FilePath(script)); + return file_util::PathExists(base::FilePath(script)); } // Executes the input control script asynchronously, if it exists. diff --git a/chrome/browser/chromeos/system/name_value_pairs_parser.cc b/chrome/browser/chromeos/system/name_value_pairs_parser.cc index 2c89e7c..84928c7 100644 --- a/chrome/browser/chromeos/system/name_value_pairs_parser.cc +++ b/chrome/browser/chromeos/system/name_value_pairs_parser.cc @@ -24,7 +24,7 @@ const char kTrimChars[] = "\" "; bool GetToolOutput(int argc, const char* argv[], std::string& output) { DCHECK_GE(argc, 1); - if (!file_util::PathExists(FilePath(argv[0]))) { + if (!file_util::PathExists(base::FilePath(argv[0]))) { LOG(WARNING) << "Tool for statistics not found: " << argv[0]; return false; } @@ -118,9 +118,10 @@ bool NameValuePairsParser::GetSingleValueFromTool(int argc, return true; } -bool NameValuePairsParser::GetNameValuePairsFromFile(const FilePath& file_path, - const std::string& eq, - const std::string& delim) { +bool NameValuePairsParser::GetNameValuePairsFromFile( + const base::FilePath& file_path, + const std::string& eq, + const std::string& delim) { std::string contents; if (file_util::ReadFileToString(file_path, &contents)) { return ParseNameValuePairs(contents, eq, delim); diff --git a/chrome/browser/chromeos/system/power_manager_settings.cc b/chrome/browser/chromeos/system/power_manager_settings.cc index eb35311..d112b8d 100644 --- a/chrome/browser/chromeos/system/power_manager_settings.cc +++ b/chrome/browser/chromeos/system/power_manager_settings.cc @@ -23,7 +23,7 @@ void EnableScreenLockOnFileThread(bool enable) { if (base::chromeos::IsRunningOnChromeOS()) { std::string config = base::StringPrintf("%d", enable); - file_util::WriteFile(FilePath(kLockOnIdleSuspendPath), + file_util::WriteFile(base::FilePath(kLockOnIdleSuspendPath), config.c_str(), config.size()); } diff --git a/chrome/browser/chromeos/system/statistics_provider.cc b/chrome/browser/chromeos/system/statistics_provider.cc index d459b7c..c8b6d74 100644 --- a/chrome/browser/chromeos/system/statistics_provider.cc +++ b/chrome/browser/chromeos/system/statistics_provider.cc @@ -156,7 +156,7 @@ StatisticsProviderImpl::StatisticsProviderImpl() void StatisticsProviderImpl::LoadMachineOSInfoFile() { NameValuePairsParser parser(&machine_info_); - if (parser.GetNameValuePairsFromFile(FilePath(kMachineOSInfoFile), + if (parser.GetNameValuePairsFromFile(base::FilePath(kMachineOSInfoFile), kMachineOSInfoEq, kMachineOSInfoDelim)) { #if defined(GOOGLE_CHROME_BUILD) @@ -200,13 +200,13 @@ void StatisticsProviderImpl::LoadMachineStatistics() { else machine_info_[kHardwareClassKey] = hardware_class; - parser.GetNameValuePairsFromFile(FilePath(kMachineHardwareInfoFile), + parser.GetNameValuePairsFromFile(base::FilePath(kMachineHardwareInfoFile), kMachineHardwareInfoEq, kMachineHardwareInfoDelim); - parser.GetNameValuePairsFromFile(FilePath(kEchoCouponFile), + parser.GetNameValuePairsFromFile(base::FilePath(kEchoCouponFile), kEchoCouponEq, kEchoCouponDelim); - parser.GetNameValuePairsFromFile(FilePath(kVpdFile), kVpdEq, kVpdDelim); + parser.GetNameValuePairsFromFile(base::FilePath(kVpdFile), kVpdEq, kVpdDelim); // Finished loading the statistics. on_statistics_loaded_.Signal(); diff --git a/chrome/browser/chromeos/system/syslogs_provider.cc b/chrome/browser/chromeos/system/syslogs_provider.cc index 6837b7d..ac06731 100644 --- a/chrome/browser/chromeos/system/syslogs_provider.cc +++ b/chrome/browser/chromeos/system/syslogs_provider.cc @@ -118,10 +118,10 @@ std::string ReadValue(std::string* data) { // values are "sysinfo" or "feedback"; in case of an invalid // value, the script will currently default to "sysinfo" -LogDictionaryType* GetSystemLogs(FilePath* zip_file_name, +LogDictionaryType* GetSystemLogs(base::FilePath* zip_file_name, const std::string& context) { // Create the temp file, logs will go here - FilePath temp_filename; + base::FilePath temp_filename; if (!file_util::CreateTemporaryFile(&temp_filename)) return NULL; @@ -203,7 +203,7 @@ class SyslogsProviderImpl : public SyslogsProvider { const ReadCompleteCallback& callback); // Loads compressed logs and writes into |zip_content|. - void LoadCompressedLogs(const FilePath& zip_file, + void LoadCompressedLogs(const base::FilePath& zip_file, std::string* zip_content); SyslogsProviderImpl(); @@ -306,7 +306,7 @@ void SyslogsProviderImpl::ReadSyslogs( return; // Create temp file. - FilePath zip_file; + base::FilePath zip_file; if (compress_logs && !file_util::CreateTemporaryFile(&zip_file)) { LOG(ERROR) << "Cannot create temp file"; compress_logs = false; @@ -349,7 +349,7 @@ void SyslogsProviderImpl::ReadSyslogs( handler->StartFetch(MemoryDetails::UPDATE_USER_METRICS); } -void SyslogsProviderImpl::LoadCompressedLogs(const FilePath& zip_file, +void SyslogsProviderImpl::LoadCompressedLogs(const base::FilePath& zip_file, std::string* zip_content) { DCHECK(zip_content); if (!file_util::ReadFileToString(zip_file, zip_content)) { diff --git a/chrome/browser/chromeos/system/timezone_settings.cc b/chrome/browser/chromeos/system/timezone_settings.cc index 8b59301..7cd8e95 100644 --- a/chrome/browser/chromeos/system/timezone_settings.cc +++ b/chrome/browser/chromeos/system/timezone_settings.cc @@ -162,9 +162,9 @@ void SetTimezoneIDFromString(const std::string& id) { // We want to do this in an atomic way. So we are going to create the symlink // at kTimezoneSymlink2 and then move it to kTimezoneSymlink - FilePath timezone_symlink(kTimezoneSymlink); - FilePath timezone_symlink2(kTimezoneSymlink2); - FilePath timezone_file(kTimezoneFilesDir + id); + base::FilePath timezone_symlink(kTimezoneSymlink); + base::FilePath timezone_symlink2(kTimezoneSymlink2); + base::FilePath timezone_file(kTimezoneFilesDir + id); // Make sure timezone_file exists. if (!file_util::PathExists(timezone_file)) { diff --git a/chrome/browser/chromeos/system_logs/command_line_log_source.cc b/chrome/browser/chromeos/system_logs/command_line_log_source.cc index d127278..55e5548 100644 --- a/chrome/browser/chromeos/system_logs/command_line_log_source.cc +++ b/chrome/browser/chromeos/system_logs/command_line_log_source.cc @@ -24,37 +24,38 @@ void ExecuteCommandLines(chromeos::SystemLogsResponse* response) { // it more easier to modify and understand. std::vector<std::pair<std::string, CommandLine> > commands; - CommandLine command(FilePath("/usr/bin/amixer")); + CommandLine command(base::FilePath("/usr/bin/amixer")); command.AppendArg("-c0"); command.AppendArg("contents"); commands.push_back(std::make_pair("alsa controls", command)); - command = CommandLine((FilePath("/usr/bin/cras_test_client"))); + command = CommandLine((base::FilePath("/usr/bin/cras_test_client"))); command.AppendArg("--dump_server_info"); commands.push_back(std::make_pair("cras", command)); - command = CommandLine((FilePath("/usr/bin/printenv"))); + command = CommandLine((base::FilePath("/usr/bin/printenv"))); commands.push_back(std::make_pair("env", command)); - command = CommandLine(FilePath("/usr/bin/setxkbmap")); + command = CommandLine(base::FilePath("/usr/bin/setxkbmap")); command.AppendArg("-print"); command.AppendArg("-query"); commands.push_back(std::make_pair("setxkbmap", command)); - command = CommandLine(FilePath("/usr/bin/xinput")); + command = CommandLine(base::FilePath("/usr/bin/xinput")); command.AppendArg("list"); command.AppendArg("--long"); commands.push_back(std::make_pair("xinput", command)); - command = CommandLine(FilePath("/usr/bin/xrandr")); + command = CommandLine(base::FilePath("/usr/bin/xrandr")); command.AppendArg("--verbose"); commands.push_back(std::make_pair("xrandr", command)); - command = CommandLine(FilePath("/opt/google/touchpad/tpcontrol")); + command = CommandLine(base::FilePath("/opt/google/touchpad/tpcontrol")); command.AppendArg("status"); commands.push_back(std::make_pair("hack-33025-touchpad", command)); - command = CommandLine(FilePath("/opt/google/touchpad/generate_userfeedback")); + command = + CommandLine(base::FilePath("/opt/google/touchpad/generate_userfeedback")); commands.push_back(std::make_pair("hack-33025-touchpad_activity", command)); for (size_t i = 0; i < commands.size(); ++i) { diff --git a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc index 22f4ea8..692cdfc 100644 --- a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc +++ b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc @@ -139,7 +139,7 @@ void DebugDaemonLogSource::ReadUserLogFiles(const KeyValueMap& user_log_files) { ++it) { std::string value; bool read_success = file_util::ReadFileToString( - FilePath(it->second), &value); + base::FilePath(it->second), &value); if (read_success && !value.empty()) (*response_)[it->first] = value; else diff --git a/chrome/browser/chromeos/system_logs/lsb_release_log_source.cc b/chrome/browser/chromeos/system_logs/lsb_release_log_source.cc index 645a56b..56c3496 100644 --- a/chrome/browser/chromeos/system_logs/lsb_release_log_source.cc +++ b/chrome/browser/chromeos/system_logs/lsb_release_log_source.cc @@ -42,7 +42,7 @@ void LsbReleaseLogSource::Fetch(const SysLogsSourceCallback& callback) { void LsbReleaseLogSource::ReadLSBRelease(SystemLogsResponse* response) { DCHECK(response); - const FilePath lsb_release_file("/etc/lsb-release"); + const base::FilePath lsb_release_file("/etc/lsb-release"); std::string lsb_data; bool read_success = file_util::ReadFileToString(lsb_release_file, &lsb_data); // if we were using an internal temp file, the user does not need the diff --git a/chrome/browser/chromeos/version_loader.cc b/chrome/browser/chromeos/version_loader.cc index 5258928..6334b16 100644 --- a/chrome/browser/chromeos/version_loader.cc +++ b/chrome/browser/chromeos/version_loader.cc @@ -134,7 +134,7 @@ void VersionLoader::Backend::GetVersion(VersionFormat format, DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); std::string contents; - const FilePath file_path(kPathVersion); + const base::FilePath file_path(kPathVersion); if (file_util::ReadFileToString(file_path, &contents)) { *version = ParseVersion( contents, @@ -158,7 +158,7 @@ void VersionLoader::Backend::GetFirmware(std::string* firmware) { DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); std::string contents; - const FilePath file_path(kPathFirmware); + const base::FilePath file_path(kPathFirmware); if (file_util::ReadFileToString(file_path, &contents)) { *firmware = ParseFirmware(contents); } |