1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 import "components/view_manager/public/interfaces/view_tree.mojom";
8 import "ui/mojo/events/input_event_constants.mojom";
9 import "ui/mojo/events/input_events.mojom";
10 import "ui/mojo/events/input_key_codes.mojom";
11 import "ui/mojo/geometry/geometry.mojom";
13 // ViewTreeHost encapsulates a unique underlying platform window, with a tree
15 interface ViewTreeHost {
16 // Sets the size of the platform window.
17 SetSize(mojo.Size size);
19 // Sets a title string to be displayed on the platform window.
20 SetTitle(string title);
22 // Add and remove accelerators. When accelerators are registered the
23 // ViewTreeHostClient receives the key event via OnAccelerator() rather than
24 // the focused view. The id is defined by the client and can be used to more
25 // easily identify the accelerator's action.
26 AddAccelerator(uint32 id,
27 mojo.KeyboardCode keyboard_code,
28 mojo.EventFlags flags);
29 RemoveAccelerator(uint32 id);
32 interface ViewTreeHostClient {
33 // An accelerator registered via AddAccelerator() has been triggered.
34 OnAccelerator(uint32 id, mojo.Event event);
37 interface ViewTreeHostFactory {
38 CreateViewTreeHost(ViewTreeHost& view_tree_host,
39 ViewTreeHostClient? host_client,
40 ViewTreeClient tree_client);