| 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 20 matching lines...) Expand all Loading... |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "web/LocalFileSystemClient.h" | 32 #include "web/LocalFileSystemClient.h" |
| 33 | 33 |
| 34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
| 35 #include "core/workers/WorkerGlobalScope.h" | 35 #include "core/workers/WorkerGlobalScope.h" |
| 36 #include "platform/PermissionCallbacks.h" | 36 #include "platform/PermissionCallbacks.h" |
| 37 #include "platform/weborigin/SecurityOrigin.h" | 37 #include "platform/weborigin/SecurityOrigin.h" |
| 38 #include "public/platform/WebPermissionCallbacks.h" | 38 #include "public/platform/WebPermissionCallbacks.h" |
| 39 #include "public/web/WebContentSettingsClient.h" | 39 #include "public/web/WebContentSettingsClient.h" |
| 40 #include "web/WebLocalFrameImpl.h" | 40 #include "web/WebLocalFrameImpl.h" |
| 41 #include "web/WorkerContentSettingsClient.h" | 41 #include "web/WorkerPermissionClient.h" |
| 42 #include "wtf/text/WTFString.h" | 42 #include "wtf/text/WTFString.h" |
| 43 | 43 |
| 44 namespace blink { | 44 namespace blink { |
| 45 | 45 |
| 46 PassOwnPtr<FileSystemClient> LocalFileSystemClient::create() | 46 PassOwnPtr<FileSystemClient> LocalFileSystemClient::create() |
| 47 { | 47 { |
| 48 return adoptPtr(static_cast<FileSystemClient*>(new LocalFileSystemClient()))
; | 48 return adoptPtr(static_cast<FileSystemClient*>(new LocalFileSystemClient()))
; |
| 49 } | 49 } |
| 50 | 50 |
| 51 LocalFileSystemClient::~LocalFileSystemClient() | 51 LocalFileSystemClient::~LocalFileSystemClient() |
| 52 { | 52 { |
| 53 } | 53 } |
| 54 | 54 |
| 55 bool LocalFileSystemClient::requestFileSystemAccessSync(ExecutionContext* contex
t) | 55 bool LocalFileSystemClient::requestFileSystemAccessSync(ExecutionContext* contex
t) |
| 56 { | 56 { |
| 57 ASSERT(context); | 57 ASSERT(context); |
| 58 if (context->isDocument()) { | 58 if (context->isDocument()) { |
| 59 ASSERT_NOT_REACHED(); | 59 ASSERT_NOT_REACHED(); |
| 60 return false; | 60 return false; |
| 61 } | 61 } |
| 62 | 62 |
| 63 ASSERT(context->isWorkerGlobalScope()); | 63 ASSERT(context->isWorkerGlobalScope()); |
| 64 return WorkerContentSettingsClient::from(*toWorkerGlobalScope(context))->req
uestFileSystemAccessSync(); | 64 return WorkerPermissionClient::from(*toWorkerGlobalScope(context))->requestF
ileSystemAccessSync(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void LocalFileSystemClient::requestFileSystemAccessAsync(ExecutionContext* conte
xt, PassOwnPtr<PermissionCallbacks> callbacks) | 67 void LocalFileSystemClient::requestFileSystemAccessAsync(ExecutionContext* conte
xt, PassOwnPtr<PermissionCallbacks> callbacks) |
| 68 { | 68 { |
| 69 ASSERT(context); | 69 ASSERT(context); |
| 70 if (!context->isDocument()) { | 70 if (!context->isDocument()) { |
| 71 ASSERT_NOT_REACHED(); | 71 ASSERT_NOT_REACHED(); |
| 72 return; | 72 return; |
| 73 } | 73 } |
| 74 | 74 |
| 75 Document* document = toDocument(context); | 75 Document* document = toDocument(context); |
| 76 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->frame()
); | 76 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->frame()
); |
| 77 if (!webFrame->contentSettingsClient()) { | 77 if (!webFrame->contentSettingsClient()) { |
| 78 callbacks->onAllowed(); | 78 callbacks->onAllowed(); |
| 79 return; | 79 return; |
| 80 } | 80 } |
| 81 webFrame->contentSettingsClient()->requestFileSystemAccessAsync(callbacks); | 81 webFrame->contentSettingsClient()->requestFileSystemAccessAsync(callbacks); |
| 82 } | 82 } |
| 83 | 83 |
| 84 LocalFileSystemClient::LocalFileSystemClient() | 84 LocalFileSystemClient::LocalFileSystemClient() |
| 85 { | 85 { |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace blink | 88 } // namespace blink |
| OLD | NEW |