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 BrowserThread::PostTask( |
| 61 BrowserThread::IO, FROM_HERE, base::Bind(callback, GURL())); |
| 62 return; |
| 63 } |
| 64 |
59 file_system->GetResourceEntry( | 65 file_system->GetResourceEntry( |
60 file_path, | 66 file_path, |
61 base::Bind(&GetRedirectURLForContentsOnUIThreadWithResourceEntry, | 67 base::Bind(&GetRedirectURLForContentsOnUIThreadWithResourceEntry, |
62 callback)); | 68 callback)); |
63 } | 69 } |
64 | 70 |
65 } // namespace | 71 } // namespace |
66 | 72 |
67 FileSystemBackendDelegate::FileSystemBackendDelegate() | 73 FileSystemBackendDelegate::FileSystemBackendDelegate() |
68 : async_file_util_(new internal::AsyncFileUtil) { | 74 : async_file_util_(new internal::AsyncFileUtil) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 const storage::FileSystemURL& url, | 138 const storage::FileSystemURL& url, |
133 const storage::URLCallback& callback) { | 139 const storage::URLCallback& callback) { |
134 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 140 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
135 BrowserThread::PostTask( | 141 BrowserThread::PostTask( |
136 BrowserThread::UI, | 142 BrowserThread::UI, |
137 FROM_HERE, | 143 FROM_HERE, |
138 base::Bind(&GetRedirectURLForContentsOnUIThread, url, callback)); | 144 base::Bind(&GetRedirectURLForContentsOnUIThread, url, callback)); |
139 } | 145 } |
140 | 146 |
141 } // namespace drive | 147 } // namespace drive |
OLD | NEW |