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

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

Issue 2040563002: Remove FileError interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fe-dep
Patch Set: handleEvent -> invoke and other review nits Created 4 years, 5 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) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 2012, 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 met: 5 * modification, are permitted provided that the following conditions are met:
6 * 6 *
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 return; 48 return;
49 49
50 Document* document = window.document(); 50 Document* document = window.document();
51 if (!document) 51 if (!document)
52 return; 52 return;
53 53
54 if (SchemeRegistry::schemeShouldBypassContentSecurityPolicy(document->getSec urityOrigin()->protocol())) 54 if (SchemeRegistry::schemeShouldBypassContentSecurityPolicy(document->getSec urityOrigin()->protocol()))
55 UseCounter::count(document, UseCounter::RequestFileSystemNonWebbyOrigin) ; 55 UseCounter::count(document, UseCounter::RequestFileSystemNonWebbyOrigin) ;
56 56
57 if (!document->getSecurityOrigin()->canAccessFileSystem()) { 57 if (!document->getSecurityOrigin()->canAccessFileSystem()) {
58 DOMFileSystem::reportError(document, errorCallback, FileError::create(Fi leError::SECURITY_ERR)); 58 DOMFileSystem::reportError(document, ScriptErrorCallback::wrap(errorCall back), FileError::SECURITY_ERR);
59 return; 59 return;
60 } 60 }
61 61
62 FileSystemType fileSystemType = static_cast<FileSystemType>(type); 62 FileSystemType fileSystemType = static_cast<FileSystemType>(type);
63 if (!DOMFileSystemBase::isValidType(fileSystemType)) { 63 if (!DOMFileSystemBase::isValidType(fileSystemType)) {
64 DOMFileSystem::reportError(document, errorCallback, FileError::create(Fi leError::INVALID_MODIFICATION_ERR)); 64 DOMFileSystem::reportError(document, ScriptErrorCallback::wrap(errorCall back), FileError::INVALID_MODIFICATION_ERR);
65 return; 65 return;
66 } 66 }
67 67
68 LocalFileSystem::from(*document)->requestFileSystem(document, fileSystemType , size, FileSystemCallbacks::create(successCallback, errorCallback, document, fi leSystemType)); 68 LocalFileSystem::from(*document)->requestFileSystem(document, fileSystemType , size, FileSystemCallbacks::create(successCallback, ScriptErrorCallback::wrap(e rrorCallback), document, fileSystemType));
69 } 69 }
70 70
71 void DOMWindowFileSystem::webkitResolveLocalFileSystemURL(DOMWindow& windowArg, const String& url, EntryCallback* successCallback, ErrorCallback* errorCallback) 71 void DOMWindowFileSystem::webkitResolveLocalFileSystemURL(DOMWindow& windowArg, const String& url, EntryCallback* successCallback, ErrorCallback* errorCallback)
72 { 72 {
73 LocalDOMWindow& window = toLocalDOMWindow(windowArg); 73 LocalDOMWindow& window = toLocalDOMWindow(windowArg);
74 if (!window.isCurrentlyDisplayedInFrame()) 74 if (!window.isCurrentlyDisplayedInFrame())
75 return; 75 return;
76 76
77 Document* document = window.document(); 77 Document* document = window.document();
78 if (!document) 78 if (!document)
79 return; 79 return;
80 80
81 SecurityOrigin* securityOrigin = document->getSecurityOrigin(); 81 SecurityOrigin* securityOrigin = document->getSecurityOrigin();
82 KURL completedURL = document->completeURL(url); 82 KURL completedURL = document->completeURL(url);
83 if (!securityOrigin->canAccessFileSystem() || !securityOrigin->canRequest(co mpletedURL)) { 83 if (!securityOrigin->canAccessFileSystem() || !securityOrigin->canRequest(co mpletedURL)) {
84 DOMFileSystem::reportError(document, errorCallback, FileError::create(Fi leError::SECURITY_ERR)); 84 DOMFileSystem::reportError(document, ScriptErrorCallback::wrap(errorCall back), FileError::SECURITY_ERR);
85 return; 85 return;
86 } 86 }
87 87
88 if (!completedURL.isValid()) { 88 if (!completedURL.isValid()) {
89 DOMFileSystem::reportError(document, errorCallback, FileError::create(Fi leError::ENCODING_ERR)); 89 DOMFileSystem::reportError(document, ScriptErrorCallback::wrap(errorCall back), FileError::ENCODING_ERR);
90 return; 90 return;
91 } 91 }
92 92
93 LocalFileSystem::from(*document)->resolveURL(document, completedURL, Resolve URICallbacks::create(successCallback, errorCallback, document)); 93 LocalFileSystem::from(*document)->resolveURL(document, completedURL, Resolve URICallbacks::create(successCallback, ScriptErrorCallback::wrap(errorCallback), document));
94 } 94 }
95 95
96 static_assert(static_cast<int>(DOMWindowFileSystem::TEMPORARY) == static_cast<in t>(FileSystemTypeTemporary), "DOMWindowFileSystem::TEMPORARY should match FileSy stemTypeTemporary"); 96 static_assert(static_cast<int>(DOMWindowFileSystem::TEMPORARY) == static_cast<in t>(FileSystemTypeTemporary), "DOMWindowFileSystem::TEMPORARY should match FileSy stemTypeTemporary");
97 static_assert(static_cast<int>(DOMWindowFileSystem::PERSISTENT) == static_cast<i nt>(FileSystemTypePersistent), "DOMWindowFileSystem::PERSISTENT should match Fil eSystemTypePersistent"); 97 static_assert(static_cast<int>(DOMWindowFileSystem::PERSISTENT) == static_cast<i nt>(FileSystemTypePersistent), "DOMWindowFileSystem::PERSISTENT should match Fil eSystemTypePersistent");
98 98
99 } // namespace blink 99 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698