diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-13 05:15:46 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-13 05:15:46 +0000 |
commit | ead07da54b6cee91c242abb8a2ff183c82e413fd (patch) | |
tree | 3b3296b62407be7c1551d0fb4cecddbc2a0cc320 | |
parent | 3f399b46d6eb1ed573f9569058b40a8f8cd2a4d5 (diff) | |
download | chromium_src-ead07da54b6cee91c242abb8a2ff183c82e413fd.zip chromium_src-ead07da54b6cee91c242abb8a2ff183c82e413fd.tar.gz chromium_src-ead07da54b6cee91c242abb8a2ff183c82e413fd.tar.bz2 |
Restructure menu initialization for the TabContents. InitMenu cannot be called from the constructor because it seems to break RenderViewContextMenuExternalWin's virtual AppendItem from being called.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/126089
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18348 0039d316-1c4b-4281-b951-d872f2087c98
3 files changed, 6 insertions, 3 deletions
diff --git a/chrome/browser/tab_contents/render_view_context_menu_win.cc b/chrome/browser/tab_contents/render_view_context_menu_win.cc index 66a923c..99f3346 100644 --- a/chrome/browser/tab_contents/render_view_context_menu_win.cc +++ b/chrome/browser/tab_contents/render_view_context_menu_win.cc @@ -19,8 +19,6 @@ RenderViewContextMenuWin::RenderViewContextMenuWin( current_radio_group_id_(-1), sub_menu_contents_(NULL) { menu_contents_.reset(new views::SimpleMenuModel(this)); - InitMenu(params.node); - menu_.reset(new views::Menu2(menu_contents_.get())); } RenderViewContextMenuWin::~RenderViewContextMenuWin() { @@ -83,6 +81,10 @@ void RenderViewContextMenuWin::ExecuteCommand(int command_id) { //////////////////////////////////////////////////////////////////////////////// // RenderViewContextMenuWin, protected: +void RenderViewContextMenuWin::DoInit() { + menu_.reset(new views::Menu2(menu_contents_.get())); +} + void RenderViewContextMenuWin::AppendMenuItem(int id) { current_radio_group_id_ = -1; GetTargetModel()->AddItemWithStringId(id, id); diff --git a/chrome/browser/tab_contents/render_view_context_menu_win.h b/chrome/browser/tab_contents/render_view_context_menu_win.h index e188533..e8311bc 100644 --- a/chrome/browser/tab_contents/render_view_context_menu_win.h +++ b/chrome/browser/tab_contents/render_view_context_menu_win.h @@ -34,6 +34,7 @@ class RenderViewContextMenuWin : public RenderViewContextMenu, protected: // RenderViewContextMenu implementation -------------------------------------- + virtual void DoInit(); virtual void AppendMenuItem(int id); virtual void AppendMenuItem(int id, const std::wstring& label); virtual void AppendRadioMenuItem(int id, const std::wstring& label); @@ -58,7 +59,6 @@ class RenderViewContextMenuWin : public RenderViewContextMenu, views::SimpleMenuModel* sub_menu_contents_; // We own submenu models that we create, so we store them here. ScopedVector<views::SimpleMenuModel> submenu_models_; - HWND owner_; }; #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_WIN_H_ diff --git a/chrome/browser/tab_contents/tab_contents_view_win.cc b/chrome/browser/tab_contents/tab_contents_view_win.cc index 9452737..fcb05d9 100644 --- a/chrome/browser/tab_contents/tab_contents_view_win.cc +++ b/chrome/browser/tab_contents/tab_contents_view_win.cc @@ -398,6 +398,7 @@ void TabContentsViewWin::ShowContextMenu(const ContextMenuParams& params) { return; context_menu_.reset(new RenderViewContextMenuWin(tab_contents(), params)); + context_menu_->Init(); POINT screen_pt = { params.x, params.y }; MapWindowPoints(GetNativeView(), HWND_DESKTOP, &screen_pt, 1); |