Commit ebe3c763 authored by lfg's avatar lfg Committed by Commit bot

Moving last app_view bits to extensions.

This CL moves the app_view.js API to extensions.

This is still not enough to get app_view working in app_shell, this will be addressed in a future CL.

BUG=352293

Review URL: https://codereview.chromium.org/642863003

Cr-Commit-Position: refs/heads/master@{#299148}
parent b47e8a0b
......@@ -58,19 +58,6 @@
// Any webpage can use the app API.
"matches": ["<all_urls>"]
},
// The API for the *embedder* of appview. Appview has both an embedder and
// guest API, which are different.
"appViewEmbedderInternal": {
"internal": true,
"contexts": ["blessed_extension"],
"dependencies": ["permission:appview"]
},
// TODO(fsamuel,kalman): Rename this appViewGuestInternal.
"appViewInternal": {
"internal": true,
"channel": "dev",
"contexts": ["blessed_extension"]
},
"app.getDetails": {
"contexts": ["blessed_extension", "unblessed_extension", "content_script"],
"matches": []
......
......@@ -51,10 +51,6 @@
"5107DE9024C329EEA9C9A72D94C16723790C6422" // Apps Developer Tool Dev.
]
},
"appview": {
"channel": "dev",
"extension_types": ["platform_app"]
},
"alarms": {
"channel": "stable",
"extension_types": ["extension", "legacy_packaged_app", "platform_app"],
......
......@@ -30,8 +30,6 @@ std::vector<APIPermissionInfo*> ChromeAPIPermissions::GetAllPermissions()
const {
APIPermissionInfo::InitInfo permissions_to_register[] = {
// Register permissions for all extension types.
{APIPermission::kAppView, "appview",
APIPermissionInfo::kFlagCannotBeOptional},
{APIPermission::kBackground, "background"},
{APIPermission::kClipboardRead, "clipboardRead",
APIPermissionInfo::kFlagNone, IDS_EXTENSION_PROMPT_WARNING_CLIPBOARD,
......
......@@ -227,7 +227,6 @@ void ChromeExtensionsDispatcherDelegate::PopulateSourceMap(
IDR_CHROME_DIRECT_SETTING_JS);
// Platform app sources that are not API-specific..
source_map->RegisterSource("appView", IDR_APP_VIEW_JS);
source_map->RegisterSource("fileEntryBindingUtil",
IDR_FILE_ENTRY_BINDING_UTIL_JS);
source_map->RegisterSource("extensionOptions", IDR_EXTENSION_OPTIONS_JS);
......@@ -239,7 +238,6 @@ void ChromeExtensionsDispatcherDelegate::PopulateSourceMap(
source_map->RegisterSource("chromeWebView", IDR_CHROME_WEB_VIEW_JS);
source_map->RegisterSource("chromeWebViewExperimental",
IDR_CHROME_WEB_VIEW_EXPERIMENTAL_JS);
source_map->RegisterSource("denyAppView", IDR_APP_VIEW_DENY_JS);
source_map->RegisterSource("injectAppTitlebar", IDR_INJECT_APP_TITLEBAR_JS);
}
......@@ -270,12 +268,6 @@ void ChromeExtensionsDispatcherDelegate::RequireAdditionalModules(
}
}
if (context->GetAvailability("appViewEmbedderInternal").is_available()) {
module_system->Require("appView");
} else if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) {
module_system->Require("denyAppView");
}
if (extensions::FeatureSwitch::embedded_extension_options()->IsEnabled() &&
context->GetAvailability("extensionOptionsInternal").is_available()) {
module_system->Require("extensionOptions");
......
......@@ -31,8 +31,6 @@
<if expr="enable_extensions">
<!-- Custom bindings for extension APIs. -->
<include name="IDR_APP_CUSTOM_BINDINGS_JS" file="extensions\app_custom_bindings.js" type="BINDATA" />
<include name="IDR_APP_VIEW_DENY_JS" file="extensions\app_view_deny.js" type="BINDATA" />
<include name="IDR_APP_VIEW_JS" file="extensions\app_view.js" type="BINDATA" />
<include name="IDR_AUTOMATION_CUSTOM_BINDINGS_JS" file="extensions\automation_custom_bindings.js" type="BINDATA" />
<include name="IDR_AUTOMATION_EVENT_JS" file="extensions\automation\automation_event.js" type="BINDATA" />
<include name="IDR_AUTOMATION_NODE_JS" file="extensions\automation\automation_node.js" type="BINDATA" />
......
......@@ -69,6 +69,19 @@
"dependencies": ["permission:app.window.shape"],
"contexts": ["blessed_extension"]
},
// The API for the *embedder* of appview. Appview has both an embedder and
// guest API, which are different.
"appViewEmbedderInternal": {
"internal": true,
"contexts": ["blessed_extension"],
"dependencies": ["permission:appview"]
},
// TODO(fsamuel,kalman): Rename this appViewGuestInternal.
"appViewInternal": {
"internal": true,
"channel": "dev",
"contexts": ["blessed_extension"]
},
"bluetooth": {
"dependencies": ["manifest:bluetooth"],
"contexts": ["blessed_extension"]
......
......@@ -69,6 +69,10 @@
]
}
],
"appview": {
"channel": "dev",
"extension_types": ["platform_app"]
},
"audioCapture": [
{
"channel": "stable",
......
......@@ -32,6 +32,8 @@ std::vector<APIPermissionInfo*> ExtensionsAPIPermissions::GetAllPermissions()
APIPermissionInfo::InitInfo permissions_to_register[] = {
{APIPermission::kAlphaEnabled, "app.window.alpha"},
{APIPermission::kAlwaysOnTopWindows, "app.window.alwaysOnTop"},
{APIPermission::kAppView, "appview",
APIPermissionInfo::kFlagCannotBeOptional},
{APIPermission::kAudioCapture, "audioCapture",
APIPermissionInfo::kFlagNone, IDS_EXTENSION_PROMPT_WARNING_AUDIO_CAPTURE,
PermissionMessage::kAudioCapture},
......
......@@ -324,6 +324,12 @@ void Dispatcher::DidCreateScriptContext(
module_system->Require("platformApp");
}
if (context->GetAvailability("appViewEmbedderInternal").is_available()) {
module_system->Require("appView");
} else if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) {
module_system->Require("denyAppView");
}
// Note: setting up the WebView class here, not the chrome.webview API.
// The API will be automatically set up when first used.
if (context->GetAvailability("webViewInternal").is_available()) {
......@@ -513,6 +519,8 @@ std::vector<std::pair<std::string, int> > Dispatcher::GetJsResources() {
std::vector<std::pair<std::string, int> > resources;
// Libraries.
resources.push_back(std::make_pair("appView", IDR_APP_VIEW_JS));
resources.push_back(std::make_pair("denyAppView", IDR_APP_VIEW_DENY_JS));
resources.push_back(std::make_pair("entryIdManager", IDR_ENTRY_ID_MANAGER));
resources.push_back(std::make_pair(kEventBindings, IDR_EVENT_BINDINGS_JS));
resources.push_back(std::make_pair("imageUtil", IDR_IMAGE_UTIL_JS));
......
......@@ -9,6 +9,8 @@
<release seq="1">
<includes>
<!-- Extension libraries. -->
<include name="IDR_APP_VIEW_DENY_JS" file="app_view_deny.js" type="BINDATA" />
<include name="IDR_APP_VIEW_JS" file="app_view.js" type="BINDATA" />
<include name="IDR_ASYNC_WAITER_JS" file="async_waiter.js" type="BINDATA" />
<include name="IDR_DATA_RECEIVER_JS" file="data_receiver.js" type="BINDATA" />
<include name="IDR_DATA_SENDER_JS" file="data_sender.js" type="BINDATA" />
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment