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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 ASSERT(context); | 59 ASSERT(context); |
| 60 if (context->isDocument()) { | 60 if (context->isDocument()) { |
| 61 Document* document = toDocument(context); | 61 Document* document = toDocument(context); |
| 62 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->fra me()); | 62 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->fra me()); |
| 63 return !webFrame->permissionClient() || webFrame->permissionClient()->al lowFileSystem(); | 63 return !webFrame->permissionClient() || webFrame->permissionClient()->al lowFileSystem(); |
| 64 } | 64 } |
| 65 ASSERT(context->isWorkerGlobalScope()); | 65 ASSERT(context->isWorkerGlobalScope()); |
| 66 return WorkerPermissionClient::from(*toWorkerGlobalScope(context))->allowFil eSystem(); | 66 return WorkerPermissionClient::from(*toWorkerGlobalScope(context))->allowFil eSystem(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void LocalFileSystemClient::requestFileSystemAccess(ExecutionContext* context, P assOwnPtr<WebCore::PermissionCallbacks> callbacks) | 69 bool LocalFileSystemClient::requestFileSystemAccessSync(ExecutionContext* contex t) |
| 70 { | 70 { |
| 71 ASSERT(context); | 71 ASSERT(context); |
| 72 if (context->isDocument()) { | 72 if (context->isDocument()) { |
| 73 Document* document = toDocument(context); | |
|
jochen (gone - plz use gerrit)
2014/05/15 14:35:20
this should not be reachable, no?
Xi Han
2014/05/15 15:33:25
Good catch, thanks.
On 2014/05/15 14:35:20, joche
| |
| 74 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->fra me()); | |
| 75 return !webFrame->permissionClient() || webFrame->permissionClient()->re questFileSystemAccessSync(); | |
| 76 } | |
| 77 ASSERT(context->isWorkerGlobalScope()); | |
| 78 return WorkerPermissionClient::from(*toWorkerGlobalScope(context))->requestF ileSystemAccessSync(); | |
| 79 } | |
| 80 | |
| 81 void LocalFileSystemClient::requestFileSystemAccessAsync(ExecutionContext* conte xt, PassOwnPtr<WebCore::PermissionCallbacks> callbacks) | |
| 82 { | |
| 83 ASSERT(context); | |
| 84 if (context->isDocument()) { | |
| 73 Document* document = toDocument(context); | 85 Document* document = toDocument(context); |
| 74 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->fra me()); | 86 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->fra me()); |
| 75 if (!webFrame->permissionClient()) { | 87 if (!webFrame->permissionClient()) { |
| 76 callbacks->onAllowed(); | 88 callbacks->onAllowed(); |
| 77 return; | 89 return; |
| 78 } | 90 } |
| 79 webFrame->permissionClient()->requestFileSystemAccess(callbacks); | 91 webFrame->permissionClient()->requestFileSystemAccessAsync(callbacks); |
| 80 return; | 92 return; |
| 81 } | 93 } |
| 82 ASSERT(context->isWorkerGlobalScope()); | 94 ASSERT(context->isWorkerGlobalScope()); |
| 83 WorkerPermissionClient::from(*toWorkerGlobalScope(context))->requestFileSyst emAccess(callbacks); | 95 WorkerPermissionClient::from(*toWorkerGlobalScope(context))->requestFileSyst emAccessAsync(callbacks); |
| 84 } | 96 } |
| 85 | 97 |
| 86 LocalFileSystemClient::LocalFileSystemClient() | 98 LocalFileSystemClient::LocalFileSystemClient() |
| 87 { | 99 { |
| 88 } | 100 } |
| 89 | 101 |
| 90 } // namespace blink | 102 } // namespace blink |
| OLD | NEW |