guest_view.mojom 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 extensions.mojom;
  5. import "extensions/common/api/mime_handler.mojom";
  6. import "third_party/blink/public/mojom/loader/transferrable_url_loader.mojom";
  7. import "ui/gfx/geometry/mojom/geometry.mojom";
  8. import "url/mojom/url.mojom";
  9. interface GuestView {
  10. // Notifies the browser whether or not now is a good time to start loading the
  11. // MimeHandlerView. |routing_id| identifies the embedder frame. If |success|
  12. // is false, then MimeHandlerViewEmbedder should destroy itself. When
  13. // |success| is true the MimeHandlerViewEmbedder should proceed with attaching
  14. // the GuestView.
  15. ReadyToCreateMimeHandlerView(int32 routing_id, bool success);
  16. // Queries whether the frame identified by `routing_id` is allowed to inject
  17. // the script with the provided `script_id`.
  18. [Sync]
  19. CanExecuteContentScript(int32 routing_id, string script_id) => (bool allowed);
  20. };
  21. // An interface implemented by the renderer which is used for creating a
  22. // MimeHandlerViewFrameContainer. This interface is exposed on RenderFrame and
  23. // and is used by the browser to ask the renderer to start the MimeHandlerView
  24. // creation process (by creating a MimeHandlerViewFrameContainer).
  25. interface MimeHandlerViewContainerManager {
  26. // Sets the expected |internal_id| of the plugin element that will be used
  27. // to attach the MimeHandlerViewGuest.
  28. SetInternalId(string token_id);
  29. // Called by the browser to request a BeforeUnloadControl interface pointer
  30. // which will later be connected to the request from the extension page to
  31. // provide the beforeunload API (to setup beforeunload in the embedder
  32. // document). This is only relevant for the non-embedded MimeHandlerView (
  33. // e.g., full page navigations to a relevant MIME type).
  34. CreateBeforeUnloadControl()
  35. => (pending_remote<extensions.mime_handler.BeforeUnloadControl>
  36. before_unload_control);
  37. // Asks the renderer to destroy the MimeHandlerViewFrameContainer associated
  38. // with MimeHandlerViewGuest with |element_instance_id|.
  39. DestroyFrameContainer(int32 element_instance_id);
  40. // This is a signal to renderer that the the contents of MimeHandlerViewGuest
  41. // finished loading and therefore the renderer can forward the postMessages
  42. // to the GuestView (if any). |element_instance_id| is the instance ID for
  43. // MimeHandlerViewGuest and the |resource_url| is the original request's URL
  44. // that ended up creating the MimeHandlerViewGuest.
  45. DidLoad(
  46. int32 mime_handler_view_guest_element_instance_id,
  47. url.mojom.Url resource_url);
  48. };