Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 12 matching lines...) Expand all Loading... | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "web/LocalFileSystemClient.h" | 31 #include "web/LocalFileSystemClient.h" |
| 32 | 32 |
| 33 #include <memory> | |
| 33 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
| 35 #include "core/frame/ContentSettingsClient.h" | |
| 34 #include "core/workers/WorkerGlobalScope.h" | 36 #include "core/workers/WorkerGlobalScope.h" |
| 35 #include "platform/ContentSettingCallbacks.h" | 37 #include "platform/ContentSettingCallbacks.h" |
| 36 #include "platform/weborigin/SecurityOrigin.h" | 38 #include "platform/weborigin/SecurityOrigin.h" |
| 37 #include "public/platform/WebContentSettingCallbacks.h" | |
| 38 #include "public/web/WebContentSettingsClient.h" | |
| 39 #include "web/WebLocalFrameImpl.h" | 39 #include "web/WebLocalFrameImpl.h" |
| 40 #include "web/WorkerContentSettingsClient.h" | 40 #include "web/WorkerContentSettingsClient.h" |
| 41 #include "wtf/PtrUtil.h" | 41 #include "wtf/PtrUtil.h" |
| 42 #include "wtf/text/WTFString.h" | 42 #include "wtf/text/WTFString.h" |
| 43 #include <memory> | |
| 44 | 43 |
| 45 namespace blink { | 44 namespace blink { |
| 46 | 45 |
| 47 std::unique_ptr<FileSystemClient> LocalFileSystemClient::create() { | 46 std::unique_ptr<FileSystemClient> LocalFileSystemClient::create() { |
| 48 return WTF::wrapUnique( | 47 return WTF::wrapUnique( |
| 49 static_cast<FileSystemClient*>(new LocalFileSystemClient())); | 48 static_cast<FileSystemClient*>(new LocalFileSystemClient())); |
| 50 } | 49 } |
| 51 | 50 |
| 52 LocalFileSystemClient::~LocalFileSystemClient() {} | 51 LocalFileSystemClient::~LocalFileSystemClient() {} |
| 53 | 52 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 67 void LocalFileSystemClient::requestFileSystemAccessAsync( | 66 void LocalFileSystemClient::requestFileSystemAccessAsync( |
| 68 ExecutionContext* context, | 67 ExecutionContext* context, |
| 69 std::unique_ptr<ContentSettingCallbacks> callbacks) { | 68 std::unique_ptr<ContentSettingCallbacks> callbacks) { |
| 70 DCHECK(context); | 69 DCHECK(context); |
| 71 if (!context->isDocument()) { | 70 if (!context->isDocument()) { |
| 72 NOTREACHED(); | 71 NOTREACHED(); |
| 73 return; | 72 return; |
| 74 } | 73 } |
| 75 | 74 |
| 76 Document* document = toDocument(context); | 75 Document* document = toDocument(context); |
| 77 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->frame()); | 76 if (!document->frame()->contentSettingsClient()) { |
|
dcheng
2017/04/02 05:26:19
Ditto: if we are assuming frame is not null here (
kinuko
2017/04/03 15:15:06
Added frame nullcheck, and removed contentSettings
dcheng
2017/04/03 19:28:23
Similarly, I did some more tracing back and the on
kinuko
2017/04/04 03:26:23
Done.
| |
| 78 if (!webFrame->contentSettingsClient()) { | |
| 79 callbacks->onAllowed(); | 77 callbacks->onAllowed(); |
| 80 return; | 78 return; |
| 81 } | 79 } |
| 82 webFrame->contentSettingsClient()->requestFileSystemAccessAsync( | 80 document->frame()->contentSettingsClient()->requestFileSystemAccessAsync( |
| 83 std::move(callbacks)); | 81 std::move(callbacks)); |
| 84 } | 82 } |
| 85 | 83 |
| 86 LocalFileSystemClient::LocalFileSystemClient() {} | 84 LocalFileSystemClient::LocalFileSystemClient() {} |
| 87 | 85 |
| 88 } // namespace blink | 86 } // namespace blink |
| OLD | NEW |