summaryrefslogtreecommitdiffstats
path: root/components/view_manager/public/interfaces/view_tree_host.mojom
blob: ff1cad0babf61ca147bbf6f2369d73f26322658a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2015 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.

module mojo;

import "components/view_manager/public/interfaces/view_tree.mojom";
import "ui/mojo/events/input_event_constants.mojom";
import "ui/mojo/events/input_events.mojom";
import "ui/mojo/events/input_key_codes.mojom";
import "ui/mojo/geometry/geometry.mojom";

// ViewTreeHost encapsulates a unique underlying platform window, with a tree
// of views.
interface ViewTreeHost {
  // Sets the size of the platform window.
  SetSize(mojo.Size size);

  // Add and remove accelerators. When accelerators are registered the
  // ViewTreeHostClient receives the key event via OnAccelerator() rather than
  // the focused view. The id is defined by the client and can be used to more
  // easily identify the accelerator's action.
  AddAccelerator(uint32 id,
                 mojo.KeyboardCode keyboard_code,
                 mojo.EventFlags flags);
  RemoveAccelerator(uint32 id);
};

interface ViewTreeHostClient {
  // An accelerator registered via AddAccelerator() has been triggered.
  OnAccelerator(uint32 id, mojo.Event event);
};

interface ViewTreeHostFactory {
  CreateViewTreeHost(ViewTreeHost& view_tree_host,
                     ViewTreeHostClient? host_client,
                     ViewTreeClient tree_client);
};