0
Files
src/content/browser/isolation_context.cc
Alex Moshchuk 99b7954248 Implement per-profile isolated origins.
Previously, isolated origins would apply globally for all profiles in
the entire browser.  This CL introduces support for associating
isolated origins with specific BrowserContexts (i.e., profiles):

1. The API for adding new isolated origins,
   ChildProcessSecurityPolicyImpl::AddIsolatedOrigins(), can now take
   a BrowserContext in which the origin should apply.

2. Entries in the map of isolated origins are extended to optionally
   contain the BrowserContext to which they apply.  If this is not
   specified, the corresponding isolated origin still applies globally
   to all profiles.  To facilitate checks on the IO thread, the
   ResourceContext (BrowserContext's representation on the IO thread)
   is also stored in the entry.

3. IsolationContext now also carries profile information (as
   BrowserOrResourceContext), and GetMatchingIsolatedOrigin() consults
   it to see if the profiles match when looking for matching isolated
   origins.  Various tests are updated to pass a proper BrowserContext
   to the IsolationContexts they construct.

Bug: 905513
Change-Id: Iad1fd2ca4ea701f9e088d30fa1b8582de9fbed67
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1497794
Commit-Queue: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638360}
2019-03-07 00:27:32 +00:00

28 lines
1012 B
C++

// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/isolation_context.h"
namespace content {
IsolationContext::IsolationContext(BrowserContext* browser_context)
: browser_or_resource_context_(BrowserOrResourceContext(browser_context)) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
}
IsolationContext::IsolationContext(BrowsingInstanceId browsing_instance_id,
BrowserContext* browser_context)
: IsolationContext(browsing_instance_id,
BrowserOrResourceContext(browser_context)) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
}
IsolationContext::IsolationContext(
BrowsingInstanceId browsing_instance_id,
BrowserOrResourceContext browser_or_resource_context)
: browsing_instance_id_(browsing_instance_id),
browser_or_resource_context_(browser_or_resource_context) {}
} // namespace content