1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/worker/shared_worker_permission_client_proxy.h"
7 #include "content/child/thread_safe_sender.h"
8 #include "content/common/worker_messages.h"
9 #include "third_party/WebKit/public/platform/WebString.h"
14 SharedWorkerPermissionClientProxy::SharedWorkerPermissionClientProxy(
15 const GURL
& origin_url
,
16 bool is_unique_origin
,
18 ThreadSafeSender
* thread_safe_sender
)
19 : origin_url_(origin_url
),
20 is_unique_origin_(is_unique_origin
),
21 routing_id_(routing_id
),
22 thread_safe_sender_(thread_safe_sender
) {
25 SharedWorkerPermissionClientProxy::~SharedWorkerPermissionClientProxy() {
28 bool SharedWorkerPermissionClientProxy::allowDatabase(
29 const blink::WebString
& name
,
30 const blink::WebString
& display_name
,
31 unsigned long estimated_size
) {
32 if (is_unique_origin_
)
35 thread_safe_sender_
->Send(new WorkerProcessHostMsg_AllowDatabase(
36 routing_id_
, origin_url_
, name
, display_name
,
37 estimated_size
, &result
));
41 bool SharedWorkerPermissionClientProxy::allowFileSystem() {
42 if (is_unique_origin_
)
45 thread_safe_sender_
->Send(new WorkerProcessHostMsg_AllowFileSystem(
46 routing_id_
, origin_url_
, &result
));
50 bool SharedWorkerPermissionClientProxy::allowIndexedDB(
51 const blink::WebString
& name
) {
52 if (is_unique_origin_
)
55 thread_safe_sender_
->Send(new WorkerProcessHostMsg_AllowIndexedDB(
56 routing_id_
, origin_url_
, name
, &result
));
60 } // namespace content