OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 file = entry->AsGDataFile(); | 1030 file = entry->AsGDataFile(); |
1031 | 1031 |
1032 if (file) { | 1032 if (file) { |
1033 delegate->OnDone(base::PLATFORM_FILE_OK, file->parent()->GetFilePath(), | 1033 delegate->OnDone(base::PLATFORM_FILE_OK, file->parent()->GetFilePath(), |
1034 file); | 1034 file); |
1035 } else { | 1035 } else { |
1036 delegate->OnDone(base::PLATFORM_FILE_ERROR_NOT_FOUND, FilePath(), NULL); | 1036 delegate->OnDone(base::PLATFORM_FILE_ERROR_NOT_FOUND, FilePath(), NULL); |
1037 } | 1037 } |
1038 } | 1038 } |
1039 | 1039 |
1040 void GDataFileSystem::FindEntryByPathAsync( | |
1041 const FilePath& search_file_path, | |
1042 const FindEntryCallback& callback) { | |
1043 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | |
1044 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
1045 const bool posted = BrowserThread::PostTask( | |
1046 BrowserThread::UI, | |
1047 FROM_HERE, | |
1048 base::Bind(&GDataFileSystem::FindEntryByPathAsyncOnUIThread, | |
1049 ui_weak_ptr_, | |
1050 search_file_path, | |
1051 base::Bind(&RelayFindEntryCallback, | |
1052 base::MessageLoopProxy::current(), | |
1053 callback))); | |
1054 DCHECK(posted); | |
1055 return; | |
1056 } | |
1057 | |
1058 FindEntryByPathAsyncOnUIThread(search_file_path, callback); | |
1059 } | |
1060 | |
1061 void GDataFileSystem::FindEntryByPathAsyncOnUIThread( | 1040 void GDataFileSystem::FindEntryByPathAsyncOnUIThread( |
1062 const FilePath& search_file_path, | 1041 const FilePath& search_file_path, |
1063 const FindEntryCallback& callback) { | 1042 const FindEntryCallback& callback) { |
1064 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1043 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1065 | 1044 |
1066 base::AutoLock lock(lock_); | 1045 base::AutoLock lock(lock_); |
1067 if (root_->origin() == INITIALIZING) { | 1046 if (root_->origin() == INITIALIZING) { |
1068 // If root feed is not initialized but the initilization process has | 1047 // If root feed is not initialized but the initilization process has |
1069 // already started, add an observer to execute the remaining task after | 1048 // already started, add an observer to execute the remaining task after |
1070 // the end of the initialization. | 1049 // the end of the initialization. |
(...skipping 3717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4788 pref_registrar_->Init(profile_->GetPrefs()); | 4767 pref_registrar_->Init(profile_->GetPrefs()); |
4789 pref_registrar_->Add(prefs::kDisableGDataHostedFiles, this); | 4768 pref_registrar_->Add(prefs::kDisableGDataHostedFiles, this); |
4790 } | 4769 } |
4791 | 4770 |
4792 void SetFreeDiskSpaceGetterForTesting(FreeDiskSpaceGetterInterface* getter) { | 4771 void SetFreeDiskSpaceGetterForTesting(FreeDiskSpaceGetterInterface* getter) { |
4793 delete global_free_disk_getter_for_testing; // Safe to delete NULL; | 4772 delete global_free_disk_getter_for_testing; // Safe to delete NULL; |
4794 global_free_disk_getter_for_testing = getter; | 4773 global_free_disk_getter_for_testing = getter; |
4795 } | 4774 } |
4796 | 4775 |
4797 } // namespace gdata | 4776 } // namespace gdata |
OLD | NEW |