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

Side by Side Diff: chrome/browser/ui/cocoa/tab_contents/render_view_context_menu_mac.mm

Issue 63273002: Rename WebKit namespace to blink (part 4) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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/cocoa/tab_contents/render_view_context_menu_mac.h" 5 #include "chrome/browser/ui/cocoa/tab_contents/render_view_context_menu_mac.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #import "base/mac/scoped_sending_event.h" 8 #import "base/mac/scoped_sending_event.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 break; 122 break;
123 123
124 case IDC_WRITING_DIRECTION_DEFAULT: 124 case IDC_WRITING_DIRECTION_DEFAULT:
125 // WebKit's current behavior is for this menu item to always be disabled. 125 // WebKit's current behavior is for this menu item to always be disabled.
126 NOTREACHED(); 126 NOTREACHED();
127 break; 127 break;
128 128
129 case IDC_WRITING_DIRECTION_RTL: 129 case IDC_WRITING_DIRECTION_RTL:
130 case IDC_WRITING_DIRECTION_LTR: { 130 case IDC_WRITING_DIRECTION_LTR: {
131 content::RenderViewHost* view_host = GetRenderViewHost(); 131 content::RenderViewHost* view_host = GetRenderViewHost();
132 WebKit::WebTextDirection dir = WebKit::WebTextDirectionLeftToRight; 132 blink::WebTextDirection dir = blink::WebTextDirectionLeftToRight;
133 if (command_id == IDC_WRITING_DIRECTION_RTL) 133 if (command_id == IDC_WRITING_DIRECTION_RTL)
134 dir = WebKit::WebTextDirectionRightToLeft; 134 dir = blink::WebTextDirectionRightToLeft;
135 view_host->UpdateTextDirection(dir); 135 view_host->UpdateTextDirection(dir);
136 view_host->NotifyTextDirection(); 136 view_host->NotifyTextDirection();
137 break; 137 break;
138 } 138 }
139 139
140 default: 140 default:
141 RenderViewContextMenu::ExecuteCommand(command_id, event_flags); 141 RenderViewContextMenu::ExecuteCommand(command_id, event_flags);
142 break; 142 break;
143 } 143 }
144 } 144 }
145 145
146 bool RenderViewContextMenuMac::IsCommandIdChecked(int command_id) const { 146 bool RenderViewContextMenuMac::IsCommandIdChecked(int command_id) const {
147 switch (command_id) { 147 switch (command_id) {
148 case IDC_WRITING_DIRECTION_DEFAULT: 148 case IDC_WRITING_DIRECTION_DEFAULT:
149 return params_.writing_direction_default & 149 return params_.writing_direction_default &
150 WebKit::WebContextMenuData::CheckableMenuItemChecked; 150 blink::WebContextMenuData::CheckableMenuItemChecked;
151 case IDC_WRITING_DIRECTION_RTL: 151 case IDC_WRITING_DIRECTION_RTL:
152 return params_.writing_direction_right_to_left & 152 return params_.writing_direction_right_to_left &
153 WebKit::WebContextMenuData::CheckableMenuItemChecked; 153 blink::WebContextMenuData::CheckableMenuItemChecked;
154 case IDC_WRITING_DIRECTION_LTR: 154 case IDC_WRITING_DIRECTION_LTR:
155 return params_.writing_direction_left_to_right & 155 return params_.writing_direction_left_to_right &
156 WebKit::WebContextMenuData::CheckableMenuItemChecked; 156 blink::WebContextMenuData::CheckableMenuItemChecked;
157 157
158 default: 158 default:
159 return RenderViewContextMenu::IsCommandIdChecked(command_id); 159 return RenderViewContextMenu::IsCommandIdChecked(command_id);
160 } 160 }
161 } 161 }
162 162
163 bool RenderViewContextMenuMac::IsCommandIdEnabled(int command_id) const { 163 bool RenderViewContextMenuMac::IsCommandIdEnabled(int command_id) const {
164 switch (command_id) { 164 switch (command_id) {
165 case IDC_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY: 165 case IDC_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY:
166 // This is OK because the menu is not shown when it isn't 166 // This is OK because the menu is not shown when it isn't
167 // appropriate. 167 // appropriate.
168 return true; 168 return true;
169 169
170 case IDC_CONTENT_CONTEXT_SPEECH_START_SPEAKING: 170 case IDC_CONTENT_CONTEXT_SPEECH_START_SPEAKING:
171 // This is OK because the menu is not shown when it isn't 171 // This is OK because the menu is not shown when it isn't
172 // appropriate. 172 // appropriate.
173 return true; 173 return true;
174 174
175 case IDC_CONTENT_CONTEXT_SPEECH_STOP_SPEAKING: { 175 case IDC_CONTENT_CONTEXT_SPEECH_STOP_SPEAKING: {
176 content::RenderWidgetHostView* view = GetRenderViewHost()->GetView(); 176 content::RenderWidgetHostView* view = GetRenderViewHost()->GetView();
177 return view && view->IsSpeaking(); 177 return view && view->IsSpeaking();
178 } 178 }
179 179
180 case IDC_WRITING_DIRECTION_DEFAULT: // Provided to match OS defaults. 180 case IDC_WRITING_DIRECTION_DEFAULT: // Provided to match OS defaults.
181 return params_.writing_direction_default & 181 return params_.writing_direction_default &
182 WebKit::WebContextMenuData::CheckableMenuItemEnabled; 182 blink::WebContextMenuData::CheckableMenuItemEnabled;
183 case IDC_WRITING_DIRECTION_RTL: 183 case IDC_WRITING_DIRECTION_RTL:
184 return params_.writing_direction_right_to_left & 184 return params_.writing_direction_right_to_left &
185 WebKit::WebContextMenuData::CheckableMenuItemEnabled; 185 blink::WebContextMenuData::CheckableMenuItemEnabled;
186 case IDC_WRITING_DIRECTION_LTR: 186 case IDC_WRITING_DIRECTION_LTR:
187 return params_.writing_direction_left_to_right & 187 return params_.writing_direction_left_to_right &
188 WebKit::WebContextMenuData::CheckableMenuItemEnabled; 188 blink::WebContextMenuData::CheckableMenuItemEnabled;
189 189
190 default: 190 default:
191 return RenderViewContextMenu::IsCommandIdEnabled(command_id); 191 return RenderViewContextMenu::IsCommandIdEnabled(command_id);
192 } 192 }
193 } 193 }
194 194
195 bool RenderViewContextMenuMac::GetAcceleratorForCommandId( 195 bool RenderViewContextMenuMac::GetAcceleratorForCommandId(
196 int command_id, 196 int command_id,
197 ui::Accelerator* accelerator) { 197 ui::Accelerator* accelerator) {
198 return false; 198 return false;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 command_id); 270 command_id);
271 if (!item) 271 if (!item)
272 return; 272 return;
273 273
274 // Update the returned NSMenuItem directly so we can update it immediately. 274 // Update the returned NSMenuItem directly so we can update it immediately.
275 [item setEnabled:enabled]; 275 [item setEnabled:enabled];
276 [item setTitle:SysUTF16ToNSString(title)]; 276 [item setTitle:SysUTF16ToNSString(title)];
277 [item setHidden:hidden]; 277 [item setHidden:hidden];
278 [[item menu] itemChanged:item]; 278 [[item menu] itemChanged:item];
279 } 279 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_cocoa.mm ('k') | chrome/browser/ui/extensions/application_launch.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698