| 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(views::Widget* parent, | 45 void RenderViewContextMenuViews::RunMenuAt(views::Widget* parent, |
| 46 const gfx::Point& point) { | 46 const gfx::Point& point) { |
| 47 if (menu_runner_->RunMenuAt(parent, NULL, gfx::Rect(point, gfx::Size()), | 47 if (menu_runner_->RunMenuAt(parent, NULL, gfx::Rect(point, gfx::Size()), |
| 48 views::MenuItemView::TOPLEFT, views::MenuRunner::HAS_MNEMONICS) == | 48 views::MenuItemView::TOPLEFT, views::MenuRunner::HAS_MNEMONICS | |
| 49 views::MenuRunner::CONTEXT_MENU) == |
| 49 views::MenuRunner::MENU_DELETED) | 50 views::MenuRunner::MENU_DELETED) |
| 50 return; | 51 return; |
| 51 } | 52 } |
| 52 | 53 |
| 53 void RenderViewContextMenuViews::UpdateMenuItemStates() { | 54 void RenderViewContextMenuViews::UpdateMenuItemStates() { |
| 54 menu_delegate_->BuildMenu(menu_); | 55 menu_delegate_->BuildMenu(menu_); |
| 55 } | 56 } |
| 56 | 57 |
| 57 //////////////////////////////////////////////////////////////////////////////// | 58 //////////////////////////////////////////////////////////////////////////////// |
| 58 // RenderViewContextMenuViews, protected: | 59 // RenderViewContextMenuViews, protected: |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 item->SetEnabled(enabled); | 123 item->SetEnabled(enabled); |
| 123 item->SetTitle(title); | 124 item->SetTitle(title); |
| 124 item->SetVisible(!hidden); | 125 item->SetVisible(!hidden); |
| 125 | 126 |
| 126 views::MenuItemView* parent = item->GetParentMenuItem(); | 127 views::MenuItemView* parent = item->GetParentMenuItem(); |
| 127 if (!parent) | 128 if (!parent) |
| 128 return; | 129 return; |
| 129 | 130 |
| 130 parent->ChildrenChanged(); | 131 parent->ChildrenChanged(); |
| 131 } | 132 } |
| OLD | NEW |