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.h" | 5 #include "chrome/renderer/worker_content_settings_client.h" |
6 | 6 |
7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
8 #include "content/public/renderer/render_frame.h" | 8 #include "content/public/renderer/render_frame.h" |
9 #include "content/public/renderer/render_thread.h" | 9 #include "content/public/renderer/render_thread.h" |
10 #include "ipc/ipc_sync_message_filter.h" | 10 #include "ipc/ipc_sync_message_filter.h" |
11 #include "third_party/WebKit/public/platform/URLConversion.h" | 11 #include "third_party/WebKit/public/platform/URLConversion.h" |
12 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 12 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
13 #include "third_party/WebKit/public/web/WebDocument.h" | 13 #include "third_party/WebKit/public/web/WebDocument.h" |
14 #include "third_party/WebKit/public/web/WebFrame.h" | 14 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
15 #include "url/origin.h" | 15 #include "url/origin.h" |
16 | 16 |
17 WorkerContentSettingsClient::WorkerContentSettingsClient( | 17 WorkerContentSettingsClient::WorkerContentSettingsClient( |
18 content::RenderFrame* render_frame, | 18 content::RenderFrame* render_frame) |
19 blink::WebFrame* frame) | |
20 : routing_id_(render_frame->GetRoutingID()), is_unique_origin_(false) { | 19 : routing_id_(render_frame->GetRoutingID()), is_unique_origin_(false) { |
| 20 blink::WebLocalFrame* frame = render_frame->GetWebFrame(); |
21 if (frame->GetDocument().GetSecurityOrigin().IsUnique() || | 21 if (frame->GetDocument().GetSecurityOrigin().IsUnique() || |
22 frame->Top()->GetSecurityOrigin().IsUnique()) | 22 frame->Top()->GetSecurityOrigin().IsUnique()) |
23 is_unique_origin_ = true; | 23 is_unique_origin_ = true; |
24 sync_message_filter_ = content::RenderThread::Get()->GetSyncMessageFilter(); | 24 sync_message_filter_ = content::RenderThread::Get()->GetSyncMessageFilter(); |
25 document_origin_url_ = | 25 document_origin_url_ = |
26 url::Origin(frame->GetDocument().GetSecurityOrigin()).GetURL(); | 26 url::Origin(frame->GetDocument().GetSecurityOrigin()).GetURL(); |
27 top_frame_origin_url_ = | 27 top_frame_origin_url_ = |
28 url::Origin(frame->Top()->GetSecurityOrigin()).GetURL(); | 28 url::Origin(frame->Top()->GetSecurityOrigin()).GetURL(); |
29 } | 29 } |
30 | 30 |
(...skipping 14 matching lines...) Expand all Loading... |
45 const blink::WebSecurityOrigin&) { | 45 const blink::WebSecurityOrigin&) { |
46 if (is_unique_origin_) | 46 if (is_unique_origin_) |
47 return false; | 47 return false; |
48 | 48 |
49 bool result = false; | 49 bool result = false; |
50 sync_message_filter_->Send(new ChromeViewHostMsg_AllowIndexedDB( | 50 sync_message_filter_->Send(new ChromeViewHostMsg_AllowIndexedDB( |
51 routing_id_, document_origin_url_, top_frame_origin_url_, name.Utf16(), | 51 routing_id_, document_origin_url_, top_frame_origin_url_, name.Utf16(), |
52 &result)); | 52 &result)); |
53 return result; | 53 return result; |
54 } | 54 } |
OLD | NEW |