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

Side by Side Diff: chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.cc

Issue 2034623002: Unify ui::TextEditCommand and ui::TextEditCommandAuraLinux::CommandId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor7_correct_text_edit_command_aura_typo
Patch Set: Rebase. Created 4 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
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/libgtk2ui/gtk2_key_bindings_handler.h" 5 #include "chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <X11/XKBlib.h> 10 #include <X11/XKBlib.h>
11 11
12 #include <string> 12 #include <string>
13 13
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h" 17 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h"
18 #include "content/public/browser/native_web_keyboard_event.h" 18 #include "content/public/browser/native_web_keyboard_event.h"
19 #include "ui/base/ime/text_edit_commands.h"
19 #include "ui/base/x/x11_util.h" 20 #include "ui/base/x/x11_util.h"
20 #include "ui/events/event.h" 21 #include "ui/events/event.h"
21 22
22 using ui::TextEditCommandAuraLinux; 23 using ui::TextEditCommand;
23 24
24 // TODO(erg): Rewrite the old gtk_key_bindings_handler_unittest.cc and get them 25 // TODO(erg): Rewrite the old gtk_key_bindings_handler_unittest.cc and get them
25 // in a state that links. This code was adapted from the content layer GTK 26 // in a state that links. This code was adapted from the content layer GTK
26 // code, which had some simple unit tests. However, the changes in the public 27 // code, which had some simple unit tests. However, the changes in the public
27 // interface basically meant the tests need to be rewritten; this imposes weird 28 // interface basically meant the tests need to be rewritten; this imposes weird
28 // linking requirements regarding GTK+ as we don't have a libgtk2ui_unittests 29 // linking requirements regarding GTK+ as we don't have a libgtk2ui_unittests
29 // yet. http://crbug.com/358297. 30 // yet. http://crbug.com/358297.
30 31
31 namespace libgtk2ui { 32 namespace libgtk2ui {
32 33
(...skipping 10 matching lines...) Expand all
43 &major, &minor); 44 &major, &minor);
44 } 45 }
45 46
46 Gtk2KeyBindingsHandler::~Gtk2KeyBindingsHandler() { 47 Gtk2KeyBindingsHandler::~Gtk2KeyBindingsHandler() {
47 gtk_widget_destroy(handler_); 48 gtk_widget_destroy(handler_);
48 gtk_widget_destroy(fake_window_); 49 gtk_widget_destroy(fake_window_);
49 } 50 }
50 51
51 bool Gtk2KeyBindingsHandler::MatchEvent( 52 bool Gtk2KeyBindingsHandler::MatchEvent(
52 const ui::Event& event, 53 const ui::Event& event,
53 std::vector<TextEditCommandAuraLinux>* edit_commands) { 54 std::vector<ui::TextEditCommandAuraLinux>* edit_commands) {
54 CHECK(event.IsKeyEvent()); 55 CHECK(event.IsKeyEvent());
55 56
56 const ui::KeyEvent& key_event = static_cast<const ui::KeyEvent&>(event); 57 const ui::KeyEvent& key_event = static_cast<const ui::KeyEvent&>(event);
57 if (key_event.is_char() || !key_event.native_event()) 58 if (key_event.is_char() || !key_event.native_event())
58 return false; 59 return false;
59 60
60 GdkEventKey gdk_event; 61 GdkEventKey gdk_event;
61 BuildGdkEventKeyFromXEvent(key_event.native_event(), &gdk_event); 62 BuildGdkEventKeyFromXEvent(key_event.native_event(), &gdk_event);
62 63
63 edit_commands_.clear(); 64 edit_commands_.clear();
(...skipping 25 matching lines...) Expand all
89 gtk_widget_set_size_request(GTK_WIDGET(handler), 0, 0); 90 gtk_widget_set_size_request(GTK_WIDGET(handler), 0, 0);
90 91
91 // Prevents it from handling any events by itself. 92 // Prevents it from handling any events by itself.
92 gtk_widget_set_sensitive(GTK_WIDGET(handler), FALSE); 93 gtk_widget_set_sensitive(GTK_WIDGET(handler), FALSE);
93 gtk_widget_set_events(GTK_WIDGET(handler), 0); 94 gtk_widget_set_events(GTK_WIDGET(handler), 0);
94 gtk_widget_set_can_focus(GTK_WIDGET(handler), TRUE); 95 gtk_widget_set_can_focus(GTK_WIDGET(handler), TRUE);
95 96
96 return GTK_WIDGET(handler); 97 return GTK_WIDGET(handler);
97 } 98 }
98 99
99 void Gtk2KeyBindingsHandler::EditCommandMatched( 100 void Gtk2KeyBindingsHandler::EditCommandMatched(TextEditCommand command,
100 TextEditCommandAuraLinux::CommandId id, 101 const std::string& value) {
101 const std::string& value, 102 edit_commands_.push_back(ui::TextEditCommandAuraLinux(command, value));
102 bool extend_selection) {
103 edit_commands_.push_back(TextEditCommandAuraLinux(id,
104 value,
105 extend_selection));
106 } 103 }
107 104
108 void Gtk2KeyBindingsHandler::BuildGdkEventKeyFromXEvent( 105 void Gtk2KeyBindingsHandler::BuildGdkEventKeyFromXEvent(
109 const base::NativeEvent& xevent, 106 const base::NativeEvent& xevent,
110 GdkEventKey* gdk_event) { 107 GdkEventKey* gdk_event) {
111 GdkKeymap *keymap = gdk_keymap_get_for_display(gdk_display_get_default()); 108 GdkKeymap *keymap = gdk_keymap_get_for_display(gdk_display_get_default());
112 GdkModifierType consumed, state; 109 GdkModifierType consumed, state;
113 110
114 gdk_event->type = xevent->xany.type == KeyPress ? 111 gdk_event->type = xevent->xany.type == KeyPress ?
115 GDK_KEY_PRESS : GDK_KEY_RELEASE; 112 GDK_KEY_PRESS : GDK_KEY_RELEASE;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 202
206 Gtk2KeyBindingsHandler* Gtk2KeyBindingsHandler::GetHandlerOwner( 203 Gtk2KeyBindingsHandler* Gtk2KeyBindingsHandler::GetHandlerOwner(
207 GtkTextView* text_view) { 204 GtkTextView* text_view) {
208 Handler* handler = G_TYPE_CHECK_INSTANCE_CAST( 205 Handler* handler = G_TYPE_CHECK_INSTANCE_CAST(
209 text_view, HandlerGetType(), Handler); 206 text_view, HandlerGetType(), Handler);
210 DCHECK(handler); 207 DCHECK(handler);
211 return handler->owner; 208 return handler->owner;
212 } 209 }
213 210
214 void Gtk2KeyBindingsHandler::BackSpace(GtkTextView* text_view) { 211 void Gtk2KeyBindingsHandler::BackSpace(GtkTextView* text_view) {
215 GetHandlerOwner(text_view) 212 GetHandlerOwner(text_view)->EditCommandMatched(
216 ->EditCommandMatched( 213 TextEditCommand::DELETE_BACKWARD, std::string());
217 TextEditCommandAuraLinux::DELETE_BACKWARD, std::string(), false);
218 } 214 }
219 215
220 void Gtk2KeyBindingsHandler::CopyClipboard(GtkTextView* text_view) { 216 void Gtk2KeyBindingsHandler::CopyClipboard(GtkTextView* text_view) {
221 GetHandlerOwner(text_view)->EditCommandMatched( 217 GetHandlerOwner(text_view)->EditCommandMatched(TextEditCommand::COPY,
222 TextEditCommandAuraLinux::COPY, std::string(), false); 218 std::string());
223 } 219 }
224 220
225 void Gtk2KeyBindingsHandler::CutClipboard(GtkTextView* text_view) { 221 void Gtk2KeyBindingsHandler::CutClipboard(GtkTextView* text_view) {
226 GetHandlerOwner(text_view)->EditCommandMatched( 222 GetHandlerOwner(text_view)->EditCommandMatched(TextEditCommand::CUT,
227 TextEditCommandAuraLinux::CUT, std::string(), false); 223 std::string());
228 } 224 }
229 225
230 void Gtk2KeyBindingsHandler::DeleteFromCursor( 226 void Gtk2KeyBindingsHandler::DeleteFromCursor(
231 GtkTextView* text_view, GtkDeleteType type, gint count) { 227 GtkTextView* text_view, GtkDeleteType type, gint count) {
232 if (!count) 228 if (!count)
233 return; 229 return;
234 230
235 TextEditCommandAuraLinux::CommandId commands[2] = { 231 TextEditCommand commands[2] = {
236 TextEditCommandAuraLinux::INVALID_COMMAND, 232 TextEditCommand::INVALID_COMMAND, TextEditCommand::INVALID_COMMAND,
237 TextEditCommandAuraLinux::INVALID_COMMAND,
238 }; 233 };
239 switch (type) { 234 switch (type) {
240 case GTK_DELETE_CHARS: 235 case GTK_DELETE_CHARS:
241 commands[0] = (count > 0 ? 236 commands[0] = (count > 0 ? TextEditCommand::DELETE_FORWARD
242 TextEditCommandAuraLinux::DELETE_FORWARD : 237 : TextEditCommand::DELETE_BACKWARD);
243 TextEditCommandAuraLinux::DELETE_BACKWARD);
244 break; 238 break;
245 case GTK_DELETE_WORD_ENDS: 239 case GTK_DELETE_WORD_ENDS:
246 commands[0] = (count > 0 ? 240 commands[0] = (count > 0 ? TextEditCommand::DELETE_WORD_FORWARD
247 TextEditCommandAuraLinux::DELETE_WORD_FORWARD : 241 : TextEditCommand::DELETE_WORD_BACKWARD);
248 TextEditCommandAuraLinux::DELETE_WORD_BACKWARD);
249 break; 242 break;
250 case GTK_DELETE_WORDS: 243 case GTK_DELETE_WORDS:
251 if (count > 0) { 244 if (count > 0) {
252 commands[0] = TextEditCommandAuraLinux::MOVE_WORD_FORWARD; 245 commands[0] = TextEditCommand::MOVE_WORD_FORWARD;
253 commands[1] = TextEditCommandAuraLinux::DELETE_WORD_BACKWARD; 246 commands[1] = TextEditCommand::DELETE_WORD_BACKWARD;
254 } else { 247 } else {
255 commands[0] = TextEditCommandAuraLinux::MOVE_WORD_BACKWARD; 248 commands[0] = TextEditCommand::MOVE_WORD_BACKWARD;
256 commands[1] = TextEditCommandAuraLinux::DELETE_WORD_FORWARD; 249 commands[1] = TextEditCommand::DELETE_WORD_FORWARD;
257 } 250 }
258 break; 251 break;
259 case GTK_DELETE_DISPLAY_LINES: 252 case GTK_DELETE_DISPLAY_LINES:
260 commands[0] = TextEditCommandAuraLinux::MOVE_TO_BEGINNING_OF_LINE; 253 commands[0] = TextEditCommand::MOVE_TO_BEGINNING_OF_LINE;
261 commands[1] = TextEditCommandAuraLinux::DELETE_TO_END_OF_LINE; 254 commands[1] = TextEditCommand::DELETE_TO_END_OF_LINE;
262 break; 255 break;
263 case GTK_DELETE_DISPLAY_LINE_ENDS: 256 case GTK_DELETE_DISPLAY_LINE_ENDS:
264 commands[0] = 257 commands[0] = (count > 0 ? TextEditCommand::DELETE_TO_END_OF_LINE
265 (count > 0 ? TextEditCommandAuraLinux::DELETE_TO_END_OF_LINE 258 : TextEditCommand::DELETE_TO_BEGINNING_OF_LINE);
266 : TextEditCommandAuraLinux::DELETE_TO_BEGINNING_OF_LINE);
267 break; 259 break;
268 case GTK_DELETE_PARAGRAPH_ENDS: 260 case GTK_DELETE_PARAGRAPH_ENDS:
269 commands[0] = 261 commands[0] =
270 (count > 0 262 (count > 0 ? TextEditCommand::DELETE_TO_END_OF_PARAGRAPH
271 ? TextEditCommandAuraLinux::DELETE_TO_END_OF_PARAGRAPH 263 : TextEditCommand::DELETE_TO_BEGINNING_OF_PARAGRAPH);
272 : TextEditCommandAuraLinux::DELETE_TO_BEGINNING_OF_PARAGRAPH);
273 break; 264 break;
274 case GTK_DELETE_PARAGRAPHS: 265 case GTK_DELETE_PARAGRAPHS:
275 commands[0] = TextEditCommandAuraLinux::MOVE_TO_BEGINNING_OF_PARAGRAPH; 266 commands[0] = TextEditCommand::MOVE_TO_BEGINNING_OF_PARAGRAPH;
276 commands[1] = TextEditCommandAuraLinux::DELETE_TO_END_OF_PARAGRAPH; 267 commands[1] = TextEditCommand::DELETE_TO_END_OF_PARAGRAPH;
277 break; 268 break;
278 default: 269 default:
279 // GTK_DELETE_WHITESPACE has no corresponding editor command. 270 // GTK_DELETE_WHITESPACE has no corresponding editor command.
280 return; 271 return;
281 } 272 }
282 273
283 Gtk2KeyBindingsHandler* owner = GetHandlerOwner(text_view); 274 Gtk2KeyBindingsHandler* owner = GetHandlerOwner(text_view);
284 if (count < 0) 275 if (count < 0)
285 count = -count; 276 count = -count;
286 for (; count > 0; --count) { 277 for (; count > 0; --count) {
287 for (size_t i = 0; i < arraysize(commands); ++i) 278 for (size_t i = 0; i < arraysize(commands); ++i)
288 if (commands[i] != TextEditCommandAuraLinux::INVALID_COMMAND) 279 if (commands[i] != TextEditCommand::INVALID_COMMAND)
289 owner->EditCommandMatched(commands[i], std::string(), false); 280 owner->EditCommandMatched(commands[i], std::string());
290 } 281 }
291 } 282 }
292 283
293 void Gtk2KeyBindingsHandler::InsertAtCursor(GtkTextView* text_view, 284 void Gtk2KeyBindingsHandler::InsertAtCursor(GtkTextView* text_view,
294 const gchar* str) { 285 const gchar* str) {
295 if (str && *str) 286 if (str && *str) {
296 GetHandlerOwner(text_view)->EditCommandMatched( 287 GetHandlerOwner(text_view)->EditCommandMatched(TextEditCommand::INSERT_TEXT,
297 TextEditCommandAuraLinux::INSERT_TEXT, str, false); 288 str);
289 }
298 } 290 }
299 291
300 void Gtk2KeyBindingsHandler::MoveCursor( 292 void Gtk2KeyBindingsHandler::MoveCursor(
301 GtkTextView* text_view, GtkMovementStep step, gint count, 293 GtkTextView* text_view, GtkMovementStep step, gint count,
302 gboolean extend_selection) { 294 gboolean extend_selection) {
303 if (!count) 295 if (!count)
304 return; 296 return;
305 297
306 TextEditCommandAuraLinux::CommandId command; 298 TextEditCommand command;
307 switch (step) { 299 switch (step) {
308 case GTK_MOVEMENT_LOGICAL_POSITIONS: 300 case GTK_MOVEMENT_LOGICAL_POSITIONS:
309 command = (count > 0 ? 301 if (extend_selection) {
310 TextEditCommandAuraLinux::MOVE_FORWARD : 302 command =
311 TextEditCommandAuraLinux::MOVE_BACKWARD); 303 (count > 0 ? TextEditCommand::MOVE_FORWARD_AND_MODIFY_SELECTION
304 : TextEditCommand::MOVE_BACKWARD_AND_MODIFY_SELECTION);
305 } else {
306 command = (count > 0 ? TextEditCommand::MOVE_FORWARD
307 : TextEditCommand::MOVE_BACKWARD);
308 }
312 break; 309 break;
313 case GTK_MOVEMENT_VISUAL_POSITIONS: 310 case GTK_MOVEMENT_VISUAL_POSITIONS:
314 command = (count > 0 ? 311 if (extend_selection) {
315 TextEditCommandAuraLinux::MOVE_RIGHT : 312 command = (count > 0 ? TextEditCommand::MOVE_RIGHT_AND_MODIFY_SELECTION
316 TextEditCommandAuraLinux::MOVE_LEFT); 313 : TextEditCommand::MOVE_LEFT_AND_MODIFY_SELECTION);
314 } else {
315 command = (count > 0 ? TextEditCommand::MOVE_RIGHT
316 : TextEditCommand::MOVE_LEFT);
317 }
317 break; 318 break;
318 case GTK_MOVEMENT_WORDS: 319 case GTK_MOVEMENT_WORDS:
319 command = (count > 0 ? 320 if (extend_selection) {
320 TextEditCommandAuraLinux::MOVE_WORD_RIGHT : 321 command =
321 TextEditCommandAuraLinux::MOVE_WORD_LEFT); 322 (count > 0 ? TextEditCommand::MOVE_WORD_RIGHT_AND_MODIFY_SELECTION
323 : TextEditCommand::MOVE_WORD_LEFT_AND_MODIFY_SELECTION);
324 } else {
325 command = (count > 0 ? TextEditCommand::MOVE_WORD_RIGHT
326 : TextEditCommand::MOVE_WORD_LEFT);
327 }
322 break; 328 break;
323 case GTK_MOVEMENT_DISPLAY_LINES: 329 case GTK_MOVEMENT_DISPLAY_LINES:
324 command = (count > 0 ? 330 if (extend_selection) {
325 TextEditCommandAuraLinux::MOVE_DOWN : 331 command = (count > 0 ? TextEditCommand::MOVE_DOWN_AND_MODIFY_SELECTION
326 TextEditCommandAuraLinux::MOVE_UP); 332 : TextEditCommand::MOVE_UP_AND_MODIFY_SELECTION);
333 } else {
334 command =
335 (count > 0 ? TextEditCommand::MOVE_DOWN : TextEditCommand::MOVE_UP);
336 }
327 break; 337 break;
328 case GTK_MOVEMENT_DISPLAY_LINE_ENDS: 338 case GTK_MOVEMENT_DISPLAY_LINE_ENDS:
329 command = 339 if (extend_selection) {
330 (count > 0 ? TextEditCommandAuraLinux::MOVE_TO_END_OF_LINE 340 command =
331 : TextEditCommandAuraLinux::MOVE_TO_BEGINNING_OF_LINE); 341 (count > 0
342 ? TextEditCommand::MOVE_TO_END_OF_LINE_AND_MODIFY_SELECTION
343 : TextEditCommand::
344 MOVE_TO_BEGINNING_OF_LINE_AND_MODIFY_SELECTION);
345 } else {
346 command = (count > 0 ? TextEditCommand::MOVE_TO_END_OF_LINE
347 : TextEditCommand::MOVE_TO_BEGINNING_OF_LINE);
348 }
332 break; 349 break;
333 case GTK_MOVEMENT_PARAGRAPH_ENDS: 350 case GTK_MOVEMENT_PARAGRAPH_ENDS:
334 command = 351 if (extend_selection) {
335 (count > 0 352 command =
336 ? TextEditCommandAuraLinux::MOVE_TO_END_OF_PARAGRAPH 353 (count > 0
337 : TextEditCommandAuraLinux::MOVE_TO_BEGINNING_OF_PARAGRAPH); 354 ? TextEditCommand::
355 MOVE_TO_END_OF_PARAGRAPH_AND_MODIFY_SELECTION
356 : TextEditCommand::
357 MOVE_TO_BEGINNING_OF_PARAGRAPH_AND_MODIFY_SELECTION);
358 } else {
359 command = (count > 0 ? TextEditCommand::MOVE_TO_END_OF_PARAGRAPH
360 : TextEditCommand::MOVE_TO_BEGINNING_OF_PARAGRAPH);
361 }
338 break; 362 break;
339 case GTK_MOVEMENT_PAGES: 363 case GTK_MOVEMENT_PAGES:
340 command = (count > 0 ? TextEditCommandAuraLinux::MOVE_PAGE_DOWN : 364 if (extend_selection) {
341 TextEditCommandAuraLinux::MOVE_PAGE_UP); 365 command =
366 (count > 0 ? TextEditCommand::MOVE_PAGE_DOWN_AND_MODIFY_SELECTION
367 : TextEditCommand::MOVE_PAGE_UP_AND_MODIFY_SELECTION);
368 } else {
369 command = (count > 0 ? TextEditCommand::MOVE_PAGE_DOWN
370 : TextEditCommand::MOVE_PAGE_UP);
371 }
342 break; 372 break;
343 case GTK_MOVEMENT_BUFFER_ENDS: 373 case GTK_MOVEMENT_BUFFER_ENDS:
344 command = 374 if (extend_selection) {
345 (count > 0 ? TextEditCommandAuraLinux::MOVE_TO_END_OF_DOCUMENT 375 command =
346 : TextEditCommandAuraLinux::MOVE_TO_BEGINNING_OF_DOCUMENT); 376 (count > 0
377 ? TextEditCommand::MOVE_TO_END_OF_DOCUMENT_AND_MODIFY_SELECTION
378 : TextEditCommand::
379 MOVE_TO_BEGINNING_OF_DOCUMENT_AND_MODIFY_SELECTION);
380 } else {
381 command = (count > 0 ? TextEditCommand::MOVE_TO_END_OF_DOCUMENT
382 : TextEditCommand::MOVE_TO_BEGINNING_OF_DOCUMENT);
383 }
347 break; 384 break;
348 default: 385 default:
349 // GTK_MOVEMENT_PARAGRAPHS and GTK_MOVEMENT_HORIZONTAL_PAGES have 386 // GTK_MOVEMENT_PARAGRAPHS and GTK_MOVEMENT_HORIZONTAL_PAGES have
350 // no corresponding editor commands. 387 // no corresponding editor commands.
351 return; 388 return;
352 } 389 }
353 390
354 Gtk2KeyBindingsHandler* owner = GetHandlerOwner(text_view); 391 Gtk2KeyBindingsHandler* owner = GetHandlerOwner(text_view);
355 if (count < 0) 392 if (count < 0)
356 count = -count; 393 count = -count;
357 for (; count > 0; --count) 394 for (; count > 0; --count)
358 owner->EditCommandMatched(command, std::string(), extend_selection); 395 owner->EditCommandMatched(command, std::string());
359 } 396 }
360 397
361 void Gtk2KeyBindingsHandler::MoveViewport( 398 void Gtk2KeyBindingsHandler::MoveViewport(
362 GtkTextView* text_view, GtkScrollStep step, gint count) { 399 GtkTextView* text_view, GtkScrollStep step, gint count) {
363 // Not supported by webkit. 400 // Not supported by webkit.
364 } 401 }
365 402
366 void Gtk2KeyBindingsHandler::PasteClipboard(GtkTextView* text_view) { 403 void Gtk2KeyBindingsHandler::PasteClipboard(GtkTextView* text_view) {
367 GetHandlerOwner(text_view)->EditCommandMatched( 404 GetHandlerOwner(text_view)->EditCommandMatched(TextEditCommand::PASTE,
368 TextEditCommandAuraLinux::PASTE, std::string(), false); 405 std::string());
369 } 406 }
370 407
371 void Gtk2KeyBindingsHandler::SelectAll(GtkTextView* text_view, 408 void Gtk2KeyBindingsHandler::SelectAll(GtkTextView* text_view,
372 gboolean select) { 409 gboolean select) {
373 if (select) { 410 GetHandlerOwner(text_view)->EditCommandMatched(
374 GetHandlerOwner(text_view)->EditCommandMatched( 411 select ? TextEditCommand::SELECT_ALL : TextEditCommand::UNSELECT,
375 TextEditCommandAuraLinux::SELECT_ALL, std::string(), false); 412 std::string());
376 } else {
377 GetHandlerOwner(text_view)->EditCommandMatched(
378 TextEditCommandAuraLinux::UNSELECT, std::string(), false);
379 }
380 } 413 }
381 414
382 void Gtk2KeyBindingsHandler::SetAnchor(GtkTextView* text_view) { 415 void Gtk2KeyBindingsHandler::SetAnchor(GtkTextView* text_view) {
383 GetHandlerOwner(text_view)->EditCommandMatched( 416 GetHandlerOwner(text_view)->EditCommandMatched(TextEditCommand::SET_MARK,
384 TextEditCommandAuraLinux::SET_MARK, std::string(), false); 417 std::string());
385 } 418 }
386 419
387 void Gtk2KeyBindingsHandler::ToggleCursorVisible(GtkTextView* text_view) { 420 void Gtk2KeyBindingsHandler::ToggleCursorVisible(GtkTextView* text_view) {
388 // Not supported by webkit. 421 // Not supported by webkit.
389 } 422 }
390 423
391 void Gtk2KeyBindingsHandler::ToggleOverwrite(GtkTextView* text_view) { 424 void Gtk2KeyBindingsHandler::ToggleOverwrite(GtkTextView* text_view) {
392 // Not supported by webkit. 425 // Not supported by webkit.
393 } 426 }
394 427
395 gboolean Gtk2KeyBindingsHandler::ShowHelp(GtkWidget* widget, 428 gboolean Gtk2KeyBindingsHandler::ShowHelp(GtkWidget* widget,
396 GtkWidgetHelpType arg1) { 429 GtkWidgetHelpType arg1) {
397 // Just for disabling the default handler. 430 // Just for disabling the default handler.
398 return FALSE; 431 return FALSE;
399 } 432 }
400 433
401 void Gtk2KeyBindingsHandler::MoveFocus(GtkWidget* widget, 434 void Gtk2KeyBindingsHandler::MoveFocus(GtkWidget* widget,
402 GtkDirectionType arg1) { 435 GtkDirectionType arg1) {
403 // Just for disabling the default handler. 436 // Just for disabling the default handler.
404 } 437 }
405 438
406 } // namespace libgtk2ui 439 } // namespace libgtk2ui
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.h ('k') | ui/base/ime/linux/text_edit_command_auralinux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698