1 // Copyright (c) 2012 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.
5 #ifndef CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_MAC_H_
6 #define CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_MAC_H_
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "components/renderer_context_menu/context_menu_delegate.h"
13 #include "content/public/browser/web_contents_view_delegate.h"
15 class RenderViewContextMenuBase;
16 class WebDragBookmarkHandlerMac;
19 class RenderWidgetHostView;
23 // A chrome/ specific class that extends WebContentsViewMac with features that
25 class ChromeWebContentsViewDelegateMac
26 : public content::WebContentsViewDelegate,
27 public ContextMenuDelegate {
29 explicit ChromeWebContentsViewDelegateMac(content::WebContents* web_contents);
30 ~ChromeWebContentsViewDelegateMac() override;
32 // Overridden from WebContentsViewDelegate:
33 NSObject<RenderWidgetHostViewMacDelegate>* CreateRenderWidgetHostViewDelegate(
34 content::RenderWidgetHost* render_widget_host) override;
35 content::WebDragDestDelegate* GetDragDestDelegate() override;
36 void ShowContextMenu(content::RenderFrameHost* render_frame_host,
37 const content::ContextMenuParams& params) override;
39 // Overridden from ContextMenuDelegate.
40 scoped_ptr<RenderViewContextMenuBase> BuildMenu(
41 content::WebContents* web_contents,
42 const content::ContextMenuParams& params) override;
43 void ShowMenu(scoped_ptr<RenderViewContextMenuBase> menu) override;
46 content::RenderWidgetHostView* GetActiveRenderWidgetHostView();
48 // The context menu. Callbacks are asynchronous so we need to keep it around.
49 scoped_ptr<RenderViewContextMenuBase> context_menu_;
51 // The chrome specific delegate that receives events from WebDragDestMac.
52 scoped_ptr<WebDragBookmarkHandlerMac> bookmark_handler_;
54 // The WebContents that owns the view.
55 content::WebContents* web_contents_;
57 DISALLOW_COPY_AND_ASSIGN(ChromeWebContentsViewDelegateMac);
62 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_MAC_H_