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

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

Issue 334283004: Rename DOMWindow to LocalDOMWindow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 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 | Annotate | Revision Log
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 10 matching lines...) Expand all
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
23 * DAMAGE. 23 * DAMAGE.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "modules/filesystem/DOMWindowFileSystem.h" 27 #include "modules/filesystem/DOMWindowFileSystem.h"
28 28
29 #include "core/dom/Document.h" 29 #include "core/dom/Document.h"
30 #include "core/fileapi/FileError.h" 30 #include "core/fileapi/FileError.h"
31 #include "core/frame/DOMWindow.h" 31 #include "core/frame/LocalDOMWindow.h"
32 #include "modules/filesystem/DOMFileSystem.h" 32 #include "modules/filesystem/DOMFileSystem.h"
33 #include "modules/filesystem/EntryCallback.h" 33 #include "modules/filesystem/EntryCallback.h"
34 #include "modules/filesystem/ErrorCallback.h" 34 #include "modules/filesystem/ErrorCallback.h"
35 #include "modules/filesystem/FileSystemCallback.h" 35 #include "modules/filesystem/FileSystemCallback.h"
36 #include "modules/filesystem/FileSystemCallbacks.h" 36 #include "modules/filesystem/FileSystemCallbacks.h"
37 #include "modules/filesystem/LocalFileSystem.h" 37 #include "modules/filesystem/LocalFileSystem.h"
38 #include "platform/FileSystemType.h" 38 #include "platform/FileSystemType.h"
39 #include "platform/weborigin/SecurityOrigin.h" 39 #include "platform/weborigin/SecurityOrigin.h"
40 40
41 namespace WebCore { 41 namespace WebCore {
42 42
43 DOMWindowFileSystem::DOMWindowFileSystem() 43 DOMWindowFileSystem::DOMWindowFileSystem()
44 { 44 {
45 } 45 }
46 46
47 DOMWindowFileSystem::~DOMWindowFileSystem() 47 DOMWindowFileSystem::~DOMWindowFileSystem()
48 { 48 {
49 } 49 }
50 50
51 void DOMWindowFileSystem::webkitRequestFileSystem(DOMWindow& window, int type, l ong long size, PassOwnPtr<FileSystemCallback> successCallback, PassOwnPtr<ErrorC allback> errorCallback) 51 void DOMWindowFileSystem::webkitRequestFileSystem(LocalDOMWindow& window, int ty pe, long long size, PassOwnPtr<FileSystemCallback> successCallback, PassOwnPtr<E rrorCallback> errorCallback)
52 { 52 {
53 if (!window.isCurrentlyDisplayedInFrame()) 53 if (!window.isCurrentlyDisplayedInFrame())
54 return; 54 return;
55 55
56 Document* document = window.document(); 56 Document* document = window.document();
57 if (!document) 57 if (!document)
58 return; 58 return;
59 59
60 if (!document->securityOrigin()->canAccessFileSystem()) { 60 if (!document->securityOrigin()->canAccessFileSystem()) {
61 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::SECURITY_ERR)); 61 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::SECURITY_ERR));
62 return; 62 return;
63 } 63 }
64 64
65 FileSystemType fileSystemType = static_cast<FileSystemType>(type); 65 FileSystemType fileSystemType = static_cast<FileSystemType>(type);
66 if (!DOMFileSystemBase::isValidType(fileSystemType)) { 66 if (!DOMFileSystemBase::isValidType(fileSystemType)) {
67 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::INVALID_MODIFICATION_ERR)); 67 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::INVALID_MODIFICATION_ERR));
68 return; 68 return;
69 } 69 }
70 70
71 LocalFileSystem::from(*document)->requestFileSystem(document, fileSystemType , size, FileSystemCallbacks::create(successCallback, errorCallback, document, fi leSystemType)); 71 LocalFileSystem::from(*document)->requestFileSystem(document, fileSystemType , size, FileSystemCallbacks::create(successCallback, errorCallback, document, fi leSystemType));
72 } 72 }
73 73
74 void DOMWindowFileSystem::webkitResolveLocalFileSystemURL(DOMWindow& window, con st String& url, PassOwnPtr<EntryCallback> successCallback, PassOwnPtr<ErrorCallb ack> errorCallback) 74 void DOMWindowFileSystem::webkitResolveLocalFileSystemURL(LocalDOMWindow& window , const String& url, PassOwnPtr<EntryCallback> successCallback, PassOwnPtr<Error Callback> errorCallback)
75 { 75 {
76 if (!window.isCurrentlyDisplayedInFrame()) 76 if (!window.isCurrentlyDisplayedInFrame())
77 return; 77 return;
78 78
79 Document* document = window.document(); 79 Document* document = window.document();
80 if (!document) 80 if (!document)
81 return; 81 return;
82 82
83 SecurityOrigin* securityOrigin = document->securityOrigin(); 83 SecurityOrigin* securityOrigin = document->securityOrigin();
84 KURL completedURL = document->completeURL(url); 84 KURL completedURL = document->completeURL(url);
85 if (!securityOrigin->canAccessFileSystem() || !securityOrigin->canRequest(co mpletedURL)) { 85 if (!securityOrigin->canAccessFileSystem() || !securityOrigin->canRequest(co mpletedURL)) {
86 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::SECURITY_ERR)); 86 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::SECURITY_ERR));
87 return; 87 return;
88 } 88 }
89 89
90 if (!completedURL.isValid()) { 90 if (!completedURL.isValid()) {
91 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::ENCODING_ERR)); 91 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::ENCODING_ERR));
92 return; 92 return;
93 } 93 }
94 94
95 LocalFileSystem::from(*document)->resolveURL(document, completedURL, Resolve URICallbacks::create(successCallback, errorCallback, document)); 95 LocalFileSystem::from(*document)->resolveURL(document, completedURL, Resolve URICallbacks::create(successCallback, errorCallback, document));
96 } 96 }
97 97
98 COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::TEMPORARY) == static_cast<i nt>(FileSystemTypeTemporary), enum_mismatch); 98 COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::TEMPORARY) == static_cast<i nt>(FileSystemTypeTemporary), enum_mismatch);
99 COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::PERSISTENT) == static_cast< int>(FileSystemTypePersistent), enum_mismatch); 99 COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::PERSISTENT) == static_cast< int>(FileSystemTypePersistent), enum_mismatch);
100 100
101 } // namespace WebCore 101 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/filesystem/DOMWindowFileSystem.h ('k') | Source/modules/gamepad/NavigatorGamepad.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698