| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/drive/fileapi/file_system_backend_delegate.h" | 5 #include "chrome/browser/chromeos/drive/fileapi/file_system_backend_delegate.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/chromeos/drive/file_system_interface.h" | 10 #include "chrome/browser/chromeos/drive/file_system_interface.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 const storage::URLCallback& callback) { | 49 const storage::URLCallback& callback) { |
| 50 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 50 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 51 FileSystemInterface* const file_system = | 51 FileSystemInterface* const file_system = |
| 52 fileapi_internal::GetFileSystemFromUrl(url); | 52 fileapi_internal::GetFileSystemFromUrl(url); |
| 53 if (!file_system) { | 53 if (!file_system) { |
| 54 BrowserThread::PostTask( | 54 BrowserThread::PostTask( |
| 55 BrowserThread::IO, FROM_HERE, base::Bind(callback, GURL())); | 55 BrowserThread::IO, FROM_HERE, base::Bind(callback, GURL())); |
| 56 return; | 56 return; |
| 57 } | 57 } |
| 58 const base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url); | 58 const base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url); |
| 59 if (file_path.empty()) { |
| 60 callback.Run(GURL()); |
| 61 return; |
| 62 } |
| 63 |
| 59 file_system->GetResourceEntry( | 64 file_system->GetResourceEntry( |
| 60 file_path, | 65 file_path, |
| 61 base::Bind(&GetRedirectURLForContentsOnUIThreadWithResourceEntry, | 66 base::Bind(&GetRedirectURLForContentsOnUIThreadWithResourceEntry, |
| 62 callback)); | 67 callback)); |
| 63 } | 68 } |
| 64 | 69 |
| 65 } // namespace | 70 } // namespace |
| 66 | 71 |
| 67 FileSystemBackendDelegate::FileSystemBackendDelegate() | 72 FileSystemBackendDelegate::FileSystemBackendDelegate() |
| 68 : async_file_util_(new internal::AsyncFileUtil) { | 73 : async_file_util_(new internal::AsyncFileUtil) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 const storage::FileSystemURL& url, | 136 const storage::FileSystemURL& url, |
| 132 const storage::URLCallback& callback) { | 137 const storage::URLCallback& callback) { |
| 133 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 138 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 134 BrowserThread::PostTask( | 139 BrowserThread::PostTask( |
| 135 BrowserThread::UI, | 140 BrowserThread::UI, |
| 136 FROM_HERE, | 141 FROM_HERE, |
| 137 base::Bind(&GetRedirectURLForContentsOnUIThread, url, callback)); | 142 base::Bind(&GetRedirectURLForContentsOnUIThread, url, callback)); |
| 138 } | 143 } |
| 139 | 144 |
| 140 } // namespace drive | 145 } // namespace drive |
| OLD | NEW |