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

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

Issue 2039713002: Remove pre-Oilpan protections from LocalFileSystem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: style 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
« no previous file with comments | « third_party/WebKit/Source/modules/filesystem/LocalFileSystem.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 { 76 {
77 return new LocalFileSystem(std::move(client)); 77 return new LocalFileSystem(std::move(client));
78 } 78 }
79 79
80 LocalFileSystem::~LocalFileSystem() 80 LocalFileSystem::~LocalFileSystem()
81 { 81 {
82 } 82 }
83 83
84 void LocalFileSystem::resolveURL(ExecutionContext* context, const KURL& fileSyst emURL, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) 84 void LocalFileSystem::resolveURL(ExecutionContext* context, const KURL& fileSyst emURL, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
85 { 85 {
86 ExecutionContext* contextPtr(context);
87 CallbackWrapper* wrapper = new CallbackWrapper(std::move(callbacks)); 86 CallbackWrapper* wrapper = new CallbackWrapper(std::move(callbacks));
88 requestFileSystemAccessInternal(context, 87 requestFileSystemAccessInternal(context,
89 bind(&LocalFileSystem::resolveURLInternal, this, contextPtr, fileSystemU RL, wrapper), 88 bind(&LocalFileSystem::resolveURLInternal, this, context, fileSystemURL, wrapper),
90 bind(&LocalFileSystem::fileSystemNotAllowedInternal, this, contextPtr, w rapper)); 89 bind(&LocalFileSystem::fileSystemNotAllowedInternal, this, context, wrap per));
91 } 90 }
92 91
93 void LocalFileSystem::requestFileSystem(ExecutionContext* context, FileSystemTyp e type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) 92 void LocalFileSystem::requestFileSystem(ExecutionContext* context, FileSystemTyp e type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
94 { 93 {
95 ExecutionContext* contextPtr(context);
96 CallbackWrapper* wrapper = new CallbackWrapper(std::move(callbacks)); 94 CallbackWrapper* wrapper = new CallbackWrapper(std::move(callbacks));
97 requestFileSystemAccessInternal(context, 95 requestFileSystemAccessInternal(context,
98 bind(&LocalFileSystem::fileSystemAllowedInternal, this, contextPtr, type , wrapper), 96 bind(&LocalFileSystem::fileSystemAllowedInternal, this, context, type, w rapper),
99 bind(&LocalFileSystem::fileSystemNotAllowedInternal, this, contextPtr, w rapper)); 97 bind(&LocalFileSystem::fileSystemNotAllowedInternal, this, context, wrap per));
100 } 98 }
101 99
102 void LocalFileSystem::deleteFileSystem(ExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) 100 void LocalFileSystem::deleteFileSystem(ExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
103 { 101 {
104 ExecutionContext* contextPtr(context);
105 ASSERT(context); 102 ASSERT(context);
106 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument()); 103 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument());
107 104
108 CallbackWrapper* wrapper = new CallbackWrapper(std::move(callbacks)); 105 CallbackWrapper* wrapper = new CallbackWrapper(std::move(callbacks));
109 requestFileSystemAccessInternal(context, 106 requestFileSystemAccessInternal(context,
110 bind(&LocalFileSystem::deleteFileSystemInternal, this, contextPtr, type, wrapper), 107 bind(&LocalFileSystem::deleteFileSystemInternal, this, context, type, wr apper),
111 bind(&LocalFileSystem::fileSystemNotAllowedInternal, this, contextPtr, w rapper)); 108 bind(&LocalFileSystem::fileSystemNotAllowedInternal, this, context, wrap per));
112 } 109 }
113 110
114 WebFileSystem* LocalFileSystem::fileSystem() const 111 WebFileSystem* LocalFileSystem::getFileSystem() const
115 { 112 {
116 Platform* platform = Platform::current(); 113 Platform* platform = Platform::current();
117 if (!platform) 114 if (!platform)
118 return nullptr; 115 return nullptr;
119 return Platform::current()->fileSystem(); 116
117 return platform->fileSystem();
120 } 118 }
121 119
122 void LocalFileSystem::requestFileSystemAccessInternal(ExecutionContext* context, std::unique_ptr<SameThreadClosure> allowed, std::unique_ptr<SameThreadClosure> denied) 120 void LocalFileSystem::requestFileSystemAccessInternal(ExecutionContext* context, std::unique_ptr<SameThreadClosure> allowed, std::unique_ptr<SameThreadClosure> denied)
123 { 121 {
124 if (!client()) { 122 if (!client()) {
125 (*denied)(); 123 (*denied)();
126 return; 124 return;
127 } 125 }
128 if (!context->isDocument()) { 126 if (!context->isDocument()) {
129 if (!client()->requestFileSystemAccessSync(context)) { 127 if (!client()->requestFileSystemAccessSync(context)) {
(...skipping 18 matching lines...) Expand all
148 CallbackWrapper* callbacks) 146 CallbackWrapper* callbacks)
149 { 147 {
150 context->postTask(BLINK_FROM_HERE, createSameThreadTask(&reportFailure, pass ed(callbacks->release()), FileError::ABORT_ERR)); 148 context->postTask(BLINK_FROM_HERE, createSameThreadTask(&reportFailure, pass ed(callbacks->release()), FileError::ABORT_ERR));
151 } 149 }
152 150
153 void LocalFileSystem::fileSystemAllowedInternal( 151 void LocalFileSystem::fileSystemAllowedInternal(
154 ExecutionContext* context, 152 ExecutionContext* context,
155 FileSystemType type, 153 FileSystemType type,
156 CallbackWrapper* callbacks) 154 CallbackWrapper* callbacks)
157 { 155 {
158 if (!fileSystem()) { 156 WebFileSystem* fileSystem = getFileSystem();
157 if (!fileSystem) {
159 fileSystemNotAvailable(context, callbacks); 158 fileSystemNotAvailable(context, callbacks);
160 return; 159 return;
161 } 160 }
162
163 KURL storagePartition = KURL(KURL(), context->getSecurityOrigin()->toString( )); 161 KURL storagePartition = KURL(KURL(), context->getSecurityOrigin()->toString( ));
164 fileSystem()->openFileSystem(storagePartition, static_cast<WebFileSystemType >(type), callbacks->release()); 162 fileSystem->openFileSystem(storagePartition, static_cast<WebFileSystemType>( type), callbacks->release());
165 } 163 }
166 164
167 void LocalFileSystem::resolveURLInternal( 165 void LocalFileSystem::resolveURLInternal(
168 ExecutionContext* context, 166 ExecutionContext* context,
169 const KURL& fileSystemURL, 167 const KURL& fileSystemURL,
170 CallbackWrapper* callbacks) 168 CallbackWrapper* callbacks)
171 { 169 {
172 if (!fileSystem()) { 170 WebFileSystem* fileSystem = getFileSystem();
171 if (!fileSystem) {
173 fileSystemNotAvailable(context, callbacks); 172 fileSystemNotAvailable(context, callbacks);
174 return; 173 return;
175 } 174 }
176 fileSystem()->resolveURL(fileSystemURL, callbacks->release()); 175 fileSystem->resolveURL(fileSystemURL, callbacks->release());
177 } 176 }
178 177
179 void LocalFileSystem::deleteFileSystemInternal( 178 void LocalFileSystem::deleteFileSystemInternal(
180 ExecutionContext* context, 179 ExecutionContext* context,
181 FileSystemType type, 180 FileSystemType type,
182 CallbackWrapper* callbacks) 181 CallbackWrapper* callbacks)
183 { 182 {
184 if (!fileSystem()) { 183 WebFileSystem* fileSystem = getFileSystem();
184 if (!fileSystem) {
185 fileSystemNotAvailable(context, callbacks); 185 fileSystemNotAvailable(context, callbacks);
186 return; 186 return;
187 } 187 }
188 KURL storagePartition = KURL(KURL(), context->getSecurityOrigin()->toString( )); 188 KURL storagePartition = KURL(KURL(), context->getSecurityOrigin()->toString( ));
189 fileSystem()->deleteFileSystem(storagePartition, static_cast<WebFileSystemTy pe>(type), callbacks->release()); 189 fileSystem->deleteFileSystem(storagePartition, static_cast<WebFileSystemType >(type), callbacks->release());
190 } 190 }
191 191
192 LocalFileSystem::LocalFileSystem(PassOwnPtr<FileSystemClient> client) 192 LocalFileSystem::LocalFileSystem(PassOwnPtr<FileSystemClient> client)
193 : m_client(std::move(client)) 193 : m_client(std::move(client))
194 { 194 {
195 } 195 }
196 196
197 const char* LocalFileSystem::supplementName() 197 const char* LocalFileSystem::supplementName()
198 { 198 {
199 return "LocalFileSystem"; 199 return "LocalFileSystem";
(...skipping 13 matching lines...) Expand all
213 { 213 {
214 frame.provideSupplement(LocalFileSystem::supplementName(), LocalFileSystem:: create(std::move(client))); 214 frame.provideSupplement(LocalFileSystem::supplementName(), LocalFileSystem:: create(std::move(client)));
215 } 215 }
216 216
217 void provideLocalFileSystemToWorker(WorkerClients* clients, PassOwnPtr<FileSyste mClient> client) 217 void provideLocalFileSystemToWorker(WorkerClients* clients, PassOwnPtr<FileSyste mClient> client)
218 { 218 {
219 clients->provideSupplement(LocalFileSystem::supplementName(), LocalFileSyste m::create(std::move(client))); 219 clients->provideSupplement(LocalFileSystem::supplementName(), LocalFileSyste m::create(std::move(client)));
220 } 220 }
221 221
222 } // namespace blink 222 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/filesystem/LocalFileSystem.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698