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

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

Issue 130773004: Start moving context menu code to RenderFrame. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 years, 10 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) 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 #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 "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "content/public/browser/render_view_host.h" 10 #include "content/public/browser/render_view_host.h"
11 #include "content/public/browser/render_widget_host_view.h" 11 #include "content/public/browser/render_widget_host_view.h"
12 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
13 #include "content/public/browser/web_contents_view.h" 13 #include "content/public/browser/web_contents_view.h"
14 #include "grit/generated_resources.h" 14 #include "grit/generated_resources.h"
15 #include "ui/base/accelerators/accelerator.h" 15 #include "ui/base/accelerators/accelerator.h"
16 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
17 #include "ui/events/keycodes/keyboard_codes.h" 17 #include "ui/events/keycodes/keyboard_codes.h"
18 #include "ui/gfx/point.h" 18 #include "ui/gfx/point.h"
19 #include "ui/views/controls/menu/menu_item_view.h" 19 #include "ui/views/controls/menu/menu_item_view.h"
20 #include "ui/views/controls/menu/menu_runner.h" 20 #include "ui/views/controls/menu/menu_runner.h"
21 21
22 22
23 using content::WebContents; 23 using content::WebContents;
24 24
25 //////////////////////////////////////////////////////////////////////////////// 25 ////////////////////////////////////////////////////////////////////////////////
26 // RenderViewContextMenuViews, public: 26 // RenderViewContextMenuViews, public:
27 27
28 RenderViewContextMenuViews::RenderViewContextMenuViews( 28 RenderViewContextMenuViews::RenderViewContextMenuViews(
29 WebContents* web_contents, 29 content::RenderFrameHost* render_frame_host,
30 const content::ContextMenuParams& params) 30 const content::ContextMenuParams& params)
31 : RenderViewContextMenu(web_contents, params), 31 : RenderViewContextMenu(render_frame_host, params),
32 bidi_submenu_model_(this) { 32 bidi_submenu_model_(this) {
33 } 33 }
34 34
35 RenderViewContextMenuViews::~RenderViewContextMenuViews() { 35 RenderViewContextMenuViews::~RenderViewContextMenuViews() {
36 } 36 }
37 37
38 #if !defined(OS_WIN) 38 #if !defined(OS_WIN)
39 // static 39 // static
40 RenderViewContextMenuViews* RenderViewContextMenuViews::Create( 40 RenderViewContextMenuViews* RenderViewContextMenuViews::Create(
41 content::WebContents* web_contents, 41 content::RenderFrameHost* render_frame_host,
42 const content::ContextMenuParams& params) { 42 const content::ContextMenuParams& params) {
43 return new RenderViewContextMenuViews(web_contents, params); 43 return new RenderViewContextMenuViews(render_frame_host, params);
44 } 44 }
45 #endif // OS_WIN 45 #endif // OS_WIN
46 46
47 void RenderViewContextMenuViews::RunMenuAt(views::Widget* parent, 47 void RenderViewContextMenuViews::RunMenuAt(views::Widget* parent,
48 const gfx::Point& point, 48 const gfx::Point& point,
49 ui::MenuSourceType type) { 49 ui::MenuSourceType type) {
50 views::MenuItemView::AnchorPosition anchor_position = 50 views::MenuItemView::AnchorPosition anchor_position =
51 (type == ui::MENU_SOURCE_TOUCH || 51 (type == ui::MENU_SOURCE_TOUCH ||
52 type == ui::MENU_SOURCE_TOUCH_EDIT_MENU) ? 52 type == ui::MENU_SOURCE_TOUCH_EDIT_MENU) ?
53 views::MenuItemView::BOTTOMCENTER : views::MenuItemView::TOPLEFT; 53 views::MenuItemView::BOTTOMCENTER : views::MenuItemView::TOPLEFT;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 item->SetEnabled(enabled); 202 item->SetEnabled(enabled);
203 item->SetTitle(title); 203 item->SetTitle(title);
204 item->SetVisible(!hidden); 204 item->SetVisible(!hidden);
205 205
206 views::MenuItemView* parent = item->GetParentMenuItem(); 206 views::MenuItemView* parent = item->GetParentMenuItem();
207 if (!parent) 207 if (!parent)
208 return; 208 return;
209 209
210 parent->ChildrenChanged(); 210 parent->ChildrenChanged();
211 } 211 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698