Commit cd82364e authored by Sergey Ulanov's avatar Sergey Ulanov Committed by Commit Bot

[Fuchsia] Add web permissions in ApplicationConfig

Now cast_runner receives list of web permissions as part of the app
config and passes the list to the corresponding frame. This will be used
to enable microphone & camera access for apps that need it.

Bug: 922833
Change-Id: Ibae772c483a0389d3dee04722aeeb9e8c1b51015
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2084728
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarKevin Marshall <kmarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746545}
parent d276a488
......@@ -35,6 +35,9 @@ table ApplicationConfig {
/// Simulates a different resolution for rendering.
8: fuchsia.ui.gfx.vec2 force_content_dimensions;
/// List of the web permissions that should be granted to the application.
9: vector<fuchsia.web.PermissionDescriptor> permissions;
};
/// Service interface for working with application configurations.
......
......@@ -86,6 +86,27 @@ void CastComponent::StartComponent() {
frame(),
agent_manager_->ConnectToAgentService<chromium::cast::ApplicationContext>(
CastRunner::kAgentComponentUrl));
// Pass application permissions to the frame.
std::string origin = GURL(application_config_.web_url()).GetOrigin().spec();
if (application_config_.has_permissions()) {
for (auto& permission : application_config_.permissions()) {
fuchsia::web::PermissionDescriptor permission_clone;
zx_status_t status = permission.Clone(&permission_clone);
ZX_DCHECK(status == ZX_OK, status);
frame()->SetPermissionState(std::move(permission_clone), origin,
fuchsia::web::PermissionState::GRANTED);
}
} else {
// Grant PROTECTED_MEDIA_IDENTIFIER permission if permissions are not
// specified in the config. This is necessary for compatibility with older
// ApplicationConfigManager implementations that do not set permissions.
fuchsia::web::PermissionDescriptor eme_id_permission;
eme_id_permission.set_type(
fuchsia::web::PermissionType::PROTECTED_MEDIA_IDENTIFIER);
frame()->SetPermissionState(std::move(eme_id_permission), origin,
fuchsia::web::PermissionState::GRANTED);
}
}
void CastComponent::DestroyComponent(int termination_exit_code,
......
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