| OLD | NEW |
| 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/utf_string_conversions.h" | 8 #include "base/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 27 matching lines...) Expand all Loading... |
| 38 RenderViewContextMenuViews* RenderViewContextMenuViews::Create( | 38 RenderViewContextMenuViews* RenderViewContextMenuViews::Create( |
| 39 content::WebContents* tab_contents, | 39 content::WebContents* tab_contents, |
| 40 const content::ContextMenuParams& params) { | 40 const content::ContextMenuParams& params) { |
| 41 return new RenderViewContextMenuViews(tab_contents, params); | 41 return new RenderViewContextMenuViews(tab_contents, params); |
| 42 } | 42 } |
| 43 #endif // OS_WIN | 43 #endif // OS_WIN |
| 44 | 44 |
| 45 void RenderViewContextMenuViews::RunMenuAt( | 45 void RenderViewContextMenuViews::RunMenuAt( |
| 46 views::Widget* parent, | 46 views::Widget* parent, |
| 47 const gfx::Point& point, | 47 const gfx::Point& point, |
| 48 const content::ContextMenuSourceType& type) { | 48 content::ContextMenuSourceType type) { |
| 49 views::MenuItemView::AnchorPosition anchor_position = | 49 views::MenuItemView::AnchorPosition anchor_position = |
| 50 type == content::CONTEXT_MENU_SOURCE_TOUCH ? | 50 type == content::CONTEXT_MENU_SOURCE_TOUCH ? |
| 51 views::MenuItemView::BOTTOMCENTER : views::MenuItemView::TOPLEFT; | 51 views::MenuItemView::BOTTOMCENTER : views::MenuItemView::TOPLEFT; |
| 52 if (menu_runner_->RunMenuAt(parent, NULL, gfx::Rect(point, gfx::Size()), | 52 if (menu_runner_->RunMenuAt(parent, NULL, gfx::Rect(point, gfx::Size()), |
| 53 anchor_position, views::MenuRunner::HAS_MNEMONICS | | 53 anchor_position, views::MenuRunner::HAS_MNEMONICS | |
| 54 views::MenuRunner::CONTEXT_MENU) == | 54 views::MenuRunner::CONTEXT_MENU) == |
| 55 views::MenuRunner::MENU_DELETED) | 55 views::MenuRunner::MENU_DELETED) |
| 56 return; | 56 return; |
| 57 } | 57 } |
| 58 | 58 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 item->SetEnabled(enabled); | 128 item->SetEnabled(enabled); |
| 129 item->SetTitle(title); | 129 item->SetTitle(title); |
| 130 item->SetVisible(!hidden); | 130 item->SetVisible(!hidden); |
| 131 | 131 |
| 132 views::MenuItemView* parent = item->GetParentMenuItem(); | 132 views::MenuItemView* parent = item->GetParentMenuItem(); |
| 133 if (!parent) | 133 if (!parent) |
| 134 return; | 134 return; |
| 135 | 135 |
| 136 parent->ChildrenChanged(); | 136 parent->ChildrenChanged(); |
| 137 } | 137 } |
| OLD | NEW |