| 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 |
| 30 // Notification that the embedder will begin attachment. This is called | 29 // Notification that the embedder will begin attachment. This is called |
| 31 // prior to resuming resource loads. | 30 // prior to resuming resource loads. |
| 32 virtual void WillAttach(content::WebContents* embedder_web_contents, | 31 virtual void WillAttach(content::WebContents* embedder_web_contents, |
| 33 const base::DictionaryValue& extra_params) {} | 32 const base::DictionaryValue& extra_params) {} |
| 34 | 33 |
| 34 virtual WebContents* CreateNewGuestWindow( |
| 35 const WebContents::CreateParams& create_params); |
| 36 |
| 35 // Notification that the embedder has completed attachment. | 37 // Notification that the embedder has completed attachment. |
| 36 virtual void DidAttach() {} | 38 virtual void DidAttach() {} |
| 37 | 39 |
| 40 // Requests the instance ID associated with the delegate. |
| 41 virtual int GetGuestInstanceID() const; |
| 42 |
| 38 // Notifies that the content size of the guest has changed in autosize mode. | 43 // Notifies that the content size of the guest has changed in autosize mode. |
| 39 virtual void SizeChanged(const gfx::Size& old_size, | 44 virtual void SizeChanged(const gfx::Size& old_size, |
| 40 const gfx::Size& new_size) {} | 45 const gfx::Size& new_size) {} |
| 41 | 46 |
| 42 // Asks the delegate if the given guest can lock the pointer. | 47 // Asks the delegate if the given guest can lock the pointer. |
| 43 // Invoking the |callback| synchronously is OK. | 48 // Invoking the |callback| synchronously is OK. |
| 44 virtual void RequestPointerLockPermission( | 49 virtual void RequestPointerLockPermission( |
| 45 bool user_gesture, | 50 bool user_gesture, |
| 46 bool last_unlocked_by_target, | 51 bool last_unlocked_by_target, |
| 47 const base::Callback<void(bool)>& callback) {} | 52 const base::Callback<void(bool)>& callback) {} |
| 48 | 53 |
| 49 // Requests that the delegate destroy itself along with its associated | 54 // Requests that the delegate destroy itself along with its associated |
| 50 // WebContents. | 55 // WebContents. |
| 51 virtual void Destroy() {} | 56 virtual void Destroy() {} |
| 52 | 57 |
| 53 // Registers a |callback| with the delegate that the delegate would call when | 58 // Registers a |callback| with the delegate that the delegate would call when |
| 54 // it is about to be destroyed. | 59 // it is about to be destroyed. |
| 55 typedef base::Callback<void()> DestructionCallback; | 60 typedef base::Callback<void()> DestructionCallback; |
| 56 virtual void RegisterDestructionCallback( | 61 virtual void RegisterDestructionCallback( |
| 57 const DestructionCallback& callback) {} | 62 const DestructionCallback& callback) {} |
| 58 }; | 63 }; |
| 59 | 64 |
| 60 } // namespace content | 65 } // namespace content |
| 61 | 66 |
| 62 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ | 67 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ |
| OLD | NEW |