Chromium Code Reviews| 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/common/render_messages.h" | 5 #include "chrome/common/render_messages.h" |
| 6 #include "chrome/renderer/permission_request_map.h" | |
| 6 #include "chrome/renderer/worker_permission_client_proxy.h" | 7 #include "chrome/renderer/worker_permission_client_proxy.h" |
| 7 #include "content/public/renderer/render_frame.h" | 8 #include "content/public/renderer/render_frame.h" |
| 8 #include "content/public/renderer/render_thread.h" | 9 #include "content/public/renderer/render_thread.h" |
| 9 #include "ipc/ipc_sync_message_filter.h" | 10 #include "ipc/ipc_sync_message_filter.h" |
| 11 #include "third_party/WebKit/public/platform/WebPermissionCallbacks.h" | |
| 10 #include "third_party/WebKit/public/web/WebDocument.h" | 12 #include "third_party/WebKit/public/web/WebDocument.h" |
| 11 #include "third_party/WebKit/public/web/WebFrame.h" | 13 #include "third_party/WebKit/public/web/WebFrame.h" |
| 12 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 14 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
| 13 | 15 |
| 14 WorkerPermissionClientProxy::WorkerPermissionClientProxy( | 16 WorkerPermissionClientProxy::WorkerPermissionClientProxy( |
| 15 content::RenderFrame* render_frame, | 17 content::RenderFrame* render_frame, |
| 16 blink::WebFrame* frame) | 18 blink::WebFrame* frame) |
| 17 : routing_id_(render_frame->GetRoutingID()), | 19 : routing_id_(render_frame->GetRoutingID()), |
| 18 is_unique_origin_(false) { | 20 is_unique_origin_(false) { |
| 19 if (frame->document().securityOrigin().isUnique() || | 21 if (frame->document().securityOrigin().isUnique() || |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 44 bool WorkerPermissionClientProxy::allowFileSystem() { | 46 bool WorkerPermissionClientProxy::allowFileSystem() { |
| 45 if (is_unique_origin_) | 47 if (is_unique_origin_) |
| 46 return false; | 48 return false; |
| 47 | 49 |
| 48 bool result = false; | 50 bool result = false; |
| 49 sync_message_filter_->Send(new ChromeViewHostMsg_AllowFileSystem( | 51 sync_message_filter_->Send(new ChromeViewHostMsg_AllowFileSystem( |
| 50 routing_id_, document_origin_url_, top_frame_origin_url_, &result)); | 52 routing_id_, document_origin_url_, top_frame_origin_url_, &result)); |
| 51 return result; | 53 return result; |
| 52 } | 54 } |
| 53 | 55 |
| 56 void WorkerPermissionClientProxy::requestFileSystemAccess( | |
| 57 const blink::WebPermissionCallbacks& callbacks) { | |
| 58 bool result = false; | |
| 59 sync_message_filter_->Send(new ChromeViewHostMsg_AllowFileSystem( | |
| 60 routing_id_, document_origin_url_, top_frame_origin_url_, &result)); | |
| 61 blink::WebPermissionCallbacks permission_callbacks(callbacks); | |
| 62 if (result) { | |
| 63 permission_callbacks.doAllow(); | |
| 64 } else { | |
| 65 permission_callbacks.doDeny(); | |
| 66 } | |
|
kinuko
2014/03/05 08:35:44
no need of { } for single-line body
Fady Samuel
2014/03/06 18:38:25
Switched to early exit.
| |
| 67 } | |
| 68 | |
| 54 bool WorkerPermissionClientProxy::allowIndexedDB( | 69 bool WorkerPermissionClientProxy::allowIndexedDB( |
| 55 const blink::WebString& name) { | 70 const blink::WebString& name) { |
| 56 if (is_unique_origin_) | 71 if (is_unique_origin_) |
| 57 return false; | 72 return false; |
| 58 | 73 |
| 59 bool result = false; | 74 bool result = false; |
| 60 sync_message_filter_->Send(new ChromeViewHostMsg_AllowIndexedDB( | 75 sync_message_filter_->Send(new ChromeViewHostMsg_AllowIndexedDB( |
| 61 routing_id_, document_origin_url_, top_frame_origin_url_, name, &result)); | 76 routing_id_, document_origin_url_, top_frame_origin_url_, name, &result)); |
| 62 return result; | 77 return result; |
| 63 } | 78 } |
| OLD | NEW |