Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: chrome/browser/ui/views/tab_contents/render_view_context_menu_views.cc

Issue 7720012: Moves ownership of MenuItemView to MenuRunner as well as responbility (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit test Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/ui/views/tab_contents/render_view_context_menu_views.h" 5 #include "chrome/browser/ui/views/tab_contents/render_view_context_menu_views.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "content/browser/renderer_host/render_widget_host_view.h" 9 #include "content/browser/renderer_host/render_widget_host_view.h"
10 #include "content/browser/tab_contents/tab_contents.h" 10 #include "content/browser/tab_contents/tab_contents.h"
(...skipping 30 matching lines...) Expand all
41 // TODO(oshima): Eliminate this once TabContentsViewTouch is replaced 41 // TODO(oshima): Eliminate this once TabContentsViewTouch is replaced
42 // with TabContentsViewViews. 42 // with TabContentsViewViews.
43 TabContentsViewTouch* touch = 43 TabContentsViewTouch* touch =
44 static_cast<TabContentsViewTouch*>(source_tab_contents_->view()); 44 static_cast<TabContentsViewTouch*>(source_tab_contents_->view());
45 views::Widget* parent = touch->GetWidget()->GetTopLevelWidget(); 45 views::Widget* parent = touch->GetWidget()->GetTopLevelWidget();
46 #else 46 #else
47 TabContentsViewViews* tab = 47 TabContentsViewViews* tab =
48 static_cast<TabContentsViewViews*>(source_tab_contents_->view()); 48 static_cast<TabContentsViewViews*>(source_tab_contents_->view());
49 views::Widget* parent = tab->GetTopLevelWidget(); 49 views::Widget* parent = tab->GetTopLevelWidget();
50 #endif 50 #endif
51 menu_runner_->RunMenuAt(parent, NULL, 51 if (menu_runner_->RunMenuAt(parent, NULL,
52 gfx::Rect(gfx::Point(x, y), gfx::Size()), 52 gfx::Rect(gfx::Point(x, y), gfx::Size()),
53 views::MenuItemView::TOPLEFT, true); 53 views::MenuItemView::TOPLEFT, views::MenuRunner::HAS_MNEMONICS) ==
54 views::MenuRunner::MENU_DELETED)
55 return;
54 } 56 }
55 57
56 #if defined(OS_WIN) 58 #if defined(OS_WIN)
57 void RenderViewContextMenuViews::SetExternal() { 59 void RenderViewContextMenuViews::SetExternal() {
58 external_ = true; 60 external_ = true;
59 } 61 }
60 #endif 62 #endif
61 63
62 void RenderViewContextMenuViews::UpdateMenuItemStates() { 64 void RenderViewContextMenuViews::UpdateMenuItemStates() {
63 menu_delegate_->BuildMenu(menu_); 65 menu_delegate_->BuildMenu(menu_);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 return true; 103 return true;
102 104
103 case IDC_CONTENT_CONTEXT_SELECTALL: 105 case IDC_CONTENT_CONTEXT_SELECTALL:
104 *accel = views::Accelerator(ui::VKEY_A, false, true, false); 106 *accel = views::Accelerator(ui::VKEY_A, false, true, false);
105 return true; 107 return true;
106 108
107 default: 109 default:
108 return false; 110 return false;
109 } 111 }
110 } 112 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698