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

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

Issue 2040563002: Remove FileError interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fe-dep
Patch Set: Rebased, and closure annotations Created 4 years, 6 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 FileSystemCallbacksBase::~FileSystemCallbacksBase() 68 FileSystemCallbacksBase::~FileSystemCallbacksBase()
69 { 69 {
70 if (m_fileSystem) 70 if (m_fileSystem)
71 m_fileSystem->removePendingCallbacks(); 71 m_fileSystem->removePendingCallbacks();
72 } 72 }
73 73
74 void FileSystemCallbacksBase::didFail(int code) 74 void FileSystemCallbacksBase::didFail(int code)
75 { 75 {
76 if (m_errorCallback) 76 if (m_errorCallback)
77 handleEventOrScheduleCallback(m_errorCallback.release(), FileError::crea te(static_cast<FileError::ErrorCode>(code))); 77 handleEventOrScheduleCallback(m_errorCallback.release(), static_cast<Fil eError::ErrorCode>(code));
78 } 78 }
79 79
80 bool FileSystemCallbacksBase::shouldScheduleCallback() const 80 bool FileSystemCallbacksBase::shouldScheduleCallback() const
81 { 81 {
82 return !shouldBlockUntilCompletion() && m_executionContext && m_executionCon text->activeDOMObjectsAreSuspended(); 82 return !shouldBlockUntilCompletion() && m_executionContext && m_executionCon text->activeDOMObjectsAreSuspended();
83 } 83 }
84 84
85 template <typename CB, typename CBArg> 85 template <typename CB, typename CBArg>
86 void FileSystemCallbacksBase::handleEventOrScheduleCallback(CB* callback, CBArg* arg) 86 void FileSystemCallbacksBase::handleEventOrScheduleCallback(CB* callback, CBArg arg)
87 { 87 {
88 ASSERT(callback); 88 ASSERT(callback);
89 if (shouldScheduleCallback()) 89 if (shouldScheduleCallback())
90 DOMFileSystem::scheduleCallback(m_executionContext.get(), callback, arg) ; 90 DOMFileSystem::scheduleCallback(m_executionContext.get(), callback, arg) ;
91 else if (callback) 91 else if (callback)
92 callback->handleEvent(arg); 92 callback->handleEvent(arg);
93 m_executionContext.clear(); 93 m_executionContext.clear();
94 } 94 }
95 95
96 template <typename CB> 96 template <typename CB>
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 { 196 {
197 } 197 }
198 198
199 void ResolveURICallbacks::didResolveURL(const String& name, const KURL& rootURL, FileSystemType type, const String& filePath, bool isDirectory) 199 void ResolveURICallbacks::didResolveURL(const String& name, const KURL& rootURL, FileSystemType type, const String& filePath, bool isDirectory)
200 { 200 {
201 DOMFileSystem* filesystem = DOMFileSystem::create(m_executionContext.get(), name, type, rootURL); 201 DOMFileSystem* filesystem = DOMFileSystem::create(m_executionContext.get(), name, type, rootURL);
202 DirectoryEntry* root = filesystem->root(); 202 DirectoryEntry* root = filesystem->root();
203 203
204 String absolutePath; 204 String absolutePath;
205 if (!DOMFileSystemBase::pathToAbsolutePath(type, root, filePath, absolutePat h)) { 205 if (!DOMFileSystemBase::pathToAbsolutePath(type, root, filePath, absolutePat h)) {
206 handleEventOrScheduleCallback(m_errorCallback.release(), FileError::crea te(FileError::INVALID_MODIFICATION_ERR)); 206 handleEventOrScheduleCallback(m_errorCallback.release(), FileError::INVA LID_MODIFICATION_ERR);
207 return; 207 return;
208 } 208 }
209 209
210 if (isDirectory) 210 if (isDirectory)
211 handleEventOrScheduleCallback(m_successCallback.release(), DirectoryEntr y::create(filesystem, absolutePath)); 211 handleEventOrScheduleCallback(m_successCallback.release(), DirectoryEntr y::create(filesystem, absolutePath));
212 else 212 else
213 handleEventOrScheduleCallback(m_successCallback.release(), FileEntry::cr eate(filesystem, absolutePath)); 213 handleEventOrScheduleCallback(m_successCallback.release(), FileEntry::cr eate(filesystem, absolutePath));
214 } 214 }
215 215
216 // MetadataCallbacks ---------------------------------------------------------- 216 // MetadataCallbacks ----------------------------------------------------------
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 { 294 {
295 } 295 }
296 296
297 void VoidCallbacks::didSucceed() 297 void VoidCallbacks::didSucceed()
298 { 298 {
299 if (m_successCallback) 299 if (m_successCallback)
300 handleEventOrScheduleCallback(m_successCallback.release()); 300 handleEventOrScheduleCallback(m_successCallback.release());
301 } 301 }
302 302
303 } // namespace blink 303 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698