OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_ | 5 #ifndef CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_ |
6 #define CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_ | 6 #define CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "build/build_config.h" | 11 #include "build/build_config.h" |
10 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
11 #include "content/public/browser/web_contents_view_delegate.h" | 13 #include "content/public/browser/web_contents_view_delegate.h" |
12 #include "content/public/common/context_menu_params.h" | 14 #include "content/public/common/context_menu_params.h" |
13 | 15 |
| 16 namespace ui { |
| 17 class SimpleMenuModel; |
| 18 } |
| 19 |
| 20 namespace views { |
| 21 class MenuRunner; |
| 22 } |
| 23 |
14 namespace content { | 24 namespace content { |
15 | 25 |
16 class ShellWebContentsViewDelegate : public WebContentsViewDelegate { | 26 class ShellWebContentsViewDelegate : public WebContentsViewDelegate { |
17 public: | 27 public: |
18 explicit ShellWebContentsViewDelegate(WebContents* web_contents); | 28 explicit ShellWebContentsViewDelegate(WebContents* web_contents); |
19 ~ShellWebContentsViewDelegate() override; | 29 ~ShellWebContentsViewDelegate() override; |
20 | 30 |
21 // Overridden from WebContentsViewDelegate: | 31 // Overridden from WebContentsViewDelegate: |
22 void ShowContextMenu(RenderFrameHost* render_frame_host, | 32 void ShowContextMenu(RenderFrameHost* render_frame_host, |
23 const ContextMenuParams& params) override; | 33 const ContextMenuParams& params) override; |
24 | 34 |
25 #if defined(OS_MACOSX) | 35 #if defined(OS_MACOSX) |
26 void ActionPerformed(int id); | 36 void ActionPerformed(int id); |
27 #elif defined(OS_WIN) | |
28 void MenuItemSelected(int selection); | |
29 #endif | 37 #endif |
30 | 38 |
31 private: | 39 private: |
32 WebContents* web_contents_; | 40 WebContents* web_contents_; |
| 41 #if defined(OS_MACOSX) |
33 ContextMenuParams params_; | 42 ContextMenuParams params_; |
| 43 #endif |
| 44 |
| 45 #if defined(TOOLKIT_VIEWS) |
| 46 std::unique_ptr<ui::SimpleMenuModel> context_menu_model_; |
| 47 std::unique_ptr<views::MenuRunner> context_menu_runner_; |
| 48 #endif |
34 | 49 |
35 DISALLOW_COPY_AND_ASSIGN(ShellWebContentsViewDelegate); | 50 DISALLOW_COPY_AND_ASSIGN(ShellWebContentsViewDelegate); |
36 }; | 51 }; |
37 | 52 |
38 } // namespace content | 53 } // namespace content |
39 | 54 |
40 #endif // CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_ | 55 #endif // CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_ |
OLD | NEW |