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

Side by Side Diff: content/worker/shared_worker_permission_client_proxy.cc

Issue 55433006: Explicitly reject storage access if requesting security origin is unique (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
OLDNEW
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 "content/worker/shared_worker_permission_client_proxy.h" 5 #include "content/worker/shared_worker_permission_client_proxy.h"
6 6
7 #include "content/child/thread_safe_sender.h" 7 #include "content/child/thread_safe_sender.h"
8 #include "content/common/worker_messages.h" 8 #include "content/common/worker_messages.h"
9 #include "third_party/WebKit/public/platform/WebString.h" 9 #include "third_party/WebKit/public/platform/WebString.h"
10 #include "url/gurl.h" 10 #include "url/gurl.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 SharedWorkerPermissionClientProxy::SharedWorkerPermissionClientProxy( 14 SharedWorkerPermissionClientProxy::SharedWorkerPermissionClientProxy(
15 const GURL& origin_url, 15 const GURL& origin_url,
16 bool is_unique_origin,
16 int routing_id, 17 int routing_id,
17 ThreadSafeSender* thread_safe_sender) 18 ThreadSafeSender* thread_safe_sender)
18 : origin_url_(origin_url), 19 : origin_url_(origin_url),
20 is_unique_origin_(is_unique_origin),
19 routing_id_(routing_id), 21 routing_id_(routing_id),
20 thread_safe_sender_(thread_safe_sender) { 22 thread_safe_sender_(thread_safe_sender) {
21 } 23 }
22 24
23 SharedWorkerPermissionClientProxy::~SharedWorkerPermissionClientProxy() { 25 SharedWorkerPermissionClientProxy::~SharedWorkerPermissionClientProxy() {
24 } 26 }
25 27
26 bool SharedWorkerPermissionClientProxy::allowDatabase( 28 bool SharedWorkerPermissionClientProxy::allowDatabase(
27 const WebKit::WebString& name, 29 const WebKit::WebString& name,
28 const WebKit::WebString& display_name, 30 const WebKit::WebString& display_name,
29 unsigned long estimated_size) { 31 unsigned long estimated_size) {
32 if (is_unique_origin_)
33 return false;
30 bool result = false; 34 bool result = false;
31 thread_safe_sender_->Send(new WorkerProcessHostMsg_AllowDatabase( 35 thread_safe_sender_->Send(new WorkerProcessHostMsg_AllowDatabase(
32 routing_id_, origin_url_, name, display_name, 36 routing_id_, origin_url_, name, display_name,
33 estimated_size, &result)); 37 estimated_size, &result));
34 return result; 38 return result;
35 } 39 }
36 40
37 bool SharedWorkerPermissionClientProxy::allowFileSystem() { 41 bool SharedWorkerPermissionClientProxy::allowFileSystem() {
42 if (is_unique_origin_)
43 return false;
38 bool result = false; 44 bool result = false;
39 thread_safe_sender_->Send(new WorkerProcessHostMsg_AllowFileSystem( 45 thread_safe_sender_->Send(new WorkerProcessHostMsg_AllowFileSystem(
40 routing_id_, origin_url_, &result)); 46 routing_id_, origin_url_, &result));
41 return result; 47 return result;
42 } 48 }
43 49
44 bool SharedWorkerPermissionClientProxy::allowIndexedDB( 50 bool SharedWorkerPermissionClientProxy::allowIndexedDB(
45 const WebKit::WebString& name) { 51 const WebKit::WebString& name) {
52 if (is_unique_origin_)
53 return false;
46 bool result = false; 54 bool result = false;
47 thread_safe_sender_->Send(new WorkerProcessHostMsg_AllowIndexedDB( 55 thread_safe_sender_->Send(new WorkerProcessHostMsg_AllowIndexedDB(
48 routing_id_, origin_url_, name, &result)); 56 routing_id_, origin_url_, name, &result));
49 return result; 57 return result;
50 } 58 }
51 59
52 } // namespace content 60 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698