application.mojom 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright 2018 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.
  4. module remote_cocoa.mojom;
  5. import "components/remote_cocoa/common/alert.mojom";
  6. import "components/remote_cocoa/common/color_panel.mojom";
  7. import "components/remote_cocoa/common/native_widget_ns_window.mojom";
  8. import "components/remote_cocoa/common/native_widget_ns_window_host.mojom";
  9. import "components/remote_cocoa/common/text_input_host.mojom";
  10. // Empty interface that is used by Application in place of
  11. // RenderWidgetHostNSViewBridge, RenderWidgetHostNSViewClient,
  12. // WebContentsNSViewBridge, and WebContentsNSViewClient (which are the real
  13. // interfaces that should be used). The reason that the correct interfaces
  14. // cannot be used directly is that they have dependencies on types that are in
  15. // content.
  16. // TODO(ccameron): Migrate the interfaces from content types to remote_cocoa
  17. // types, and then move the interfaces to this component.
  18. // https://crbug.com/888290
  19. interface StubInterface {};
  20. // Enum describing what edit command is being forwarded to the NSApplication.
  21. enum CutCopyPasteCommand {
  22. kCut, kCopy, kPaste
  23. };
  24. // The interface through which the browser controls the NSApplication in an
  25. // app shim process. This also the root interface to Cocoa, through which
  26. // various Cocoa types (NSAlert, NSWindow, NSView, etc) are created.
  27. interface Application {
  28. // Create a bridge for an NSAlert. The resulting object owns its own lifetime.
  29. CreateAlert(pending_receiver<AlertBridge> alert_bridge_receiver);
  30. // Show the NSColorPanel in this application.
  31. ShowColorPanel(pending_receiver<ColorPanel> receiver,
  32. pending_remote<ColorPanelHost> host);
  33. // Create a window for a native widget. The resulting object will be owned by
  34. // the connection for |host|. Closing that connection will result in deleting
  35. // the bridge.
  36. CreateNativeWidgetNSWindow(
  37. uint64 bridge_id,
  38. pending_associated_receiver<NativeWidgetNSWindow> window_receiver,
  39. pending_associated_remote<NativeWidgetNSWindowHost> host,
  40. pending_associated_remote<TextInputHost> text_input_host);
  41. // Create and take ownership of the NSView for a RenderWidgetHostView. The
  42. // resulting object will be destroyed when the connection is closed.
  43. // The value of |view_id| may be used to look up the NSView (e.g, to add
  44. // child NSViews or get a point relative to that NSView).
  45. CreateRenderWidgetHostNSView(
  46. uint64 view_id,
  47. pending_associated_remote<StubInterface> host,
  48. pending_associated_receiver<StubInterface> view_receiver);
  49. // Create and take ownership of the NSView for a WebContentsView. The
  50. // resulting object will be destroyed when the connection is closed.
  51. // The value of |view_id| may be used to look up the NSView (e.g, to add
  52. // child NSViews).
  53. CreateWebContentsNSView(
  54. uint64 view_id,
  55. pending_associated_remote<StubInterface> host,
  56. pending_associated_receiver<StubInterface> view_receiver);
  57. // Forwards a Cut, Copy or Paste operation to the NSApplication.
  58. ForwardCutCopyPaste(CutCopyPasteCommand command);
  59. };