Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(796)

Side by Side Diff: webkit/chromeos/fileapi/cros_mount_point_provider.cc

Issue 9372044: Refactor FileSystemOperation to take callback for each method. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reflected kinuko's comments + Fixture for failing-Write -> Cancel pattern. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "webkit/chromeos/fileapi/cros_mount_point_provider.h" 5 #include "webkit/chromeos/fileapi/cros_mount_point_provider.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
11 #include "base/stringprintf.h" 11 #include "base/stringprintf.h"
12 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h " 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h "
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSyste m.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSyste m.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
18 #include "webkit/chromeos/fileapi/file_access_permissions.h" 18 #include "webkit/chromeos/fileapi/file_access_permissions.h"
19 #include "webkit/fileapi/file_system_callback_dispatcher.h"
20 #include "webkit/fileapi/file_system_operation.h" 19 #include "webkit/fileapi/file_system_operation.h"
21 #include "webkit/fileapi/file_system_util.h" 20 #include "webkit/fileapi/file_system_util.h"
22 #include "webkit/fileapi/native_file_util.h" 21 #include "webkit/fileapi/native_file_util.h"
23 #include "webkit/glue/webkit_glue.h" 22 #include "webkit/glue/webkit_glue.h"
24 23
25 namespace chromeos { 24 namespace chromeos {
26 25
27 typedef struct { 26 typedef struct {
28 const char* local_root_path; 27 const char* local_root_path;
29 const char* web_root_path; 28 const char* web_root_path;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 177
179 fileapi::FileSystemFileUtil* CrosMountPointProvider::GetFileUtil() { 178 fileapi::FileSystemFileUtil* CrosMountPointProvider::GetFileUtil() {
180 return local_file_util_.get(); 179 return local_file_util_.get();
181 } 180 }
182 181
183 fileapi::FileSystemOperationInterface* 182 fileapi::FileSystemOperationInterface*
184 CrosMountPointProvider::CreateFileSystemOperation( 183 CrosMountPointProvider::CreateFileSystemOperation(
185 const GURL& origin_url, 184 const GURL& origin_url,
186 fileapi::FileSystemType file_system_type, 185 fileapi::FileSystemType file_system_type,
187 const FilePath& virtual_path, 186 const FilePath& virtual_path,
188 scoped_ptr<fileapi::FileSystemCallbackDispatcher> dispatcher,
189 base::MessageLoopProxy* file_proxy, 187 base::MessageLoopProxy* file_proxy,
190 fileapi::FileSystemContext* context) const { 188 fileapi::FileSystemContext* context) const {
191 // TODO(satorux,zel): instantiate appropriate FileSystemOperation that 189 // TODO(satorux,zel): instantiate appropriate FileSystemOperation that
192 // implements async/remote operations. 190 // implements async/remote operations.
193 return new fileapi::FileSystemOperation( 191 return new fileapi::FileSystemOperation(file_proxy, context);
194 dispatcher.Pass(), file_proxy, context);
195 } 192 }
196 193
197 bool CrosMountPointProvider::GetVirtualPath(const FilePath& filesystem_path, 194 bool CrosMountPointProvider::GetVirtualPath(const FilePath& filesystem_path,
198 FilePath* virtual_path) { 195 FilePath* virtual_path) {
199 for (MountPointMap::const_iterator iter = mount_point_map_.begin(); 196 for (MountPointMap::const_iterator iter = mount_point_map_.begin();
200 iter != mount_point_map_.end(); 197 iter != mount_point_map_.end();
201 ++iter) { 198 ++iter) {
202 FilePath mount_prefix = iter->second.Append(iter->first); 199 FilePath mount_prefix = iter->second.Append(iter->first);
203 *virtual_path = FilePath(iter->first); 200 *virtual_path = FilePath(iter->first);
204 if (mount_prefix == filesystem_path) { 201 if (mount_prefix == filesystem_path) {
205 return true; 202 return true;
206 } else if (mount_prefix.AppendRelativePath(filesystem_path, virtual_path)) { 203 } else if (mount_prefix.AppendRelativePath(filesystem_path, virtual_path)) {
207 return true; 204 return true;
208 } 205 }
209 } 206 }
210 return false; 207 return false;
211 } 208 }
212 209
213 } // namespace chromeos 210 } // namespace chromeos
OLDNEW
« no previous file with comments | « webkit/chromeos/fileapi/cros_mount_point_provider.h ('k') | webkit/fileapi/file_system_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698