Commit bdd3d42c authored by horo@chromium.org's avatar horo@chromium.org

Implement EmbeddedSharedWorkerPermissionClientProxy.

embedded_shared_worker_permission_client_proxy.* are copied from shared_worker_permission_client_proxy.* in content/worker/.
I will delete the directory when we will stop using worker process.

BUG=327256

Review URL: https://codereview.chromium.org/318013002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275768 0039d316-1c4b-4281-b951-d872f2087c98
parent 7b5a3e5e
......@@ -396,6 +396,8 @@
'renderer/shared_memory_seqlock_reader.h',
'renderer/shared_worker_repository.cc',
'renderer/shared_worker_repository.h',
'renderer/shared_worker/embedded_shared_worker_permission_client_proxy.cc',
'renderer/shared_worker/embedded_shared_worker_permission_client_proxy.h',
'renderer/shared_worker/embedded_shared_worker_stub.cc',
'renderer/shared_worker/embedded_shared_worker_stub.h',
'renderer/skia_benchmarking_extension.cc',
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/renderer/shared_worker/embedded_shared_worker_permission_client_proxy.h"
#include "content/child/thread_safe_sender.h"
#include "content/common/worker_messages.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "url/gurl.h"
namespace content {
EmbeddedSharedWorkerPermissionClientProxy::
EmbeddedSharedWorkerPermissionClientProxy(
const GURL& origin_url,
bool is_unique_origin,
int routing_id,
ThreadSafeSender* thread_safe_sender)
: origin_url_(origin_url),
is_unique_origin_(is_unique_origin),
routing_id_(routing_id),
thread_safe_sender_(thread_safe_sender) {
}
EmbeddedSharedWorkerPermissionClientProxy::
~EmbeddedSharedWorkerPermissionClientProxy() {
}
bool EmbeddedSharedWorkerPermissionClientProxy::allowDatabase(
const blink::WebString& name,
const blink::WebString& display_name,
unsigned long estimated_size) {
if (is_unique_origin_)
return false;
bool result = false;
thread_safe_sender_->Send(new WorkerProcessHostMsg_AllowDatabase(
routing_id_, origin_url_, name, display_name, estimated_size, &result));
return result;
}
bool EmbeddedSharedWorkerPermissionClientProxy::requestFileSystemAccessSync() {
if (is_unique_origin_)
return false;
bool result = false;
thread_safe_sender_->Send(
new WorkerProcessHostMsg_RequestFileSystemAccessSync(
routing_id_, origin_url_, &result));
return result;
}
bool EmbeddedSharedWorkerPermissionClientProxy::allowIndexedDB(
const blink::WebString& name) {
if (is_unique_origin_)
return false;
bool result = false;
thread_safe_sender_->Send(new WorkerProcessHostMsg_AllowIndexedDB(
routing_id_, origin_url_, name, &result));
return result;
}
} // namespace content
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_RENDERER_SHARED_WORKER_EMBEDDED_SHARED_WORKER_PERMISSION_CLIENT_PROXY_H_
#define CONTENT_RENDERER_SHARED_WORKER_EMBEDDED_SHARED_WORKER_PERMISSION_CLIENT_PROXY_H_
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "third_party/WebKit/public/web/WebWorkerPermissionClientProxy.h"
#include "url/gurl.h"
namespace content {
class ThreadSafeSender;
// This proxy is created on the main renderer thread then passed onto
// the blink's worker thread.
class EmbeddedSharedWorkerPermissionClientProxy
: public blink::WebWorkerPermissionClientProxy {
public:
EmbeddedSharedWorkerPermissionClientProxy(
const GURL& origin_url,
bool is_unique_origin,
int routing_id,
ThreadSafeSender* thread_safe_sender);
virtual ~EmbeddedSharedWorkerPermissionClientProxy();
// WebWorkerPermissionClientProxy overrides.
virtual bool allowDatabase(const blink::WebString& name,
const blink::WebString& display_name,
unsigned long estimated_size);
virtual bool requestFileSystemAccessSync();
virtual bool allowIndexedDB(const blink::WebString& name);
private:
const GURL origin_url_;
const bool is_unique_origin_;
const int routing_id_;
scoped_refptr<ThreadSafeSender> thread_safe_sender_;
DISALLOW_COPY_AND_ASSIGN(EmbeddedSharedWorkerPermissionClientProxy);
};
} // namespace content
#endif // CONTENT_RENDERER_SHARED_WORKER_EMBEDDED_SHARED_WORKER_PERMISSION_CLIENT_PROXY_H_
......@@ -12,7 +12,9 @@
#include "content/child/webmessageportchannel_impl.h"
#include "content/common/worker_messages.h"
#include "content/renderer/render_thread_impl.h"
#include "content/renderer/shared_worker/embedded_shared_worker_permission_client_proxy.h"
#include "ipc/ipc_message_macros.h"
#include "third_party/WebKit/public/web/WebSecurityOrigin.h"
#include "third_party/WebKit/public/web/WebSharedWorker.h"
#include "third_party/WebKit/public/web/WebSharedWorkerClient.h"
......@@ -153,8 +155,11 @@ EmbeddedSharedWorkerStub::createApplicationCacheHost(
blink::WebWorkerPermissionClientProxy*
EmbeddedSharedWorkerStub::createWorkerPermissionClientProxy(
const blink::WebSecurityOrigin& origin) {
// TODO(horo): implement this.
return NULL;
return new EmbeddedSharedWorkerPermissionClientProxy(
GURL(origin.toString()),
origin.isUnique(),
route_id_,
ChildThread::current()->thread_safe_sender());
}
void EmbeddedSharedWorkerStub::dispatchDevToolsMessage(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment