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 3 // found in the LICENSE file. 4 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ 7 8 #include "base/callback_forward.h" 9 #include "base/process/kill.h" 10 #include "content/common/content_export.h" 11 12 namespace base { 13 class DictionaryValue; 14 } // namespace base 15 16 namespace gfx { 17 class Size; 18 } // namespace gfx 19 20 namespace content { 21 22 class WebContents; 23 24 // Objects implement this interface to get notified about changes in the guest 25 // WebContents and to provide necessary functionality. 26 class CONTENT_EXPORT BrowserPluginGuestDelegate { 27 public: ~BrowserPluginGuestDelegate()28 virtual ~BrowserPluginGuestDelegate() {} 29 30 // Notification that the embedder will begin attachment. This is called 31 // prior to resuming resource loads. WillAttach(content::WebContents * embedder_web_contents,const base::DictionaryValue & extra_params)32 virtual void WillAttach(content::WebContents* embedder_web_contents, 33 const base::DictionaryValue& extra_params) {} 34 35 // Notification that the embedder has completed attachment. DidAttach()36 virtual void DidAttach() {} 37 38 // Notifies that the content size of the guest has changed in autosize mode. SizeChanged(const gfx::Size & old_size,const gfx::Size & new_size)39 virtual void SizeChanged(const gfx::Size& old_size, 40 const gfx::Size& new_size) {} 41 42 // Asks the delegate if the given guest can lock the pointer. 43 // Invoking the |callback| synchronously is OK. RequestPointerLockPermission(bool user_gesture,bool last_unlocked_by_target,const base::Callback<void (bool)> & callback)44 virtual void RequestPointerLockPermission( 45 bool user_gesture, 46 bool last_unlocked_by_target, 47 const base::Callback<void(bool)>& callback) {} 48 49 // Requests that the delegate destroy itself along with its associated 50 // WebContents. Destroy()51 virtual void Destroy() {} 52 53 // Registers a |callback| with the delegate that the delegate would call when 54 // it is about to be destroyed. 55 typedef base::Callback<void()> DestructionCallback; RegisterDestructionCallback(const DestructionCallback & callback)56 virtual void RegisterDestructionCallback( 57 const DestructionCallback& callback) {} 58 }; 59 60 } // namespace content 61 62 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ 63