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

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

Issue 17432002: Replace content::ContextMenuSourceType with ui::MenuSourceType. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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_widget_host_view.h" 10 #include "content/public/browser/render_widget_host_view.h"
(...skipping 22 matching lines...) Expand all
33 33
34 #if !defined(OS_WIN) 34 #if !defined(OS_WIN)
35 // static 35 // static
36 RenderViewContextMenuViews* RenderViewContextMenuViews::Create( 36 RenderViewContextMenuViews* RenderViewContextMenuViews::Create(
37 content::WebContents* web_contents, 37 content::WebContents* web_contents,
38 const content::ContextMenuParams& params) { 38 const content::ContextMenuParams& params) {
39 return new RenderViewContextMenuViews(web_contents, params); 39 return new RenderViewContextMenuViews(web_contents, params);
40 } 40 }
41 #endif // OS_WIN 41 #endif // OS_WIN
42 42
43 void RenderViewContextMenuViews::RunMenuAt( 43 void RenderViewContextMenuViews::RunMenuAt(views::Widget* parent,
44 views::Widget* parent, 44 const gfx::Point& point,
45 const gfx::Point& point, 45 ui::MenuSourceType type) {
46 content::ContextMenuSourceType type) {
47 views::MenuItemView::AnchorPosition anchor_position = 46 views::MenuItemView::AnchorPosition anchor_position =
48 (type == content::CONTEXT_MENU_SOURCE_TOUCH || 47 (type == ui::MENU_SOURCE_TOUCH ||
49 type == content::CONTEXT_MENU_SOURCE_TOUCH_EDIT_MENU) ? 48 type == ui::MENU_SOURCE_TOUCH_EDIT_MENU) ?
50 views::MenuItemView::BOTTOMCENTER : views::MenuItemView::TOPLEFT; 49 views::MenuItemView::BOTTOMCENTER : views::MenuItemView::TOPLEFT;
51 50
52 // TODO(varunjain): remove this by consolidating ui::MenuSourceType and
53 // content::ContextMenuSourceType.
54 ui::MenuSourceType source_type = ui::MENU_SOURCE_NONE;
55 switch (type) {
56 case content::CONTEXT_MENU_SOURCE_MOUSE:
57 source_type = ui::MENU_SOURCE_MOUSE;
58 break;
59 case content::CONTEXT_MENU_SOURCE_KEYBOARD:
60 source_type = ui::MENU_SOURCE_KEYBOARD;
61 break;
62 case content::CONTEXT_MENU_SOURCE_TOUCH:
63 source_type = ui::MENU_SOURCE_TOUCH;
64 break;
65 default:
66 break;
67 }
68 if (menu_runner_->RunMenuAt(parent, NULL, gfx::Rect(point, gfx::Size()), 51 if (menu_runner_->RunMenuAt(parent, NULL, gfx::Rect(point, gfx::Size()),
69 anchor_position, source_type, views::MenuRunner::HAS_MNEMONICS | 52 anchor_position, type, views::MenuRunner::HAS_MNEMONICS |
70 views::MenuRunner::CONTEXT_MENU) == 53 views::MenuRunner::CONTEXT_MENU) ==
71 views::MenuRunner::MENU_DELETED) 54 views::MenuRunner::MENU_DELETED)
72 return; 55 return;
73 } 56 }
74 57
75 //////////////////////////////////////////////////////////////////////////////// 58 ////////////////////////////////////////////////////////////////////////////////
76 // RenderViewContextMenuViews, protected: 59 // RenderViewContextMenuViews, protected:
77 60
78 void RenderViewContextMenuViews::PlatformInit() { 61 void RenderViewContextMenuViews::PlatformInit() {
79 menu_runner_.reset(new views::MenuRunner(&menu_model_)); 62 menu_runner_.reset(new views::MenuRunner(&menu_model_));
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 item->SetEnabled(enabled); 121 item->SetEnabled(enabled);
139 item->SetTitle(title); 122 item->SetTitle(title);
140 item->SetVisible(!hidden); 123 item->SetVisible(!hidden);
141 124
142 views::MenuItemView* parent = item->GetParentMenuItem(); 125 views::MenuItemView* parent = item->GetParentMenuItem();
143 if (!parent) 126 if (!parent)
144 return; 127 return;
145 128
146 parent->ChildrenChanged(); 129 parent->ChildrenChanged();
147 } 130 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698