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

Side by Side Diff: Source/modules/filesystem/FileSystemCallbacks.cpp

Issue 23537011: FileAPI: Add WebFileSystem::resolveURL (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 7 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 189 }
190 190
191 RefPtr<EntryCallback> m_successCallback; 191 RefPtr<EntryCallback> m_successCallback;
192 RefPtr<ErrorCallback> m_errorCallback; 192 RefPtr<ErrorCallback> m_errorCallback;
193 RefPtr<DirectoryEntry> m_root; 193 RefPtr<DirectoryEntry> m_root;
194 String m_filePath; 194 String m_filePath;
195 }; 195 };
196 196
197 } // namespace 197 } // namespace
198 198
199 PassOwnPtr<AsyncFileSystemCallbacks> ResolveURICallbacks::create(PassRefPtr<Entr yCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, ScriptExecu tionContext* scriptExecutionContext, FileSystemType type, const String& filePath ) 199 PassOwnPtr<AsyncFileSystemCallbacks> ResolveURICallbacks::create(PassRefPtr<Entr yCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, ScriptExecu tionContext* scriptExecutionContext)
200 { 200 {
201 return adoptPtr(static_cast<AsyncFileSystemCallbacks*>(new ResolveURICallbac ks(successCallback, errorCallback, scriptExecutionContext, type, filePath))); 201 return adoptPtr(static_cast<AsyncFileSystemCallbacks*>(new ResolveURICallbac ks(successCallback, errorCallback, scriptExecutionContext)));
202 } 202 }
203 203
204 ResolveURICallbacks::ResolveURICallbacks(PassRefPtr<EntryCallback> successCallba ck, PassRefPtr<ErrorCallback> errorCallback, ScriptExecutionContext* context, Fi leSystemType type, const String& filePath) 204 ResolveURICallbacks::ResolveURICallbacks(PassRefPtr<EntryCallback> successCallba ck, PassRefPtr<ErrorCallback> errorCallback, ScriptExecutionContext* context)
205 : FileSystemCallbacksBase(errorCallback, 0) 205 : FileSystemCallbacksBase(errorCallback, 0)
206 , m_successCallback(successCallback) 206 , m_successCallback(successCallback)
207 , m_scriptExecutionContext(context) 207 , m_scriptExecutionContext(context)
208 , m_type(type)
209 , m_filePath(filePath)
210 { 208 {
211 } 209 }
212 210
213 void ResolveURICallbacks::didOpenFileSystem(const String& name, const KURL& root URL)
214 {
215 RefPtr<DirectoryEntry> root = DOMFileSystem::create(m_scriptExecutionContext .get(), name, m_type, rootURL)->root();
216 root->getDirectory(m_filePath, Dictionary(), m_successCallback, ErrorCallbac kWrapper::create(m_successCallback, m_errorCallback, root, m_filePath));
217 }
218
219 void ResolveURICallbacks::didResolveURL(const String& name, const KURL& rootURL, FileSystemType type, const String& filePath, bool isDirectory) 211 void ResolveURICallbacks::didResolveURL(const String& name, const KURL& rootURL, FileSystemType type, const String& filePath, bool isDirectory)
220 { 212 {
221 RefPtr<DOMFileSystem> filesystem = DOMFileSystem::create(m_scriptExecutionCo ntext.get(), name, type, rootURL); 213 RefPtr<DOMFileSystem> filesystem = DOMFileSystem::create(m_scriptExecutionCo ntext.get(), name, type, rootURL);
222 RefPtr<DirectoryEntry> root = filesystem->root(); 214 RefPtr<DirectoryEntry> root = filesystem->root();
223 215
224 String absolutePath; 216 String absolutePath;
225 if (!DOMFileSystemBase::pathToAbsolutePath(type, root.get(), filePath, absol utePath)) { 217 if (!DOMFileSystemBase::pathToAbsolutePath(type, root.get(), filePath, absol utePath)) {
226 m_errorCallback->handleEvent(FileError::create(FileError::INVALID_MODIFI CATION_ERR).get()); 218 m_errorCallback->handleEvent(FileError::create(FileError::INVALID_MODIFI CATION_ERR).get());
227 m_errorCallback.clear(); 219 m_errorCallback.clear();
228 return; 220 return;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 } 283 }
292 284
293 void VoidCallbacks::didSucceed() 285 void VoidCallbacks::didSucceed()
294 { 286 {
295 if (m_successCallback) 287 if (m_successCallback)
296 m_successCallback->handleEvent(); 288 m_successCallback->handleEvent();
297 m_successCallback.clear(); 289 m_successCallback.clear();
298 } 290 }
299 291
300 } // namespace 292 } // namespace
OLDNEW
« no previous file with comments | « Source/modules/filesystem/FileSystemCallbacks.h ('k') | Source/modules/filesystem/LocalFileSystem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698