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()); | |
kinaba
2014/09/24 02:11:13
It looks you have to post to IO thread (as the !fi
hirono
2014/09/24 03:40:17
Thank you for catching it. Done.
| |
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 const storage::FileSystemURL& url, | 137 const storage::FileSystemURL& url, |
133 const storage::URLCallback& callback) { | 138 const storage::URLCallback& callback) { |
134 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 139 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
135 BrowserThread::PostTask( | 140 BrowserThread::PostTask( |
136 BrowserThread::UI, | 141 BrowserThread::UI, |
137 FROM_HERE, | 142 FROM_HERE, |
138 base::Bind(&GetRedirectURLForContentsOnUIThread, url, callback)); | 143 base::Bind(&GetRedirectURLForContentsOnUIThread, url, callback)); |
139 } | 144 } |
140 | 145 |
141 } // namespace drive | 146 } // namespace drive |
OLD | NEW |