Chromium Code Reviews| 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" |
| 11 #include "content/public/browser/guest_sizer.h" | |
| 12 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 13 | 12 |
| 14 namespace base { | 13 namespace base { |
| 15 class DictionaryValue; | 14 class DictionaryValue; |
| 16 } // namespace base | 15 } // namespace base |
| 17 | 16 |
| 18 namespace gfx { | 17 namespace gfx { |
| 19 class Size; | 18 class Size; |
| 20 } // namespace gfx | 19 } // namespace gfx |
| 21 | 20 |
| 22 namespace content { | 21 namespace content { |
| 23 | 22 |
| 23 class GuestHost; | |
| 24 | |
| 24 // Objects implement this interface to get notified about changes in the guest | 25 // Objects implement this interface to get notified about changes in the guest |
| 25 // WebContents and to provide necessary functionality. | 26 // WebContents and to provide necessary functionality. |
| 26 class CONTENT_EXPORT BrowserPluginGuestDelegate { | 27 class CONTENT_EXPORT BrowserPluginGuestDelegate { |
| 27 public: | 28 public: |
| 28 virtual ~BrowserPluginGuestDelegate() {} | 29 virtual ~BrowserPluginGuestDelegate() {} |
| 29 | 30 |
| 30 // Notification that the embedder will begin attachment. This is called | 31 // Notification that the embedder will begin attachment. This is called |
| 31 // prior to resuming resource loads. |element_instance_id| uniquely identifies | 32 // prior to resuming resource loads. |element_instance_id| uniquely identifies |
| 32 // the element that will serve as a container for the guest. | 33 // the element that will serve as a container for the guest. |
| 33 virtual void WillAttach(content::WebContents* embedder_web_contents, | 34 virtual void WillAttach(content::WebContents* embedder_web_contents, |
| 34 int element_instance_id, | 35 int element_instance_id, |
| 35 bool is_full_page_plugin) {} | 36 bool is_full_page_plugin) {} |
| 36 | 37 |
| 37 virtual WebContents* CreateNewGuestWindow( | 38 virtual WebContents* CreateNewGuestWindow( |
| 38 const WebContents::CreateParams& create_params); | 39 const WebContents::CreateParams& create_params); |
| 39 | 40 |
| 40 // Asks the delegate whether this guest can run while detached from a | 41 // Asks the delegate whether this guest can run while detached from a |
| 41 // container. A detached guest is a WebContents that has no visual surface | 42 // container. A detached guest is a WebContents that has no visual surface |
| 42 // into which it can composite its content. Detached guests can be thought | 43 // into which it can composite its content. Detached guests can be thought |
| 43 // of as workers with a DOM. | 44 // of as workers with a DOM. |
| 44 virtual bool CanRunInDetachedState() const; | 45 virtual bool CanRunInDetachedState() const; |
| 45 | 46 |
| 46 // Notification that the embedder has completed attachment. The | 47 // Notification that the embedder has completed attachment. The |
| 47 // |guest_proxy_routing_id| is the routing ID for the RenderView in the | 48 // |guest_proxy_routing_id| is the routingID for the RenderView in the |
|
Charlie Reis
2015/03/09 23:39:24
nit: routing ID
| |
| 48 // embedder that will serve as a contentWindow proxy for the guest. | 49 // embedder that will serve as a contentWindow proxy for the guest. |
| 49 virtual void DidAttach(int guest_proxy_routing_id) {} | 50 virtual void DidAttach(int guest_proxy_routing_id) {} |
| 50 | 51 |
| 51 // Notification that the guest has detached from its container. | 52 // Notification that the guest has detached from its container. |
| 52 virtual void DidDetach() {} | 53 virtual void DidDetach() {} |
| 53 | 54 |
| 54 // Notification that a valid |url| was dropped over the guest. | 55 // Notification that a valid |url| was dropped over the guest. |
| 55 virtual void DidDropLink(const GURL& url) {} | 56 virtual void DidDropLink(const GURL& url) {} |
| 56 | 57 |
| 57 // Notification that the BrowserPlugin has resized. | 58 // Notification that the BrowserPlugin has resized. |
| 58 virtual void ElementSizeChanged(const gfx::Size& size) {} | 59 virtual void ElementSizeChanged(const gfx::Size& size) {} |
| 59 | 60 |
| 60 // Returns the WebContents that currently owns this guest. | 61 // Returns the WebContents that currently owns this guest. |
| 61 virtual WebContents* GetOwnerWebContents() const; | 62 virtual WebContents* GetOwnerWebContents() const; |
| 62 | 63 |
| 63 // Notifies that the content size of the guest has changed. | 64 // Notifies that the content size of the guest has changed. |
| 64 // Note: In autosize mode, it is possible that the guest size may not match | 65 // Note: In autosize mode, it is possible that the guest size may not match |
| 65 // the element size. | 66 // the element size. |
| 66 virtual void GuestSizeChanged(const gfx::Size& new_size) {} | 67 virtual void GuestSizeChanged(const gfx::Size& new_size) {} |
| 67 | 68 |
| 68 // Asks the delegate if the given guest can lock the pointer. | 69 // Asks the delegate if the given guest can lock the pointer. |
| 69 // Invoking the |callback| synchronously is OK. | 70 // Invoking the |callback| synchronously is OK. |
| 70 virtual void RequestPointerLockPermission( | 71 virtual void RequestPointerLockPermission( |
| 71 bool user_gesture, | 72 bool user_gesture, |
| 72 bool last_unlocked_by_target, | 73 bool last_unlocked_by_target, |
| 73 const base::Callback<void(bool)>& callback) {} | 74 const base::Callback<void(bool)>& callback) {} |
| 74 | 75 |
| 75 // Registers a |callback| with the delegate that the delegate would call when | |
| 76 // it is about to be destroyed. | |
| 77 typedef base::Callback<void()> DestructionCallback; | |
| 78 virtual void RegisterDestructionCallback( | |
| 79 const DestructionCallback& callback) {} | |
| 80 | |
| 81 // Find the given |search_text| in the page. Returns true if the find request | 76 // Find the given |search_text| in the page. Returns true if the find request |
| 82 // is handled by this browser plugin guest delegate. | 77 // is handled by this browser plugin guest delegate. |
| 83 virtual bool Find(int request_id, | 78 virtual bool Find(int request_id, |
| 84 const base::string16& search_text, | 79 const base::string16& search_text, |
| 85 const blink::WebFindOptions& options); | 80 const blink::WebFindOptions& options); |
| 86 virtual bool StopFinding(StopFindAction action); | 81 virtual bool StopFinding(StopFindAction action); |
| 87 | 82 |
| 88 // Provides the delegate with an interface with which to size the guest. | 83 // Provides the delegate with an interface with which to communicate with the |
| 89 virtual void SetGuestSizer(GuestSizer* guest_sizer) {} | 84 // content module. |
| 85 virtual void SetGuestHost(GuestHost* guest_host) {} | |
| 90 }; | 86 }; |
| 91 | 87 |
| 92 } // namespace content | 88 } // namespace content |
| 93 | 89 |
| 94 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ | 90 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ |
| OLD | NEW |