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_VIEWS_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_VIEWS_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
11 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 11 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 12 #include "content/public/common/context_menu_source_type.h" |
12 | 13 |
13 namespace gfx { | 14 namespace gfx { |
14 class Point; | 15 class Point; |
15 } | 16 } |
16 | 17 |
17 namespace views { | 18 namespace views { |
18 class MenuItemView; | 19 class MenuItemView; |
19 class MenuModelAdapter; | 20 class MenuModelAdapter; |
20 class MenuRunner; | 21 class MenuRunner; |
21 class Widget; | 22 class Widget; |
22 } | 23 } |
23 | 24 |
24 class RenderViewContextMenuViews : public RenderViewContextMenu { | 25 class RenderViewContextMenuViews : public RenderViewContextMenu { |
25 public: | 26 public: |
26 virtual ~RenderViewContextMenuViews(); | 27 virtual ~RenderViewContextMenuViews(); |
27 | 28 |
28 // Factory function to create an instance. | 29 // Factory function to create an instance. |
29 static RenderViewContextMenuViews* Create( | 30 static RenderViewContextMenuViews* Create( |
30 content::WebContents* tab_contents, | 31 content::WebContents* tab_contents, |
31 const content::ContextMenuParams& params); | 32 const content::ContextMenuParams& params); |
32 | 33 |
33 void RunMenuAt(views::Widget* parent, const gfx::Point& point); | 34 void RunMenuAt(views::Widget* parent, |
| 35 const gfx::Point& point, |
| 36 const content::ContextMenuSourceType& type); |
34 | 37 |
35 void UpdateMenuItemStates(); | 38 void UpdateMenuItemStates(); |
36 | 39 |
37 // RenderViewContextMenuDelegate implementation. | 40 // RenderViewContextMenuDelegate implementation. |
38 virtual void UpdateMenuItem(int command_id, | 41 virtual void UpdateMenuItem(int command_id, |
39 bool enabled, | 42 bool enabled, |
40 bool hidden, | 43 bool hidden, |
41 const string16& title) OVERRIDE; | 44 const string16& title) OVERRIDE; |
42 | 45 |
43 protected: | 46 protected: |
44 RenderViewContextMenuViews(content::WebContents* tab_contents, | 47 RenderViewContextMenuViews(content::WebContents* tab_contents, |
45 const content::ContextMenuParams& params); | 48 const content::ContextMenuParams& params); |
46 // RenderViewContextMenu implementation. | 49 // RenderViewContextMenu implementation. |
47 virtual void PlatformInit() OVERRIDE; | 50 virtual void PlatformInit() OVERRIDE; |
48 virtual void PlatformCancel() OVERRIDE; | 51 virtual void PlatformCancel() OVERRIDE; |
49 virtual bool GetAcceleratorForCommandId( | 52 virtual bool GetAcceleratorForCommandId( |
50 int command_id, | 53 int command_id, |
51 ui::Accelerator* accelerator) OVERRIDE; | 54 ui::Accelerator* accelerator) OVERRIDE; |
52 | 55 |
53 private: | 56 private: |
54 // The context menu itself and its contents. | 57 // The context menu itself and its contents. |
55 scoped_ptr<views::MenuModelAdapter> menu_delegate_; | 58 scoped_ptr<views::MenuModelAdapter> menu_delegate_; |
56 views::MenuItemView* menu_; // Owned by menu_runner_. | 59 views::MenuItemView* menu_; // Owned by menu_runner_. |
57 scoped_ptr<views::MenuRunner> menu_runner_; | 60 scoped_ptr<views::MenuRunner> menu_runner_; |
58 | 61 |
59 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuViews); | 62 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuViews); |
60 }; | 63 }; |
61 | 64 |
62 #endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_VIEWS_H
_ | 65 #endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_VIEWS_H
_ |
OLD | NEW |