- add sources.
[platform/framework/web/crosswalk.git] / src / content / worker / shared_worker_permission_client_proxy.cc
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.
4
5 #include "content/worker/shared_worker_permission_client_proxy.h"
6
7 #include "content/child/thread_safe_sender.h"
8 #include "content/common/worker_messages.h"
9 #include "third_party/WebKit/public/platform/WebString.h"
10 #include "url/gurl.h"
11
12 namespace content {
13
14 SharedWorkerPermissionClientProxy::SharedWorkerPermissionClientProxy(
15     const GURL& origin_url,
16     int routing_id,
17     ThreadSafeSender* thread_safe_sender)
18     : origin_url_(origin_url),
19       routing_id_(routing_id),
20       thread_safe_sender_(thread_safe_sender) {
21 }
22
23 SharedWorkerPermissionClientProxy::~SharedWorkerPermissionClientProxy() {
24 }
25
26 bool SharedWorkerPermissionClientProxy::allowDatabase(
27     const WebKit::WebString& name,
28     const WebKit::WebString& display_name,
29     unsigned long estimated_size) {
30   bool result = false;
31   thread_safe_sender_->Send(new WorkerProcessHostMsg_AllowDatabase(
32       routing_id_, origin_url_, name, display_name,
33       estimated_size, &result));
34   return result;
35 }
36
37 bool SharedWorkerPermissionClientProxy::allowFileSystem() {
38   bool result = false;
39   thread_safe_sender_->Send(new WorkerProcessHostMsg_AllowFileSystem(
40       routing_id_, origin_url_, &result));
41   return result;
42 }
43
44 bool SharedWorkerPermissionClientProxy::allowIndexedDB(
45     const WebKit::WebString& name) {
46   bool result = false;
47   thread_safe_sender_->Send(new WorkerProcessHostMsg_AllowIndexedDB(
48       routing_id_, origin_url_, name, &result));
49   return result;
50 }
51
52 }  // namespace content