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