| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| 11 #include "base/string16.h" |
| 11 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 12 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 12 | 13 |
| 13 namespace views { | 14 namespace views { |
| 14 class MenuItemView; | 15 class MenuItemView; |
| 15 class MenuModelAdapter; | 16 class MenuModelAdapter; |
| 16 class MenuRunner; | 17 class MenuRunner; |
| 17 } // namespace views | 18 } // namespace views |
| 18 | 19 |
| 19 class RenderViewContextMenuViews : public RenderViewContextMenu { | 20 class RenderViewContextMenuViews : public RenderViewContextMenu { |
| 20 public: | 21 public: |
| 21 RenderViewContextMenuViews(TabContents* tab_contents, | 22 RenderViewContextMenuViews(TabContents* tab_contents, |
| 22 const ContextMenuParams& params); | 23 const ContextMenuParams& params); |
| 23 | 24 |
| 24 virtual ~RenderViewContextMenuViews(); | 25 virtual ~RenderViewContextMenuViews(); |
| 25 | 26 |
| 26 void RunMenuAt(int x, int y); | 27 void RunMenuAt(int x, int y); |
| 27 | 28 |
| 28 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
| 29 // Set this menu to show for an external tab contents. This | 30 // Set this menu to show for an external tab contents. This |
| 30 // only has an effect before Init() is called. | 31 // only has an effect before Init() is called. |
| 31 void SetExternal(); | 32 void SetExternal(); |
| 32 #endif | 33 #endif |
| 33 | 34 |
| 34 void UpdateMenuItemStates(); | 35 void UpdateMenuItemStates(); |
| 35 | 36 |
| 37 // RenderViewContextMenuDelegate implementation. |
| 38 virtual void UpdateMenuItem(int command_id, |
| 39 bool enabled, |
| 40 const string16& title) OVERRIDE; |
| 41 |
| 36 protected: | 42 protected: |
| 37 // RenderViewContextMenu implementation -------------------------------------- | 43 // RenderViewContextMenu implementation. |
| 38 virtual void PlatformInit(); | 44 virtual void PlatformInit() OVERRIDE; |
| 39 virtual bool GetAcceleratorForCommandId(int command_id, | 45 virtual bool GetAcceleratorForCommandId( |
| 40 ui::Accelerator* accelerator); | 46 int command_id, |
| 47 ui::Accelerator* accelerator) OVERRIDE; |
| 48 |
| 41 private: | 49 private: |
| 42 // The context menu itself and its contents. | 50 // The context menu itself and its contents. |
| 43 scoped_ptr<views::MenuModelAdapter> menu_delegate_; | 51 scoped_ptr<views::MenuModelAdapter> menu_delegate_; |
| 44 views::MenuItemView* menu_; // Owned by menu_runner_. | 52 views::MenuItemView* menu_; // Owned by menu_runner_. |
| 45 scoped_ptr<views::MenuRunner> menu_runner_; | 53 scoped_ptr<views::MenuRunner> menu_runner_; |
| 46 | 54 |
| 47 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuViews); | 55 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuViews); |
| 48 }; | 56 }; |
| 49 | 57 |
| 50 #endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_VIEWS_H
_ | 58 #endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_VIEWS_H
_ |
| OLD | NEW |