| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/renderer/worker_content_settings_client_proxy.h" | 5 #include "chrome/renderer/worker_content_settings_client_proxy.h" |
| 6 | 6 |
| 7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
| 8 #include "components/content_settings/content/common/content_settings_messages.h
" | 8 #include "components/content_settings/content/common/content_settings_messages.h
" |
| 9 #include "content/public/renderer/render_frame.h" | 9 #include "content/public/renderer/render_frame.h" |
| 10 #include "content/public/renderer/render_thread.h" | 10 #include "content/public/renderer/render_thread.h" |
| 11 #include "ipc/ipc_sync_message_filter.h" | 11 #include "ipc/ipc_sync_message_filter.h" |
| 12 #include "third_party/WebKit/public/platform/URLConversion.h" | 12 #include "third_party/WebKit/public/platform/URLConversion.h" |
| 13 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 13 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| 14 #include "third_party/WebKit/public/web/WebDocument.h" | 14 #include "third_party/WebKit/public/web/WebDocument.h" |
| 15 #include "third_party/WebKit/public/web/WebFrame.h" | 15 #include "third_party/WebKit/public/web/WebFrame.h" |
| 16 | 16 |
| 17 WorkerContentSettingsClientProxy::WorkerContentSettingsClientProxy( | 17 WorkerContentSettingsClientProxy::WorkerContentSettingsClientProxy( |
| 18 content::RenderFrame* render_frame, | 18 content::RenderFrame* render_frame, |
| 19 blink::WebFrame* frame) | 19 blink::WebFrame* frame) |
| 20 : routing_id_(render_frame->GetRoutingID()), | 20 : routing_id_(render_frame->GetRoutingID()), |
| 21 is_unique_origin_(false) { | 21 is_unique_origin_(false) { |
| 22 if (frame->document().securityOrigin().isUnique() || | 22 if (frame->document().getSecurityOrigin().isUnique() || |
| 23 frame->top()->securityOrigin().isUnique()) | 23 frame->top()->getSecurityOrigin().isUnique()) |
| 24 is_unique_origin_ = true; | 24 is_unique_origin_ = true; |
| 25 sync_message_filter_ = content::RenderThread::Get()->GetSyncMessageFilter(); | 25 sync_message_filter_ = content::RenderThread::Get()->GetSyncMessageFilter(); |
| 26 document_origin_url_ = | 26 document_origin_url_ = |
| 27 blink::WebStringToGURL(frame->document().securityOrigin().toString()); | 27 blink::WebStringToGURL(frame->document().getSecurityOrigin().toString()); |
| 28 top_frame_origin_url_ = | 28 top_frame_origin_url_ = |
| 29 blink::WebStringToGURL(frame->top()->securityOrigin().toString()); | 29 blink::WebStringToGURL(frame->top()->getSecurityOrigin().toString()); |
| 30 } | 30 } |
| 31 | 31 |
| 32 WorkerContentSettingsClientProxy::~WorkerContentSettingsClientProxy() {} | 32 WorkerContentSettingsClientProxy::~WorkerContentSettingsClientProxy() {} |
| 33 | 33 |
| 34 bool WorkerContentSettingsClientProxy::allowDatabase( | 34 bool WorkerContentSettingsClientProxy::allowDatabase( |
| 35 const blink::WebString& name, | 35 const blink::WebString& name, |
| 36 const blink::WebString& display_name, | 36 const blink::WebString& display_name, |
| 37 unsigned long estimated_size) { | 37 unsigned long estimated_size) { |
| 38 if (is_unique_origin_) | 38 if (is_unique_origin_) |
| 39 return false; | 39 return false; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 58 bool WorkerContentSettingsClientProxy::allowIndexedDB( | 58 bool WorkerContentSettingsClientProxy::allowIndexedDB( |
| 59 const blink::WebString& name) { | 59 const blink::WebString& name) { |
| 60 if (is_unique_origin_) | 60 if (is_unique_origin_) |
| 61 return false; | 61 return false; |
| 62 | 62 |
| 63 bool result = false; | 63 bool result = false; |
| 64 sync_message_filter_->Send(new ChromeViewHostMsg_AllowIndexedDB( | 64 sync_message_filter_->Send(new ChromeViewHostMsg_AllowIndexedDB( |
| 65 routing_id_, document_origin_url_, top_frame_origin_url_, name, &result)); | 65 routing_id_, document_origin_url_, top_frame_origin_url_, name, &result)); |
| 66 return result; | 66 return result; |
| 67 } | 67 } |
| OLD | NEW |