Use multiline attribute to check for IA2_STATE_MULTILINE.
[chromium-blink-merge.git] / chrome / renderer / worker_content_settings_client_proxy.cc
blobdc0395e3545c025165bca99594a02878537f93b0
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 "chrome/renderer/worker_content_settings_client_proxy.h"
7 #include "chrome/common/render_messages.h"
8 #include "content/public/renderer/render_frame.h"
9 #include "content/public/renderer/render_thread.h"
10 #include "ipc/ipc_sync_message_filter.h"
11 #include "third_party/WebKit/public/platform/WebPermissionCallbacks.h"
12 #include "third_party/WebKit/public/web/WebDocument.h"
13 #include "third_party/WebKit/public/web/WebFrame.h"
14 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
16 WorkerContentSettingsClientProxy::WorkerContentSettingsClientProxy(
17 content::RenderFrame* render_frame,
18 blink::WebFrame* frame)
19 : routing_id_(render_frame->GetRoutingID()),
20 is_unique_origin_(false) {
21 if (frame->document().securityOrigin().isUnique() ||
22 frame->top()->document().securityOrigin().isUnique())
23 is_unique_origin_ = true;
24 sync_message_filter_ = content::RenderThread::Get()->GetSyncMessageFilter();
25 document_origin_url_ = GURL(frame->document().securityOrigin().toString());
26 top_frame_origin_url_ = GURL(
27 frame->top()->document().securityOrigin().toString());
30 WorkerContentSettingsClientProxy::~WorkerContentSettingsClientProxy() {}
32 bool WorkerContentSettingsClientProxy::allowDatabase(
33 const blink::WebString& name,
34 const blink::WebString& display_name,
35 unsigned long estimated_size) {
36 if (is_unique_origin_)
37 return false;
39 bool result = false;
40 sync_message_filter_->Send(new ChromeViewHostMsg_AllowDatabase(
41 routing_id_, document_origin_url_, top_frame_origin_url_,
42 name, display_name, &result));
43 return result;
46 bool WorkerContentSettingsClientProxy::requestFileSystemAccessSync() {
47 if (is_unique_origin_)
48 return false;
50 bool result = false;
51 sync_message_filter_->Send(new ChromeViewHostMsg_RequestFileSystemAccessSync(
52 routing_id_, document_origin_url_, top_frame_origin_url_, &result));
53 return result;
56 bool WorkerContentSettingsClientProxy::allowIndexedDB(
57 const blink::WebString& name) {
58 if (is_unique_origin_)
59 return false;
61 bool result = false;
62 sync_message_filter_->Send(new ChromeViewHostMsg_AllowIndexedDB(
63 routing_id_, document_origin_url_, top_frame_origin_url_, name, &result));
64 return result;