#include "base/values.h"
#include "content/common/content_export.h"
#include "content/public/common/browser_plugin_permission_type.h"
+#include "content/public/common/media_stream_request.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/size.h"
#include "url/gurl.h"
namespace content {
+class JavaScriptDialogManager;
+struct ContextMenuParams;
struct NativeWebKeyboardEvent;
+class WebContents;
// Objects implement this interface to get notified about changes in the guest
// WebContents and to provide necessary functionality.
// Notification that the embedder has completed attachment.
virtual void DidAttach() {}
+ // Returns the opener for this guest.
+ // TODO(fsamuel): Remove this once the New Window API is migrated outside of
+ // the content layer.
+ virtual WebContents* GetOpener() const;
+
// Informs the delegate that the guest render process is gone. |status|
// indicates whether the guest was killed, crashed, or was terminated
// gracefully.
// Request permission from the delegate to perform an action of the provided
// |permission_type|. Details of the permission request are found in
// |request_info|. A |callback| is provided to make the decision.
- // Returns whether the delegate has, or will handle the permission request.
- virtual bool RequestPermission(
+ virtual void RequestPermission(
BrowserPluginPermissionType permission_type,
const base::DictionaryValue& request_info,
const PermissionResponseCallback& callback,
- bool allowed_by_default);
+ bool allowed_by_default) {}
// Requests resolution of a potentially relative URL.
virtual GURL ResolveURL(const std::string& src);
+ // Informs the delegate of the WebContents that created delegate's associated
+ // WebContents.
+ // TODO(fsamuel): Remove this once the New Window API is migrated outside of
+ // the content layer.
+ virtual void SetOpener(WebContents* opener) {}
+
// Notifies that the content size of the guest has changed in autosize mode.
virtual void SizeChanged(const gfx::Size& old_size,
const gfx::Size& new_size) {}
+
+ // Asks permission to use the camera and/or microphone. If permission is
+ // granted, a call should be made to |callback| with the devices. If the
+ // request is denied, a call should be made to |callback| with an empty list
+ // of devices. |request| has the details of the request (e.g. which of audio
+ // and/or video devices are requested, and lists of available devices).
+ virtual void RequestMediaAccessPermission(
+ const MediaStreamRequest& request,
+ const MediaResponseCallback& callback);
+
+ // Asks the delegate if the given guest can download.
+ // Invoking the |callback| synchronously is OK.
+ virtual void CanDownload(const std::string& request_method,
+ const GURL& url,
+ const base::Callback<void(bool)>& callback);
+
+ // Asks the delegate if the given guest can lock the pointer.
+ // Invoking the |callback| synchronously is OK.
+ virtual void RequestPointerLockPermission(
+ bool user_gesture,
+ bool last_unlocked_by_target,
+ const base::Callback<void(bool)>& callback) {}
+
+ // Returns a pointer to a service to manage JavaScript dialogs. May return
+ // NULL in which case dialogs aren't shown.
+ virtual JavaScriptDialogManager* GetJavaScriptDialogManager();
+
+ // Returns true if the context menu operation was handled by the delegate.
+ virtual bool HandleContextMenu(const ContextMenuParams& params);
};
} // namespace content