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