OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_M
AC_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_M
AC_H_ |
6 #define CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_M
AC_H_ | 6 #define CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_M
AC_H_ |
7 | 7 |
8 #if defined(__OBJC__) | 8 #if defined(__OBJC__) |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "components/renderer_context_menu/context_menu_delegate.h" | 13 #include "components/renderer_context_menu/context_menu_delegate.h" |
13 #include "content/public/browser/web_contents_view_delegate.h" | 14 #include "content/public/browser/web_contents_view_delegate.h" |
14 | 15 |
15 class RenderViewContextMenuBase; | 16 class RenderViewContextMenuBase; |
16 class WebDragBookmarkHandlerMac; | 17 class WebDragBookmarkHandlerMac; |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 class RenderWidgetHostView; | 20 class RenderWidgetHostView; |
20 class WebContents; | 21 class WebContents; |
21 } | 22 } |
22 | 23 |
23 // A chrome/ specific class that extends WebContentsViewMac with features that | 24 // A chrome/ specific class that extends WebContentsViewMac with features that |
24 // live in chrome/. | 25 // live in chrome/. |
25 class ChromeWebContentsViewDelegateMac | 26 class ChromeWebContentsViewDelegateMac |
26 : public content::WebContentsViewDelegate, | 27 : public content::WebContentsViewDelegate, |
27 public ContextMenuDelegate { | 28 public ContextMenuDelegate { |
28 public: | 29 public: |
29 explicit ChromeWebContentsViewDelegateMac(content::WebContents* web_contents); | 30 explicit ChromeWebContentsViewDelegateMac(content::WebContents* web_contents); |
30 ~ChromeWebContentsViewDelegateMac() override; | 31 ~ChromeWebContentsViewDelegateMac() override; |
31 | 32 |
32 // Overridden from WebContentsViewDelegate: | 33 // Overridden from WebContentsViewDelegate: |
33 gfx::NativeWindow GetNativeWindow() override; | 34 gfx::NativeWindow GetNativeWindow() override; |
34 NSObject<RenderWidgetHostViewMacDelegate>* CreateRenderWidgetHostViewDelegate( | 35 NSObject<RenderWidgetHostViewMacDelegate>* CreateRenderWidgetHostViewDelegate( |
35 content::RenderWidgetHost* render_widget_host) override; | 36 content::RenderWidgetHost* render_widget_host) override; |
36 content::WebDragDestDelegate* GetDragDestDelegate() override; | 37 content::WebDragDestDelegate* GetDragDestDelegate() override; |
37 void ShowContextMenu(content::RenderFrameHost* render_frame_host, | 38 void ShowContextMenu(content::RenderFrameHost* render_frame_host, |
38 const content::ContextMenuParams& params) override; | 39 const content::ContextMenuParams& params) override; |
39 | 40 |
40 // Overridden from ContextMenuDelegate. | 41 // Overridden from ContextMenuDelegate. |
41 scoped_ptr<RenderViewContextMenuBase> BuildMenu( | 42 std::unique_ptr<RenderViewContextMenuBase> BuildMenu( |
42 content::WebContents* web_contents, | 43 content::WebContents* web_contents, |
43 const content::ContextMenuParams& params) override; | 44 const content::ContextMenuParams& params) override; |
44 void ShowMenu(scoped_ptr<RenderViewContextMenuBase> menu) override; | 45 void ShowMenu(std::unique_ptr<RenderViewContextMenuBase> menu) override; |
45 | 46 |
46 private: | 47 private: |
47 content::RenderWidgetHostView* GetActiveRenderWidgetHostView(); | 48 content::RenderWidgetHostView* GetActiveRenderWidgetHostView(); |
48 | 49 |
49 // The context menu. Callbacks are asynchronous so we need to keep it around. | 50 // The context menu. Callbacks are asynchronous so we need to keep it around. |
50 scoped_ptr<RenderViewContextMenuBase> context_menu_; | 51 std::unique_ptr<RenderViewContextMenuBase> context_menu_; |
51 | 52 |
52 // The chrome specific delegate that receives events from WebDragDestMac. | 53 // The chrome specific delegate that receives events from WebDragDestMac. |
53 scoped_ptr<WebDragBookmarkHandlerMac> bookmark_handler_; | 54 std::unique_ptr<WebDragBookmarkHandlerMac> bookmark_handler_; |
54 | 55 |
55 // The WebContents that owns the view. | 56 // The WebContents that owns the view. |
56 content::WebContents* web_contents_; | 57 content::WebContents* web_contents_; |
57 | 58 |
58 DISALLOW_COPY_AND_ASSIGN(ChromeWebContentsViewDelegateMac); | 59 DISALLOW_COPY_AND_ASSIGN(ChromeWebContentsViewDelegateMac); |
59 }; | 60 }; |
60 | 61 |
61 #endif // __OBJC__ | 62 #endif // __OBJC__ |
62 | 63 |
63 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGAT
E_MAC_H_ | 64 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGAT
E_MAC_H_ |
OLD | NEW |