File: views_hostable.h

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (92 lines) | stat: -rw-r--r-- 3,208 bytes parent folder | download | duplicates (9)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_BASE_COCOA_VIEWS_HOSTABLE_H_
#define UI_BASE_COCOA_VIEWS_HOSTABLE_H_

#include "base/component_export.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/native_widget_types.h"

namespace remote_cocoa {
namespace mojom {
class Application;
}  // namespace mojom
}  // namespace remote_cocoa

namespace ui {

class Layer;

// Interface that it used to stitch a content::WebContentsView into a
// views::View.
// TODO(ccameron): Move this to components/remote_cocoa.
class ViewsHostableView {
 public:
  // Host interface through which the WebContentsView may indicate that its C++
  // object is destroying.
  class Host {
   public:
    // Query the ui::Layer of the host.
    virtual ui::Layer* GetUiLayer() const = 0;

    // Return the mojo interface to the application in a remote process in which
    // the host NSView exists. Used to migrate the content::WebContentsView and
    // content::RenderWidgetHostView to that process.
    virtual remote_cocoa::mojom::Application* GetRemoteCocoaApplication()
        const = 0;

    // The id for the views::View's NSView. Used to add the
    // content::WebContentsView's NSView as a child view.
    virtual uint64_t GetNSViewId() const = 0;

    // Called when the hostable view will be destroyed.
    virtual void OnHostableViewDestroying() = 0;
  };

  // Called to add the content::WebContentsView's NSView as a subview of the
  // views::View's NSView. This is responsible for:
  // - Adding the WebContentsView's ui::Layer to the parent's ui::Layer tree.
  // - Stitching together the accessibility tree between the views::View and
  //   the WebContentsView.
  // - Adding the WebContents browser-side and app-shim-side NSViews as children
  //   to the views::View's NSViews.
  virtual void ViewsHostableAttach(Host* host) = 0;

  // Called when the WebContentsView's NSView has been removed from the
  // views::View's NSView. This is responsible for un-doing all of the actions
  // taken when attaching.
  virtual void ViewsHostableDetach() = 0;

  // Resize the WebContentsView's NSView.
  virtual void ViewsHostableSetBounds(const gfx::Rect& bounds_in_window) = 0;

  // Show or hide the WebContentsView's NSView.
  virtual void ViewsHostableSetVisible(bool visible) = 0;

  // Make the WebContentsView's NSView be a first responder.
  virtual void ViewsHostableMakeFirstResponder() = 0;

  // Set the WebContentsView's parent accessibility element.
  virtual void ViewsHostableSetParentAccessible(
      gfx::NativeViewAccessible parent_accessibility_element) = 0;

  // Get the WebContentsView's parent accessibility element.
  virtual gfx::NativeViewAccessible ViewsHostableGetParentAccessible() = 0;

  // Retrieve the WebContentsView's accessibility element.
  virtual gfx::NativeViewAccessible ViewsHostableGetAccessibilityElement() = 0;
};

}  // namespace ui

// The protocol through which an NSView indicates support for the
// ViewsHostableView interface.
@protocol ViewsHostable

- (ui::ViewsHostableView*)viewsHostableView;

@end

#endif  // UI_BASE_COCOA_VIEWS_HOSTABLE_H_