Commit 7cebf831 authored by Kevin Marshall's avatar Kevin Marshall Committed by Commit Bot

Fuchsia: Initial "web" library interface definitions.

Defines the initial high-level structure for the "web" library, and
as a starting point, defines enough functionality that it can
be used in place of the existing WebView component in Fuchsia.


Bug: 822474
Change-Id: I870b217b8b3fbd4581ca511403c7759491a8d35d
Reviewed-on: https://chromium-review.googlesource.com/1083414
Commit-Queue: Kevin Marshall <kmarshall@chromium.org>
Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565116}
parent e0a7fd62
...@@ -5,10 +5,12 @@ ...@@ -5,10 +5,12 @@
assert(is_fuchsia) assert(is_fuchsia)
import("//build/config/fuchsia/rules.gni") import("//build/config/fuchsia/rules.gni")
import("//third_party/fuchsia-sdk/fidl_library.gni")
import("//tools/grit/repack.gni") import("//tools/grit/repack.gni")
executable("webrunner") { executable("webrunner") {
deps = [ deps = [
":fidl",
":webrunner_pak", ":webrunner_pak",
"//base", "//base",
"//components/version_info", "//components/version_info",
...@@ -92,3 +94,20 @@ repack("webrunner_pak") { ...@@ -92,3 +94,20 @@ repack("webrunner_pak") {
output = "$root_out_dir/webrunner.pak" output = "$root_out_dir/webrunner.pak"
} }
fidl_library("fidl") {
library_name = "fuchsia.web"
sources = [
"fidl/context.fidl",
"fidl/context_provider.fidl",
"fidl/frame.fidl",
"fidl/frame_observer.fidl",
"fidl/navigation_controller.fidl",
]
deps = [
"//third_party/fuchsia-sdk:sys",
"//third_party/fuchsia-sdk:views_v1",
]
}
// Copyright 2018 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.
library fuchsia.web;
// Manages browsing state (e.g. LocalStorage, cookies, etc) associated with
// a set of Frames.
interface Context {
// Creates a new frame under this Context.
//
// |observer|: An observer service, provided by the caller, which receives
// events originating from |frame|.
// |frame|: An interface request that will be bound to the created Frame.
1: CreateFrame(FrameObserver observer, request<Frame> frame);
};
// Copyright 2018 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.
library fuchsia.web;
// The top-level service interface which allows for the creation of
// Context resources.
[Discoverable]
interface ContextProvider {
// Creates a new browser Context whose state is wholly independent and
// isolated from other Contexts.
//
// context: An interface request which will receive a bound Context
// service.
1: Create(CreateContextParams params, request<Context> context);
};
struct CreateContextParams {
// Handle to the directory that will contain the Context's
// persistent data. If it is left unset, then the created Context will be
// stateless, with all of its data discarded upon Context destruction.
handle<channel>? dataDirectory;
};
// Copyright 2018 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.
library fuchsia.web;
interface Frame {
// Creates and registers a view with the view manager and returns its
// view owner which may subsequently be passed to |View.AddChild()|
// to attach the view to a view hierarchy.
//
// |view_owner|: Request for the Frame's ViewOwner.
// |services|: Request for the Frame's View-related services.
1: CreateView(request<fuchsia.ui.views_v1_token.ViewOwner> view_owner,
request<fuchsia.sys.ServiceProvider> services);
// Returns an interface through which the frame may be navigated to
// a desired URL, reloaded, etc.
//
// |view_provider|: An interface request for the Frame's
// NavigationController.
2: GetNavigationController(request<NavigationController> controller);
};
// Copyright 2018 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.
library fuchsia.web;
// Interface supplied by the embedder for receiving notifications about
// changes in a Frame.
interface FrameObserver {
// Called when user-visible navigation state has changed for the Frame.
1: OnNavigationStateChanged(NavigationStateChangeDetails change) -> ();
};
// Indicates which properties of the NavigationController's visible content
// that have changed since the last OnNavigationStateChanged() event.
struct NavigationStateChangeDetails {
bool url_changed;
bool title_changed;
// The Frame's visible navigation state, captured at the time the event was
// fired.
NavigationEntry entry;
};
// Copyright 2018 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.
library fuchsia.web;
// Provides methods for controlling and querying the navigation state
// of a Frame.
interface NavigationController {
// Tells the Frame to navigate to a |url|.
//
// |url|: The address to navigate to.
// |params|: Additional parameters that affect how the resource will be
// loaded (e.g. cookies, HTTP headers, etc.)
1: LoadUrl(string url, LoadUrlParams? params);
50: GoBack();
51: GoForward();
52: Stop();
53: Reload();
// Returns information for the currently visible content regardless of
// loading state, or a null entry if no content is being displayed.
100: GetVisibleEntry() -> (NavigationEntry? entry);
};
// Additional parameters for modifying the behavior of LoadUrl().
struct LoadUrlParams {
// Provides a hint to the browser UI about how LoadUrl was triggered.
LoadUrlReason type;
// The URL that linked to the resource being requested.
string referrer;
// Custom HTTP headers.
vector<vector<uint8>> headers;
};
// Characterizes the origin of a LoadUrl request.
enum LoadUrlReason {
LINK = 0; // Navigation was initiated by the user following a link.
TYPED = 1; // Navigation was initiated by a user-provided URL.
};
// Contains information about the Frame's navigation state.
// The Frame's navigation history can be represented as an aggregation of
// NavigationEntries.
struct NavigationEntry {
string url; // The page's URL.
string title; // The user-visible page title.
};
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