OLD | NEW |
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 return true; | 101 return true; |
102 | 102 |
103 case IDC_CONTENT_CONTEXT_SELECTALL: | 103 case IDC_CONTENT_CONTEXT_SELECTALL: |
104 *accel = views::Accelerator(ui::VKEY_A, false, true, false); | 104 *accel = views::Accelerator(ui::VKEY_A, false, true, false); |
105 return true; | 105 return true; |
106 | 106 |
107 default: | 107 default: |
108 return false; | 108 return false; |
109 } | 109 } |
110 } | 110 } |
| 111 |
| 112 void RenderViewContextMenuViews::UpdateMenuItem(int command_id, |
| 113 bool enabled, |
| 114 const string16& title) { |
| 115 views::MenuItemView* item = menu_->GetMenuItemByID(command_id); |
| 116 if (!item) |
| 117 return; |
| 118 |
| 119 item->SetEnabled(enabled); |
| 120 item->SetTitle(UTF16ToWide(title)); |
| 121 |
| 122 views::MenuItemView* parent = item->GetParentMenuItem(); |
| 123 if (!parent) |
| 124 return; |
| 125 |
| 126 parent->ChildrenChanged(); |
| 127 } |
OLD | NEW |