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

Side by Side Diff: Source/core/dom/RemoteSecurityContext.cpp

Issue 520213002: Make SecurityContext available in RemoteFrames. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More feedback from Daniel Created 6 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
OLDNEW
(Empty)
1 // Copyright 2014 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 "config.h"
6 #include "core/dom/RemoteSecurityContext.h"
7
8 #include "core/frame/csp/ContentSecurityPolicy.h"
9 #include "platform/weborigin/SecurityOrigin.h"
10
11 namespace blink {
12
13 RemoteSecurityContext::RemoteSecurityContext()
14 : SecurityContext()
15 {
16 // RemoteSecurityContext's origin is expected to stay uninitialized until
17 // we set it using replicated origin data from the browser process.
18 ASSERT(!haveInitializedSecurityOrigin());
19
20 // CSP will not be replicated for RemoteSecurityContexts, as it is moving
21 // to the browser process. For now, initialize CSP to a default
22 // locked-down policy.
23 setContentSecurityPolicy(ContentSecurityPolicy::create());
24
25 // TODO(alexmos): Document::initSecurityContext has a few other things we
nasko 2014/11/19 01:16:09 nit: Blink uses FIXME without the username.
alexmos 2014/11/19 18:19:18 Done.
26 // may eventually want here, such as enforcing a setting to
27 // grantUniversalAccess().
28 }
29
30 PassRefPtr<RemoteSecurityContext> RemoteSecurityContext::create()
31 {
32 return adoptRef(new RemoteSecurityContext());
33 }
34
35 void RemoteSecurityContext::setReplicatedOrigin(PassRefPtr<SecurityOrigin> origi n)
36 {
37 // FIXME(alexmos): currently, replicated security origins are passed only
nasko 2014/11/19 01:16:09 nit: No need for "(alexmos)". Also s/currently/Cur
alexmos 2014/11/19 18:19:18 Done.
38 // at RemoteFrame creation time. Eventually, this class will also need to
39 // handle origin updates to handle cases like setting document.domain, but
40 // for now, check that this is the first and only time we are setting the
41 // origin.
42 ASSERT(!haveInitializedSecurityOrigin());
43 setSecurityOrigin(origin);
44 }
45
46
47 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698