1 // Copyright 2014 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.
5 #ifndef EXTENSIONS_RENDERER_GUEST_VIEW_GUEST_VIEW_INTERNAL_CUSTOM_BINDINGS_H_
6 #define EXTENSIONS_RENDERER_GUEST_VIEW_GUEST_VIEW_INTERNAL_CUSTOM_BINDINGS_H_
8 #include "extensions/renderer/object_backed_native_handler.h"
10 namespace extensions
{
13 // Implements custom bindings for the guestViewInternal API.
14 class GuestViewInternalCustomBindings
: public ObjectBackedNativeHandler
{
16 explicit GuestViewInternalCustomBindings(ScriptContext
* context
);
19 // AttachGuest attaches a GuestView to a provided container element. Once
20 // attached, the GuestView will participate in layout of the container page
21 // and become visible on screen.
22 // AttachGuest takes four parameters:
23 // |element_instance_id| uniquely identifies a container within the content
24 // module is able to host GuestViews.
25 // |guest_instance_id| uniquely identifies an unattached GuestView.
26 // |attach_params| is typically used to convey the current state of the
27 // container element at the time of attachment. These parameters are passed
28 // down to the GuestView. The GuestView may use these parameters to update the
29 // state of the guest hosted in another process.
30 // |callback| is an optional callback that is called once attachment is
31 // complete. The callback takes in a parameter for the WindowProxy of the
32 // guest identified by |guest_instance_id|.
33 void AttachGuest(const v8::FunctionCallbackInfo
<v8::Value
>& args
);
35 // DetachGuest detaches the container container specified from the associated
36 // GuestViewBase. DetachGuest takes two parameters:
37 // |element_instance_id| uniquely identifies a container within the content
38 // module is able to host GuestViews.
39 // |callback| is an optional callback that is called once the container has
41 void DetachGuest(const v8::FunctionCallbackInfo
<v8::Value
>& args
);
43 // GetContentWindow takes in a RenderView routing ID and returns the
44 // Window JavaScript object for that RenderView.
45 void GetContentWindow(const v8::FunctionCallbackInfo
<v8::Value
>& args
);
47 // RegisterDestructionCallback registers a JavaScript callback function to be
48 // called when the guestview's container is destroyed.
49 // RegisterDestructionCallback takes in a single paramater, |callback|.
50 void RegisterDestructionCallback(
51 const v8::FunctionCallbackInfo
<v8::Value
>& args
);
53 // RegisterElementResizeCallback registers a JavaScript callback function to
54 // be called when the element is resized. RegisterElementResizeCallback takes
55 // a single parameter, |callback|.
56 void RegisterElementResizeCallback(
57 const v8::FunctionCallbackInfo
<v8::Value
>& args
);
59 // Runs a JavaScript function with user gesture.
61 // This is used to request webview element to enter fullscreen (from the
63 // Note that the guest requesting fullscreen means it has already been
64 // triggered by a user gesture and we get to this point if embedder allows
65 // the fullscreen request to proceed.
67 const v8::FunctionCallbackInfo
<v8::Value
>& args
);
70 } // namespace extensions
72 #endif // EXTENSIONS_RENDERER_GUEST_VIEW_GUEST_VIEW_INTERNAL_CUSTOM_BINDINGS_H_