Home | History | Annotate | Download | only in tab_contents
      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
      3 // found in the LICENSE file.
      4 
      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_
      7 #pragma once
      8 
      9 #include "base/memory/scoped_ptr.h"
     10 #include "base/memory/scoped_vector.h"
     11 #include "chrome/browser/tab_contents/render_view_context_menu.h"
     12 #include "views/controls/menu/menu_2.h"
     13 
     14 class RenderViewContextMenuViews : public RenderViewContextMenu {
     15  public:
     16   RenderViewContextMenuViews(TabContents* tab_contents,
     17                            const ContextMenuParams& params);
     18 
     19   virtual ~RenderViewContextMenuViews();
     20 
     21   void RunMenuAt(int x, int y);
     22 
     23   gfx::NativeMenu GetMenuHandle() const {
     24     return (menu_.get() ? menu_->GetNativeMenu() : NULL);
     25   }
     26 
     27 #if defined(OS_WIN)
     28   // Set this menu to show for an external tab contents. This
     29   // only has an effect before Init() is called.
     30   void SetExternal();
     31 #endif
     32 
     33   void UpdateMenuItemStates();
     34 
     35  protected:
     36   // RenderViewContextMenu implementation --------------------------------------
     37   virtual void PlatformInit();
     38   virtual bool GetAcceleratorForCommandId(int command_id,
     39                                           ui::Accelerator* accelerator);
     40  private:
     41   // The context menu itself and its contents.
     42   scoped_ptr<views::Menu2> menu_;
     43 
     44   DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuViews);
     45 };
     46 
     47 #endif  // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_VIEWS_H_
     48