OLD | NEW |
(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 // FIXME: Document::initSecurityContext has a few other things we may |
| 26 // 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: Currently, replicated security origins are passed only at |
| 38 // 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 |
OLD | NEW |