| 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 <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1898 } | 1898 } |
| 1899 | 1899 |
| 1900 void GDataFileSystem::GetResolvedFileByPath( | 1900 void GDataFileSystem::GetResolvedFileByPath( |
| 1901 const FilePath& file_path, | 1901 const FilePath& file_path, |
| 1902 const GetFileCallback& get_file_callback, | 1902 const GetFileCallback& get_file_callback, |
| 1903 const GetDownloadDataCallback& get_download_data_callback, | 1903 const GetDownloadDataCallback& get_download_data_callback, |
| 1904 GDataFileError error, | 1904 GDataFileError error, |
| 1905 const GDataEntryProto* entry_proto) { | 1905 const GDataEntryProto* entry_proto) { |
| 1906 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1906 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1907 | 1907 |
| 1908 if (!entry_proto->has_file_specific_info()) | 1908 if (entry_proto.get() && !entry_proto->has_file_specific_info()) |
| 1909 error = GDATA_FILE_ERROR_NOT_FOUND; | 1909 error = GDATA_FILE_ERROR_NOT_FOUND; |
| 1910 | 1910 |
| 1911 if (error != GDATA_FILE_OK) { | 1911 if (error != GDATA_FILE_OK) { |
| 1912 if (!get_file_callback.is_null()) { | 1912 if (!get_file_callback.is_null()) { |
| 1913 MessageLoop::current()->PostTask( | 1913 MessageLoop::current()->PostTask( |
| 1914 FROM_HERE, | 1914 FROM_HERE, |
| 1915 base::Bind(get_file_callback, | 1915 base::Bind(get_file_callback, |
| 1916 GDATA_FILE_ERROR_NOT_FOUND, | 1916 GDATA_FILE_ERROR_NOT_FOUND, |
| 1917 FilePath(), | 1917 FilePath(), |
| 1918 std::string(), | 1918 std::string(), |
| (...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3786 callback))); | 3786 callback))); |
| 3787 } | 3787 } |
| 3788 | 3788 |
| 3789 void GDataFileSystem::OnGetEntryInfoCompleteForOpenFile( | 3789 void GDataFileSystem::OnGetEntryInfoCompleteForOpenFile( |
| 3790 const FilePath& file_path, | 3790 const FilePath& file_path, |
| 3791 const OpenFileCallback& callback, | 3791 const OpenFileCallback& callback, |
| 3792 GDataFileError error, | 3792 GDataFileError error, |
| 3793 scoped_ptr<GDataEntryProto> entry_proto) { | 3793 scoped_ptr<GDataEntryProto> entry_proto) { |
| 3794 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 3794 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 3795 | 3795 |
| 3796 if (!entry_proto->has_file_specific_info()) | 3796 if (entry_proto.get() && !entry_proto->has_file_specific_info()) |
| 3797 error = GDATA_FILE_ERROR_NOT_FOUND; | 3797 error = GDATA_FILE_ERROR_NOT_FOUND; |
| 3798 | 3798 |
| 3799 if (error == GDATA_FILE_OK) { | 3799 if (error == GDATA_FILE_OK) { |
| 3800 if (entry_proto->file_specific_info().file_md5().empty() || | 3800 if (entry_proto->file_specific_info().file_md5().empty() || |
| 3801 entry_proto->file_specific_info().is_hosted_document()) { | 3801 entry_proto->file_specific_info().is_hosted_document()) { |
| 3802 // No support for opening a directory or hosted document. | 3802 // No support for opening a directory or hosted document. |
| 3803 error = GDATA_FILE_ERROR_INVALID_OPERATION; | 3803 error = GDATA_FILE_ERROR_INVALID_OPERATION; |
| 3804 } | 3804 } |
| 3805 } | 3805 } |
| 3806 | 3806 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3911 ui_weak_ptr_, | 3911 ui_weak_ptr_, |
| 3912 file_path, | 3912 file_path, |
| 3913 callback))); | 3913 callback))); |
| 3914 } | 3914 } |
| 3915 | 3915 |
| 3916 void GDataFileSystem::OnGetEntryInfoCompleteForCloseFile( | 3916 void GDataFileSystem::OnGetEntryInfoCompleteForCloseFile( |
| 3917 const FilePath& file_path, | 3917 const FilePath& file_path, |
| 3918 const FileOperationCallback& callback, | 3918 const FileOperationCallback& callback, |
| 3919 GDataFileError error, | 3919 GDataFileError error, |
| 3920 scoped_ptr<GDataEntryProto> entry_proto) { | 3920 scoped_ptr<GDataEntryProto> entry_proto) { |
| 3921 if (!entry_proto->has_file_specific_info()) | 3921 if (entry_proto.get() && !entry_proto->has_file_specific_info()) |
| 3922 error = GDATA_FILE_ERROR_NOT_FOUND; | 3922 error = GDATA_FILE_ERROR_NOT_FOUND; |
| 3923 | 3923 |
| 3924 if (error != GDATA_FILE_OK) { | 3924 if (error != GDATA_FILE_OK) { |
| 3925 if (!callback.is_null()) | 3925 if (!callback.is_null()) |
| 3926 callback.Run(error); | 3926 callback.Run(error); |
| 3927 return; | 3927 return; |
| 3928 } | 3928 } |
| 3929 | 3929 |
| 3930 // Step 2 of CloseFile: Get the local path of the cache. Since CloseFile must | 3930 // Step 2 of CloseFile: Get the local path of the cache. Since CloseFile must |
| 3931 // always be called on paths opened by OpenFile, the file must be cached, | 3931 // always be called on paths opened by OpenFile, the file must be cached, |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4063 // must go through here. Removes the |file_path| from the remembered set so | 4063 // must go through here. Removes the |file_path| from the remembered set so |
| 4064 // that subsequent operations can open the file again. | 4064 // that subsequent operations can open the file again. |
| 4065 open_files_.erase(file_path); | 4065 open_files_.erase(file_path); |
| 4066 | 4066 |
| 4067 // Then invokes the user-supplied callback function. | 4067 // Then invokes the user-supplied callback function. |
| 4068 if (!callback.is_null()) | 4068 if (!callback.is_null()) |
| 4069 callback.Run(result); | 4069 callback.Run(result); |
| 4070 } | 4070 } |
| 4071 | 4071 |
| 4072 } // namespace gdata | 4072 } // namespace gdata |
| OLD | NEW |