Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / content / public / browser / browser_plugin_guest_delegate.h
index 940ffd9..0b7372f 100644 (file)
@@ -7,16 +7,18 @@
 
 #include "base/callback_forward.h"
 #include "base/process/kill.h"
-#include "base/strings/string16.h"
-#include "base/values.h"
 #include "content/common/content_export.h"
-#include "content/public/common/browser_plugin_permission_type.h"
-#include "ui/gfx/size.h"
-#include "url/gurl.h"
+#include "content/public/browser/web_contents.h"
 
-namespace content {
+namespace base {
+class DictionaryValue;
+}  // namespace base
+
+namespace gfx {
+class Size;
+}  // namespace gfx
 
-struct NativeWebKeyboardEvent;
+namespace content {
 
 // Objects implement this interface to get notified about changes in the guest
 // WebContents and to provide necessary functionality.
@@ -24,73 +26,46 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
  public:
   virtual ~BrowserPluginGuestDelegate() {}
 
-  // Add a message to the console.
-  virtual void AddMessageToConsole(int32 level,
-                                   const base::string16& message,
-                                   int32 line_no,
-                                   const base::string16& source_id) {}
-
-  // Request the delegate to close this guest, and do whatever cleanup it needs
-  // to do.
-  virtual void Close() {}
-
-  // Notification that the embedder has completed attachment.
-  virtual void DidAttach() {}
-
-  // Informs the delegate that the guest render process is gone. |status|
-  // indicates whether the guest was killed, crashed, or was terminated
-  // gracefully.
-  virtual void GuestProcessGone(base::TerminationStatus status) {}
-
-  // Informs the delegate that the embedder has been destroyed.
-  virtual void EmbedderDestroyed() {}
-
-  virtual bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event);
-
-  // Requests setting the zoom level to the provided |zoom_level|.
-  virtual void SetZoom(double zoom_factor) {}
-
-  virtual bool IsDragAndDropEnabled();
-
-  // Returns whether the user agent for the guest is being overridden.
-  virtual bool IsOverridingUserAgent() const;
-
-  // Notification that a load in the guest resulted in abort. Note that |url|
-  // may be invalid.
-  virtual void LoadAbort(bool is_top_level,
-                         const GURL& url,
-                         const std::string& error_type) {}
-
-  // Notification that the page has made some progress loading. |progress| is a
-  // value between 0.0 (nothing loaded) and 1.0 (page loaded completely).
-  virtual void LoadProgressed(double progress) {}
-
-  // Notification that the guest is no longer hung.
-  virtual void RendererResponsive() {}
-
-  // Notification that the guest is hung.
-  virtual void RendererUnresponsive() {}
-
-  typedef base::Callback<void(bool /* allow */,
-                              const std::string& /* user_input */)>
-      PermissionResponseCallback;
-
-  // 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(
-      BrowserPluginPermissionType permission_type,
-      const base::DictionaryValue& request_info,
-      const PermissionResponseCallback& callback,
-      bool allowed_by_default);
-
-  // Requests resolution of a potentially relative URL.
-  virtual GURL ResolveURL(const std::string& src);
-
-  // 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) {}
+  // Notification that the embedder will begin attachment. This is called
+  // prior to resuming resource loads. |element_instance_id| uniquely identifies
+  // the element that will serve as a container for the guest.
+  virtual void WillAttach(content::WebContents* embedder_web_contents,
+                          int element_instance_id) {}
+
+  virtual WebContents* CreateNewGuestWindow(
+      const WebContents::CreateParams& create_params);
+
+  // Notification that the embedder has completed attachment. The
+  // |guest_proxy_routing_id| is the routing ID for the RenderView in the
+  // embedder that will serve as a contentWindow proxy for the guest.
+  virtual void DidAttach(int guest_proxy_routing_id) {}
+
+  // Notification that the BrowserPlugin has resized.
+  virtual void ElementSizeChanged(const gfx::Size& old_size,
+                                  const gfx::Size& new_size) {}
+
+  // Notifies that the content size of the guest has changed.
+  // Note: In autosize mode, it si possible that the guest size may not match
+  // the element size.
+  virtual void GuestSizeChanged(const gfx::Size& old_size,
+                                const gfx::Size& new_size) {}
+
+  // 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) {}
+
+  // Requests that the delegate destroy itself along with its associated
+  // WebContents.
+  virtual void Destroy() {}
+
+  // Registers a |callback| with the delegate that the delegate would call when
+  // it is about to be destroyed.
+  typedef base::Callback<void()> DestructionCallback;
+  virtual void RegisterDestructionCallback(
+      const DestructionCallback& callback) {}
 };
 
 }  // namespace content