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