Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / tab_contents / chrome_web_contents_view_delegate_mac.h
index 4148a01..eec3c0b 100644 (file)
@@ -9,35 +9,44 @@
 
 #include "base/basictypes.h"
 #include "base/memory/scoped_ptr.h"
+#include "components/renderer_context_menu/context_menu_delegate.h"
 #include "content/public/browser/web_contents_view_delegate.h"
 
-class RenderViewContextMenuMac;
+class RenderViewContextMenuBase;
 class WebDragBookmarkHandlerMac;
 
 namespace content {
+class RenderWidgetHostView;
 class WebContents;
 }
 
 // A chrome/ specific class that extends WebContentsViewMac with features that
 // live in chrome/.
 class ChromeWebContentsViewDelegateMac
-    : public content::WebContentsViewDelegate {
+    : public content::WebContentsViewDelegate,
+      public ContextMenuDelegate {
  public:
   explicit ChromeWebContentsViewDelegateMac(content::WebContents* web_contents);
-  virtual ~ChromeWebContentsViewDelegateMac();
+  ~ChromeWebContentsViewDelegateMac() override;
 
   // Overridden from WebContentsViewDelegate:
-  virtual NSObject<RenderWidgetHostViewMacDelegate>*
-      CreateRenderWidgetHostViewDelegate(
-          content::RenderWidgetHost* render_widget_host) OVERRIDE;
-  virtual content::WebDragDestDelegate* GetDragDestDelegate() OVERRIDE;
-  virtual void ShowContextMenu(
-      content::RenderFrameHost* render_frame_host,
-      const content::ContextMenuParams& params) OVERRIDE;
+  NSObject<RenderWidgetHostViewMacDelegate>* CreateRenderWidgetHostViewDelegate(
+      content::RenderWidgetHost* render_widget_host) override;
+  content::WebDragDestDelegate* GetDragDestDelegate() override;
+  void ShowContextMenu(content::RenderFrameHost* render_frame_host,
+                       const content::ContextMenuParams& params) override;
+
+  // Overridden from ContextMenuDelegate.
+  scoped_ptr<RenderViewContextMenuBase> BuildMenu(
+      content::WebContents* web_contents,
+      const content::ContextMenuParams& params) override;
+  void ShowMenu(scoped_ptr<RenderViewContextMenuBase> menu) override;
 
  private:
+  content::RenderWidgetHostView* GetActiveRenderWidgetHostView();
+
   // The context menu. Callbacks are asynchronous so we need to keep it around.
-  scoped_ptr<RenderViewContextMenuMac> context_menu_;
+  scoped_ptr<RenderViewContextMenuBase> context_menu_;
 
   // The chrome specific delegate that receives events from WebDragDestMac.
   scoped_ptr<WebDragBookmarkHandlerMac> bookmark_handler_;