Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / content / browser / frame_host / render_frame_host_impl.h
index 2430fec..3cdb035 100644 (file)
@@ -7,12 +7,15 @@
 
 #include <string>
 
+#include "base/callback.h"
 #include "base/compiler_specific.h"
+#include "base/strings/string16.h"
 #include "content/common/content_export.h"
 #include "content/public/browser/render_frame_host.h"
 
 class GURL;
 struct FrameHostMsg_DidFailProvisionalLoadWithError_Params;
+struct FrameMsg_Navigate_Params;
 
 namespace base {
 class FilePath;
@@ -26,6 +29,7 @@ class FrameTreeNode;
 class RenderFrameHostDelegate;
 class RenderProcessHost;
 class RenderViewHostImpl;
+struct ContextMenuParams;
 
 class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost {
  public:
@@ -38,6 +42,10 @@ class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost {
   virtual RenderProcessHost* GetProcess() OVERRIDE;
   virtual int GetRoutingID() OVERRIDE;
   virtual gfx::NativeView GetNativeView() OVERRIDE;
+  virtual void NotifyContextMenuClosed(
+      const CustomContextMenuContext& context) OVERRIDE;
+  virtual void ExecuteCustomContextMenuCommand(
+      int action, const CustomContextMenuContext& context) OVERRIDE;
   virtual RenderViewHost* GetRenderViewHost() OVERRIDE;
 
   // IPC::Sender
@@ -78,6 +86,26 @@ class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost {
     is_swapped_out_ = is_swapped_out;
   }
 
+  // Sets the RVH for |this| as pending shutdown. |on_swap_out| will be called
+  // when the SwapOutACK is received.
+  void SetPendingShutdown(const base::Closure& on_swap_out);
+
+  // TODO(nasko): This method is public so RenderViewHostImpl::Navigate can
+  // call it directly. It should be made private once Navigate moves here.
+  void OnDidStartLoading();
+
+  // Sends the given navigation message. Use this rather than sending it
+  // yourself since this does the internal bookkeeping described below. This
+  // function takes ownership of the provided message pointer.
+  //
+  // If a cross-site request is in progress, we may be suspended while waiting
+  // for the onbeforeunload handler, so this function might buffer the message
+  // rather than sending it.
+  void Navigate(const FrameMsg_Navigate_Params& params);
+
+  // Load the specified URL; this is a shortcut for Navigate().
+  void NavigateToURL(const GURL& url);
+
  protected:
   friend class RenderFrameHostFactory;
 
@@ -92,6 +120,7 @@ class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost {
                       bool is_swapped_out);
 
  private:
+  friend class TestRenderFrameHost;
   friend class TestRenderViewHost;
 
   // IPC Message handlers.
@@ -102,10 +131,24 @@ class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost {
                                          const GURL& url);
   void OnDidFailProvisionalLoadWithError(
       const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params);
+  void OnDidFailLoadWithError(
+      int64 frame_id,
+      const GURL& url,
+      bool is_main_frame,
+      int error_code,
+      const base::string16& error_description);
   void OnDidRedirectProvisionalLoad(int32 page_id,
                                     const GURL& source_url,
                                     const GURL& target_url);
+  void OnNavigate(const IPC::Message& msg);
+  void OnDidStopLoading();
   void OnSwapOutACK();
+  void OnContextMenu(const ContextMenuParams& params);
+
+  // Returns whether the given URL is allowed to commit in the current process.
+  // This is a more conservative check than RenderProcessHost::FilterURL, since
+  // it will be used to kill processes that commit unauthorized URLs.
+  bool CanCommitURL(const GURL& url);
 
   // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a
   // refcount that calls Shutdown when it reaches zero.  This allows each