Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: chrome/renderer/worker_permission_client_proxy.cc

Issue 46583005: Send Allow{Database,FileSystem,IndexedDB} sync IPCs directly from worker thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/worker_permission_client_proxy.h ('k') | content/content_worker.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 "chrome/common/render_messages.h"
6 #include "chrome/renderer/worker_permission_client_proxy.h"
7 #include "content/public/renderer/render_thread.h"
8 #include "content/public/renderer/render_view.h"
9 #include "ipc/ipc_sync_message_filter.h"
10 #include "third_party/WebKit/public/web/WebDocument.h"
11 #include "third_party/WebKit/public/web/WebFrame.h"
12 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
13
14 WorkerPermissionClientProxy::WorkerPermissionClientProxy(
15 content::RenderView* render_view,
16 WebKit::WebFrame* frame)
17 : routing_id_(render_view->GetRoutingID()),
18 is_unique_origin_(false) {
19 if (frame->document().securityOrigin().isUnique() ||
20 frame->top()->document().securityOrigin().isUnique())
21 is_unique_origin_ = true;
22 sync_message_filter_ = content::RenderThread::Get()->GetSyncMessageFilter();
23 document_origin_url_ = GURL(frame->document().securityOrigin().toString());
24 top_frame_origin_url_ = GURL(
25 frame->top()->document().securityOrigin().toString());
26 }
27
28 WorkerPermissionClientProxy::~WorkerPermissionClientProxy(
29 ) {}
michaeln 2013/10/30 19:27:27 nit: line wrap is weird
kinuko 2013/10/31 05:15:08 Done.
30
31 bool WorkerPermissionClientProxy::allowDatabase(
32 const WebKit::WebString& name,
33 const WebKit::WebString& display_name,
34 unsigned long estimated_size) {
35 if (is_unique_origin_)
36 return false;
37
38 bool result = false;
39 sync_message_filter_->Send(new ChromeViewHostMsg_AllowDatabase(
40 routing_id_, document_origin_url_, top_frame_origin_url_,
41 name, display_name, &result));
42 return result;
43 }
44
45 bool WorkerPermissionClientProxy::allowFileSystem() {
46 if (is_unique_origin_)
47 return false;
48
49 bool result = false;
50 sync_message_filter_->Send(new ChromeViewHostMsg_AllowFileSystem(
51 routing_id_, document_origin_url_, top_frame_origin_url_, &result));
52 return result;
53 }
54
55 bool WorkerPermissionClientProxy::allowIndexedDB(
56 const WebKit::WebString& name) {
57 if (is_unique_origin_)
58 return false;
59
60 bool result = false;
61 sync_message_filter_->Send(new ChromeViewHostMsg_AllowIndexedDB(
62 routing_id_, document_origin_url_, top_frame_origin_url_, name, &result));
63 return result;
64 }
OLDNEW
« no previous file with comments | « chrome/renderer/worker_permission_client_proxy.h ('k') | content/content_worker.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698