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
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.
4
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_
7
8 #if defined(__OBJC__)
9
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"
14
15 class RenderViewContextMenuBase;
16 class WebDragBookmarkHandlerMac;
17
18 namespace content {
19 class RenderWidgetHostView;
20 class WebContents;
21 }
22
23 // A chrome/ specific class that extends WebContentsViewMac with features that
24 // live in chrome/.
25 class ChromeWebContentsViewDelegateMac
26     : public content::WebContentsViewDelegate,
27       public ContextMenuDelegate {
28  public:
29   explicit ChromeWebContentsViewDelegateMac(content::WebContents* web_contents);
30   ~ChromeWebContentsViewDelegateMac() override;
31
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;
38
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;
44
45  private:
46   content::RenderWidgetHostView* GetActiveRenderWidgetHostView();
47
48   // The context menu. Callbacks are asynchronous so we need to keep it around.
49   scoped_ptr<RenderViewContextMenuBase> context_menu_;
50
51   // The chrome specific delegate that receives events from WebDragDestMac.
52   scoped_ptr<WebDragBookmarkHandlerMac> bookmark_handler_;
53
54   // The WebContents that owns the view.
55   content::WebContents* web_contents_;
56
57   DISALLOW_COPY_AND_ASSIGN(ChromeWebContentsViewDelegateMac);
58 };
59
60 #endif  // __OBJC__
61
62 #endif  // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_MAC_H_