| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_PLUGIN_GUEST_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "base/process/kill.h" | 9 #include "base/process/kill.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // Notification that the embedder will begin attachment. This is called | 29 // Notification that the embedder will begin attachment. This is called |
| 30 // prior to resuming resource loads. |element_instance_id| uniquely identifies | 30 // prior to resuming resource loads. |element_instance_id| uniquely identifies |
| 31 // the element that will serve as a container for the guest. | 31 // the element that will serve as a container for the guest. |
| 32 virtual void WillAttach(content::WebContents* embedder_web_contents, | 32 virtual void WillAttach(content::WebContents* embedder_web_contents, |
| 33 int element_instance_id, | 33 int element_instance_id, |
| 34 bool is_full_page_plugin) {} | 34 bool is_full_page_plugin) {} |
| 35 | 35 |
| 36 virtual WebContents* CreateNewGuestWindow( | 36 virtual WebContents* CreateNewGuestWindow( |
| 37 const WebContents::CreateParams& create_params); | 37 const WebContents::CreateParams& create_params); |
| 38 | 38 |
| 39 // Asks the delegate whether this guest can run while detached from a |
| 40 // container. A detached guest is a WebContents that has no visual surface |
| 41 // into which it can composite its content. Detached guests can be thought |
| 42 // of as workers with a DOM. |
| 43 virtual bool CanRunInDetachedState() const; |
| 44 |
| 39 // Notification that the embedder has completed attachment. The | 45 // Notification that the embedder has completed attachment. The |
| 40 // |guest_proxy_routing_id| is the routing ID for the RenderView in the | 46 // |guest_proxy_routing_id| is the routing ID for the RenderView in the |
| 41 // embedder that will serve as a contentWindow proxy for the guest. | 47 // embedder that will serve as a contentWindow proxy for the guest. |
| 42 virtual void DidAttach(int guest_proxy_routing_id) {} | 48 virtual void DidAttach(int guest_proxy_routing_id) {} |
| 43 | 49 |
| 44 // Notification that the guest has detached from its container. | 50 // Notification that the guest has detached from its container. |
| 45 virtual void DidDetach() {} | 51 virtual void DidDetach() {} |
| 46 | 52 |
| 47 // Notification that the BrowserPlugin has resized. | 53 // Notification that the BrowserPlugin has resized. |
| 48 virtual void ElementSizeChanged(const gfx::Size& old_size, | 54 virtual void ElementSizeChanged(const gfx::Size& old_size, |
| 49 const gfx::Size& new_size) {} | 55 const gfx::Size& new_size) {} |
| 50 | 56 |
| 57 // Returns the WebContents that currently owns this guest. |
| 58 virtual WebContents* GetOwnerWebContents() const; |
| 59 |
| 51 // Notifies that the content size of the guest has changed. | 60 // Notifies that the content size of the guest has changed. |
| 52 // Note: In autosize mode, it si possible that the guest size may not match | 61 // Note: In autosize mode, it si possible that the guest size may not match |
| 53 // the element size. | 62 // the element size. |
| 54 virtual void GuestSizeChanged(const gfx::Size& old_size, | 63 virtual void GuestSizeChanged(const gfx::Size& old_size, |
| 55 const gfx::Size& new_size) {} | 64 const gfx::Size& new_size) {} |
| 56 | 65 |
| 57 // Asks the delegate if the given guest can lock the pointer. | 66 // Asks the delegate if the given guest can lock the pointer. |
| 58 // Invoking the |callback| synchronously is OK. | 67 // Invoking the |callback| synchronously is OK. |
| 59 virtual void RequestPointerLockPermission( | 68 virtual void RequestPointerLockPermission( |
| 60 bool user_gesture, | 69 bool user_gesture, |
| 61 bool last_unlocked_by_target, | 70 bool last_unlocked_by_target, |
| 62 const base::Callback<void(bool)>& callback) {} | 71 const base::Callback<void(bool)>& callback) {} |
| 63 | 72 |
| 64 // Registers a |callback| with the delegate that the delegate would call when | 73 // Registers a |callback| with the delegate that the delegate would call when |
| 65 // it is about to be destroyed. | 74 // it is about to be destroyed. |
| 66 typedef base::Callback<void()> DestructionCallback; | 75 typedef base::Callback<void()> DestructionCallback; |
| 67 virtual void RegisterDestructionCallback( | 76 virtual void RegisterDestructionCallback( |
| 68 const DestructionCallback& callback) {} | 77 const DestructionCallback& callback) {} |
| 69 | 78 |
| 70 // Find the given |search_text| in the page. Returns true if the find request | 79 // Find the given |search_text| in the page. Returns true if the find request |
| 71 // is handled by this browser plugin guest delegate. | 80 // is handled by this browser plugin guest delegate. |
| 72 virtual bool Find(int request_id, | 81 virtual bool Find(int request_id, |
| 73 const base::string16& search_text, | 82 const base::string16& search_text, |
| 74 const blink::WebFindOptions& options); | 83 const blink::WebFindOptions& options); |
| 75 }; | 84 }; |
| 76 | 85 |
| 77 } // namespace content | 86 } // namespace content |
| 78 | 87 |
| 79 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ | 88 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ |
| OLD | NEW |