OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_BROWSER_GUEST_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_GUEST_HOST_H_ |
6 #define CONTENT_PUBLIC_BROWSER_GUEST_HOST_H_ | 6 #define CONTENT_PUBLIC_BROWSER_GUEST_HOST_H_ |
7 | 7 |
| 8 #include "third_party/WebKit/public/platform/WebFocusType.h" |
8 #include "ui/gfx/geometry/size.h" | 9 #include "ui/gfx/geometry/size.h" |
9 | 10 |
| 11 namespace blink { |
| 12 class WebInputEvent; |
| 13 } |
| 14 |
10 namespace content { | 15 namespace content { |
| 16 class WebContents; |
| 17 |
| 18 struct GuestAttachParams { |
| 19 bool focused; |
| 20 bool visible; |
| 21 gfx::Rect view_rect; |
| 22 bool is_full_page; |
| 23 |
| 24 GuestAttachParams() : focused(false), visible(false), is_full_page(false) {} |
| 25 }; |
11 | 26 |
12 // A GuestHost is the content API for a guest WebContents. | 27 // A GuestHost is the content API for a guest WebContents. |
13 // Guests are top-level frames that can be embedded within other pages. | 28 // Guests are top-level frames that can be embedded within other pages. |
14 // The content module manages routing of input events and compositing, but all | 29 // The content module manages routing of input events and compositing, but all |
15 // other operations are managed outside of content. To limit exposure of | 30 // other operations are managed outside of content. To limit exposure of |
16 // implementation details within content, content embedders must use this | 31 // implementation details within content, content embedders must use this |
17 // interface for loading, sizing, and cleanup of guests. | 32 // interface for loading, sizing, and cleanup of guests. |
18 // | 33 // |
19 // This class currently only serves as a base class for BrowserPluginGuest, and | 34 // This class currently only serves as a base class for BrowserPluginGuest, and |
20 // its API can only be accessed by a BrowserPluginGuestDelegate. | 35 // its API can only be accessed by a BrowserPluginGuestDelegate. |
21 class GuestHost { | 36 class GuestHost { |
22 public: | 37 public: |
| 38 // Called when a GuestView has attached to an embedder. |
| 39 virtual void Attach(int element_instance_id, |
| 40 WebContents* embedder_web_contents, |
| 41 const GuestAttachParams& params) = 0; |
| 42 |
23 // Loads a URL using the specified |load_params| and returns a routing ID for | 43 // Loads a URL using the specified |load_params| and returns a routing ID for |
24 // a proxy for the guest. | 44 // a proxy for the guest. |
25 virtual int LoadURLWithParams( | 45 virtual int LoadURLWithParams( |
26 const NavigationController::LoadURLParams& load_params) = 0; | 46 const NavigationController::LoadURLParams& load_params) = 0; |
27 | 47 |
28 // Called when the GuestHost's size changes due to auto resize. | 48 // Called when the GuestHost's size changes due to auto resize. |
29 virtual void GuestResizeDueToAutoResize(const gfx::Size& new_size) = 0; | 49 virtual void GuestResizeDueToAutoResize(const gfx::Size& new_size) = 0; |
30 | 50 |
| 51 // updates the visibility of the guest container. Note that the guest is |
| 52 // visible if both the guest's container and the guest's embedder are visible. |
| 53 virtual void SetContainerVisible(bool visible) = 0; |
| 54 |
| 55 // Updates the focus state of the guest. |
| 56 virtual void SetFocus(bool focused, blink::WebFocusType focus_type) = 0; |
| 57 |
31 // Sets the size of the guest WebContents. | 58 // Sets the size of the guest WebContents. |
32 virtual void SizeContents(const gfx::Size& new_size) = 0; | 59 virtual void SizeContents(const gfx::Size& new_size) = 0; |
33 | 60 |
| 61 // Forwards input events to the guest. |
| 62 virtual void ForwardInputEvent(const blink::WebInputEvent* event) = 0; |
| 63 |
34 // Called when the GuestHost is about to be destroyed. | 64 // Called when the GuestHost is about to be destroyed. |
35 virtual void WillDestroy() = 0; | 65 virtual void WillDestroy() = 0; |
36 }; | 66 }; |
37 | 67 |
38 } // namespace content | 68 } // namespace content |
39 | 69 |
40 #endif // CONTENT_PUBLIC_BROWSER_GUEST_HOST_H_ | 70 #endif // CONTENT_PUBLIC_BROWSER_GUEST_HOST_H_ |
OLD | NEW |