mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-01-22 07:27:55 +01:00
8aac23386e
- Implement CefRequestHandler::OnBeforeBrowse using NavigationThrottle instead of ResourceThrottle (see http://crbug.com/537634). The CefRequest object passed to OnBeforeBrowse will no longer have an associated request identifier. - Mac: Remove additional helper apps which are no longer required (see http://crbug.com/520680) - Remove the UR_FLAG_REPORT_RAW_HEADERS flag which is no longer supported (see http://crbug.com/517114) - Remove the CefBrowserSettings.java parameter. Java is an NPAPI plugin and NPAPI plugins are no longer supported (see http://crbug.com/470301#c11) - Add CefFormatUrlForSecurityDisplay function in cef_parser.h - Fix crash when passing `--disable-extensions` command-line flag (issue #1721) - Linux: Fix NSS handler loading (issue #1727)
45 lines
1.6 KiB
C++
45 lines
1.6 KiB
C++
// Copyright 2014 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 "libcef/browser/extensions/extension_web_contents_observer.h"
|
|
|
|
#include "content/public/browser/child_process_security_policy.h"
|
|
#include "content/public/browser/render_process_host.h"
|
|
#include "content/public/browser/render_view_host.h"
|
|
#include "content/public/common/url_constants.h"
|
|
|
|
DEFINE_WEB_CONTENTS_USER_DATA_KEY(extensions::CefExtensionWebContentsObserver);
|
|
|
|
namespace extensions {
|
|
|
|
CefExtensionWebContentsObserver::CefExtensionWebContentsObserver(
|
|
content::WebContents* web_contents)
|
|
: ExtensionWebContentsObserver(web_contents) {
|
|
}
|
|
|
|
CefExtensionWebContentsObserver::~CefExtensionWebContentsObserver() {
|
|
}
|
|
|
|
void CefExtensionWebContentsObserver::RenderViewCreated(
|
|
content::RenderViewHost* render_view_host) {
|
|
ExtensionWebContentsObserver::RenderViewCreated(render_view_host);
|
|
|
|
const Extension* extension = GetExtension(render_view_host);
|
|
if (!extension)
|
|
return;
|
|
|
|
int process_id = render_view_host->GetProcess()->GetID();
|
|
auto policy = content::ChildProcessSecurityPolicy::GetInstance();
|
|
|
|
// Components of chrome that are implemented as extensions or platform apps
|
|
// are allowed to use chrome://resources/ URLs.
|
|
if ((extension->is_extension() || extension->is_platform_app()) &&
|
|
Manifest::IsComponentLocation(extension->location())) {
|
|
policy->GrantOrigin(process_id,
|
|
url::Origin(GURL(content::kChromeUIResourcesURL)));
|
|
}
|
|
}
|
|
|
|
} // namespace extensions
|