mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Unfork streamsPrivate API and add resourcesPrivate and tabs zoom APIs required by the PDF extension (issue #1947)
This commit is contained in:
@ -1,15 +1,17 @@
|
||||
This directory provides Mojo API definitions for CEF.
|
||||
|
||||
To add a new Mojo API:
|
||||
This directory provides API definitions for CEF. Some extensions are implemented
|
||||
using Mojo and others use an older JSON-based format.
|
||||
|
||||
<api> is the name of the API definition (e.g. 'streams_private').
|
||||
<class> is the name of the class implementation (e.g. 'StreamsPrivateAPI').
|
||||
|
||||
1. Add libcef/common/extensions/api/<api>.idl file which defines the API.
|
||||
2. Add <api>.idl to the 'schema_files' list in
|
||||
To add a new extension API implemented only in CEF ***:
|
||||
|
||||
1. Add libcef/common/extensions/api/<api>.idl or .json file which defines the
|
||||
API.
|
||||
2. Add <api>.idl or .json to the 'schema_files' list in
|
||||
libcef/common/extensions/api/schemas.gypi. Serialization code will be
|
||||
generated based on this list in step 5.
|
||||
3. Add an entry to libcef/common/extensions/api/_api_features.json if
|
||||
3. Add an entry in the libcef/common/extensions/api/_*_features.json files if
|
||||
necessary [1].
|
||||
4. Add libcef/browser/extensions/api/<api>/<api>_api.[h|cc] class implementation
|
||||
files and associated entries to the 'libcef_static' target in cef.gyp.
|
||||
@ -23,11 +25,26 @@ To add a new Mojo API:
|
||||
CefExtensionSystemFactory::CefExtensionSystemFactory in
|
||||
libcef/browser/extensions/extension_system_factory.cc if necessary [2].
|
||||
|
||||
*** Note that CEF does not currently expose its own Mojo APIs. Related code is
|
||||
commented out in:
|
||||
BUILD.gn
|
||||
cef.gyp
|
||||
CefExtensionsBrowserClient::RegisterExtensionFunctions
|
||||
CefExtensionsClient::IsAPISchemaGenerated
|
||||
CefExtensionsClient::GetAPISchema
|
||||
|
||||
To add a new extension API implemented in Chrome:
|
||||
|
||||
1. Register the API in libcef/browser/extensions/chrome_api_registration.cc
|
||||
2. Perform steps 3, 6 and 7 above.
|
||||
|
||||
See https://www.chromium.org/developers/design-documents/mojo for more
|
||||
information.
|
||||
|
||||
[1] A feature can optionally express requirements for where it can be accessed.
|
||||
See the _api_features.json file for additional details.
|
||||
See the _api_features.json and _permission_features.json files for
|
||||
additional details. For Chrome extensions this should match the definitions
|
||||
in the chrome/common/extensions/api/_*_features.json files.
|
||||
|
||||
[2] Some Mojo APIs use singleton Factory objects that create a one-to-one
|
||||
relationship between a service and a BrowserContext. This is used primarily
|
||||
|
@ -6,6 +6,9 @@
|
||||
// See extensions/common/features/* to understand this file, in particular
|
||||
// feature.h, simple_feature.h, and base_feature_provider.h.
|
||||
|
||||
// If APIs are defined in chrome then entries must also be added in
|
||||
// libcef/browser/extensions/chrome_api_registration.cc.
|
||||
|
||||
{
|
||||
// From chrome/common/extensions/api/_api_features.json.
|
||||
// Required by the PDF extension which is hosted in a guest view.
|
||||
@ -14,5 +17,20 @@
|
||||
"contexts": "all",
|
||||
"channel": "stable",
|
||||
"matches": ["<all_urls>"]
|
||||
},
|
||||
"resourcesPrivate": [{
|
||||
"dependencies": ["permission:resourcesPrivate"],
|
||||
"contexts": ["blessed_extension"]
|
||||
}, {
|
||||
"channel": "stable",
|
||||
"contexts": ["webui"],
|
||||
"matches": [
|
||||
"chrome://print/*"
|
||||
]
|
||||
}],
|
||||
"tabs": {
|
||||
"channel": "stable",
|
||||
"extension_types": ["extension", "legacy_packaged_app"],
|
||||
"contexts": ["blessed_extension", "extension_service_worker"]
|
||||
}
|
||||
}
|
||||
|
37
libcef/common/extensions/api/_permission_features.json
Normal file
37
libcef/common/extensions/api/_permission_features.json
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2012 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.
|
||||
|
||||
// This file defines permissions for extension APIs implemented by CEF.
|
||||
// See extensions/common/features/* to understand this file, in particular
|
||||
// feature.h, simple_feature.h, and base_feature_provider.h.
|
||||
|
||||
// If APIs are defined in chrome then entries must also be added in
|
||||
// libcef/browser/extensions/chrome_api_registration.cc.
|
||||
|
||||
{
|
||||
// From chrome/common/extensions/api/_permission_features.json.
|
||||
// Required by the PDF extension which is hosted in a guest view.
|
||||
"resourcesPrivate": {
|
||||
"channel": "stable",
|
||||
"extension_types": [
|
||||
"extension", "legacy_packaged_app", "platform_app"
|
||||
],
|
||||
"location": "component"
|
||||
},
|
||||
"tabs": [
|
||||
{
|
||||
"channel": "stable",
|
||||
"extension_types": ["extension", "legacy_packaged_app"]
|
||||
},
|
||||
{
|
||||
"channel": "stable",
|
||||
"extension_types": ["platform_app"],
|
||||
"whitelist": [
|
||||
"AE27D69DBE571F4B1694F05C89B710C646792231", // Published ADT.
|
||||
// TODO(grv): clean up once Apps developer tool is published.
|
||||
"5107DE9024C329EEA9C9A72D94C16723790C6422" // Apps Developer Tool.
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -8,11 +8,11 @@
|
||||
],
|
||||
'variables': {
|
||||
'schema_files': [
|
||||
'streams_private.idl',
|
||||
# TODO(cef): Add CEF-specific Mojo APIs here.
|
||||
],
|
||||
'non_compiled_schema_files': [
|
||||
],
|
||||
|
||||
|
||||
'chromium_code': 1,
|
||||
'cc_dir': 'cef/libcef/common/extensions/api',
|
||||
'root_namespace': 'extensions::api::cef::%(namespace)s',
|
||||
|
@ -1,57 +0,0 @@
|
||||
// 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.
|
||||
|
||||
// Streams Private API.
|
||||
namespace streamsPrivate {
|
||||
dictionary StreamInfo {
|
||||
// The MIME type of the intercepted URL request.
|
||||
DOMString mimeType;
|
||||
|
||||
// The original URL that was intercepted.
|
||||
DOMString originalUrl;
|
||||
|
||||
// The URL that the stream can be read from.
|
||||
DOMString streamUrl;
|
||||
|
||||
// The ID of the tab that opened the stream. If the stream is not opened in
|
||||
// a tab, it will be -1.
|
||||
long tabId;
|
||||
|
||||
// The ID of the view that will render the stream, if the viewer was opened
|
||||
// in a plugin.
|
||||
DOMString? viewId;
|
||||
|
||||
// The amount of data the Stream should contain, if known. If there is no
|
||||
// information on the size it will be -1.
|
||||
long expectedContentSize;
|
||||
|
||||
// The HTTP response headers of the intercepted request stored as a
|
||||
// dictionary mapping header name to header value. If a header name appears
|
||||
// multiple times, the header values are merged in the dictionary and
|
||||
// separated by a ", ".
|
||||
object responseHeaders;
|
||||
|
||||
// Whether the stream is embedded within another document.
|
||||
boolean embedded;
|
||||
};
|
||||
|
||||
callback AbortCallback = void ();
|
||||
|
||||
interface Functions {
|
||||
// Abort the URL request on the given stream.
|
||||
// |streamUrl| : The URL of the stream to abort.
|
||||
// |callback| : Called when the stream URL is guaranteed to be invalid. The
|
||||
// underlying URL request may not yet have been aborted when this is run.
|
||||
static void abort(DOMString streamUrl,
|
||||
optional AbortCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when a resource is fetched which matches a mime type handled by
|
||||
// this extension. The resource request is cancelled, and the extension is
|
||||
// expected to handle the request. The event is restricted to a small number
|
||||
// of white-listed extensions.
|
||||
static void onExecuteMimeTypeHandler(StreamInfo streamInfo);
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user