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

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

Issue 2029733003: Views: Replace resource ids with ui::TextEditCommand enum for text editing commands in Textfield. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: === 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_BEGINING_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] = (count > 0 ? 257 commands[0] = (count > 0 ? TextEditCommand::DELETE_TO_END_OF_LINE
265 TextEditCommandAuraLinux::DELETE_TO_END_OF_LINE : 258 : TextEditCommand::DELETE_TO_BEGINNING_OF_LINE);
266 TextEditCommandAuraLinux::DELETE_TO_BEGINING_OF_LINE);
267 break; 259 break;
268 case GTK_DELETE_PARAGRAPH_ENDS: 260 case GTK_DELETE_PARAGRAPH_ENDS:
269 commands[0] = (count > 0 ? 261 commands[0] =
270 TextEditCommandAuraLinux::DELETE_TO_END_OF_PARAGRAPH : 262 (count > 0 ? TextEditCommand::DELETE_TO_END_OF_PARAGRAPH
271 TextEditCommandAuraLinux::DELETE_TO_BEGINING_OF_PARAGRAPH); 263 : TextEditCommand::DELETE_TO_BEGINNING_OF_PARAGRAPH);
272 break; 264 break;
273 case GTK_DELETE_PARAGRAPHS: 265 case GTK_DELETE_PARAGRAPHS:
274 commands[0] = 266 commands[0] = TextEditCommand::MOVE_TO_BEGINNING_OF_PARAGRAPH;
275 TextEditCommandAuraLinux::MOVE_TO_BEGINING_OF_PARAGRAPH; 267 commands[1] = TextEditCommand::DELETE_TO_END_OF_PARAGRAPH;
276 commands[1] =
277 TextEditCommandAuraLinux::DELETE_TO_END_OF_PARAGRAPH;
278 break; 268 break;
279 default: 269 default:
280 // GTK_DELETE_WHITESPACE has no corresponding editor command. 270 // GTK_DELETE_WHITESPACE has no corresponding editor command.
281 return; 271 return;
282 } 272 }
283 273
284 Gtk2KeyBindingsHandler* owner = GetHandlerOwner(text_view); 274 Gtk2KeyBindingsHandler* owner = GetHandlerOwner(text_view);
285 if (count < 0) 275 if (count < 0)
286 count = -count; 276 count = -count;
287 for (; count > 0; --count) { 277 for (; count > 0; --count) {
288 for (size_t i = 0; i < arraysize(commands); ++i) 278 for (size_t i = 0; i < arraysize(commands); ++i)
289 if (commands[i] != TextEditCommandAuraLinux::INVALID_COMMAND) 279 if (commands[i] != TextEditCommand::INVALID_COMMAND)
290 owner->EditCommandMatched(commands[i], std::string(), false); 280 owner->EditCommandMatched(commands[i], std::string());
291 } 281 }
292 } 282 }
293 283
294 void Gtk2KeyBindingsHandler::InsertAtCursor(GtkTextView* text_view, 284 void Gtk2KeyBindingsHandler::InsertAtCursor(GtkTextView* text_view,
295 const gchar* str) { 285 const gchar* str) {
296 if (str && *str) 286 if (str && *str) {
297 GetHandlerOwner(text_view)->EditCommandMatched( 287 GetHandlerOwner(text_view)->EditCommandMatched(TextEditCommand::INSERT_TEXT,
298 TextEditCommandAuraLinux::INSERT_TEXT, str, false); 288 str);
289 }
299 } 290 }
300 291
301 void Gtk2KeyBindingsHandler::MoveCursor( 292 void Gtk2KeyBindingsHandler::MoveCursor(
302 GtkTextView* text_view, GtkMovementStep step, gint count, 293 GtkTextView* text_view, GtkMovementStep step, gint count,
303 gboolean extend_selection) { 294 gboolean extend_selection) {
304 if (!count) 295 if (!count)
305 return; 296 return;
306 297
307 TextEditCommandAuraLinux::CommandId command; 298 TextEditCommand command;
308 switch (step) { 299 switch (step) {
309 case GTK_MOVEMENT_LOGICAL_POSITIONS: 300 case GTK_MOVEMENT_LOGICAL_POSITIONS:
310 command = (count > 0 ? 301 if (extend_selection) {
311 TextEditCommandAuraLinux::MOVE_FORWARD : 302 command =
312 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 }
313 break; 309 break;
314 case GTK_MOVEMENT_VISUAL_POSITIONS: 310 case GTK_MOVEMENT_VISUAL_POSITIONS:
315 command = (count > 0 ? 311 if (extend_selection) {
316 TextEditCommandAuraLinux::MOVE_RIGHT : 312 command = (count > 0 ? TextEditCommand::MOVE_RIGHT_AND_MODIFY_SELECTION
317 TextEditCommandAuraLinux::MOVE_LEFT); 313 : TextEditCommand::MOVE_LEFT_AND_MODIFY_SELECTION);
314 } else {
315 command = (count > 0 ? TextEditCommand::MOVE_RIGHT
316 : TextEditCommand::MOVE_LEFT);
317 }
318 break; 318 break;
319 case GTK_MOVEMENT_WORDS: 319 case GTK_MOVEMENT_WORDS:
320 command = (count > 0 ? 320 if (extend_selection) {
321 TextEditCommandAuraLinux::MOVE_WORD_RIGHT : 321 command =
322 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 }
323 break; 328 break;
324 case GTK_MOVEMENT_DISPLAY_LINES: 329 case GTK_MOVEMENT_DISPLAY_LINES:
325 command = (count > 0 ? 330 if (extend_selection) {
326 TextEditCommandAuraLinux::MOVE_DOWN : 331 command = (count > 0 ? TextEditCommand::MOVE_DOWN_AND_MODIFY_SELECTION
327 TextEditCommandAuraLinux::MOVE_UP); 332 : TextEditCommand::MOVE_UP_AND_MODIFY_SELECTION);
333 } else {
334 command =
335 (count > 0 ? TextEditCommand::MOVE_DOWN : TextEditCommand::MOVE_UP);
336 }
328 break; 337 break;
329 case GTK_MOVEMENT_DISPLAY_LINE_ENDS: 338 case GTK_MOVEMENT_DISPLAY_LINE_ENDS:
330 command = (count > 0 ? 339 if (extend_selection) {
331 TextEditCommandAuraLinux::MOVE_TO_END_OF_LINE : 340 command =
332 TextEditCommandAuraLinux::MOVE_TO_BEGINING_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 }
333 break; 349 break;
334 case GTK_MOVEMENT_PARAGRAPH_ENDS: 350 case GTK_MOVEMENT_PARAGRAPH_ENDS:
335 command = (count > 0 ? 351 if (extend_selection) {
336 TextEditCommandAuraLinux::MOVE_TO_END_OF_PARAGRAPH : 352 command =
337 TextEditCommandAuraLinux::MOVE_TO_BEGINING_OF_PARAGRAPH); 353 (count > 0
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 = (count > 0 ? TextEditCommandAuraLinux::MOVE_TO_END_OF_DOCUMENT : 374 if (extend_selection) {
345 TextEditCommandAuraLinux::MOVE_TO_BEGINING_OF_DOCUMENT); 375 command =
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 }
346 break; 384 break;
347 default: 385 default:
348 // GTK_MOVEMENT_PARAGRAPHS and GTK_MOVEMENT_HORIZONTAL_PAGES have 386 // GTK_MOVEMENT_PARAGRAPHS and GTK_MOVEMENT_HORIZONTAL_PAGES have
349 // no corresponding editor commands. 387 // no corresponding editor commands.
350 return; 388 return;
351 } 389 }
352 390
353 Gtk2KeyBindingsHandler* owner = GetHandlerOwner(text_view); 391 Gtk2KeyBindingsHandler* owner = GetHandlerOwner(text_view);
354 if (count < 0) 392 if (count < 0)
355 count = -count; 393 count = -count;
356 for (; count > 0; --count) 394 for (; count > 0; --count)
357 owner->EditCommandMatched(command, std::string(), extend_selection); 395 owner->EditCommandMatched(command, std::string());
358 } 396 }
359 397
360 void Gtk2KeyBindingsHandler::MoveViewport( 398 void Gtk2KeyBindingsHandler::MoveViewport(
361 GtkTextView* text_view, GtkScrollStep step, gint count) { 399 GtkTextView* text_view, GtkScrollStep step, gint count) {
362 // Not supported by webkit. 400 // Not supported by webkit.
363 } 401 }
364 402
365 void Gtk2KeyBindingsHandler::PasteClipboard(GtkTextView* text_view) { 403 void Gtk2KeyBindingsHandler::PasteClipboard(GtkTextView* text_view) {
366 GetHandlerOwner(text_view)->EditCommandMatched( 404 GetHandlerOwner(text_view)->EditCommandMatched(TextEditCommand::PASTE,
367 TextEditCommandAuraLinux::PASTE, std::string(), false); 405 std::string());
368 } 406 }
369 407
370 void Gtk2KeyBindingsHandler::SelectAll(GtkTextView* text_view, 408 void Gtk2KeyBindingsHandler::SelectAll(GtkTextView* text_view,
371 gboolean select) { 409 gboolean select) {
372 if (select) { 410 GetHandlerOwner(text_view)->EditCommandMatched(
373 GetHandlerOwner(text_view)->EditCommandMatched( 411 select ? TextEditCommand::SELECT_ALL : TextEditCommand::UNSELECT,
374 TextEditCommandAuraLinux::SELECT_ALL, std::string(), false); 412 std::string());
375 } else {
376 GetHandlerOwner(text_view)->EditCommandMatched(
377 TextEditCommandAuraLinux::UNSELECT, std::string(), false);
378 }
379 } 413 }
380 414
381 void Gtk2KeyBindingsHandler::SetAnchor(GtkTextView* text_view) { 415 void Gtk2KeyBindingsHandler::SetAnchor(GtkTextView* text_view) {
382 GetHandlerOwner(text_view)->EditCommandMatched( 416 GetHandlerOwner(text_view)->EditCommandMatched(TextEditCommand::SET_MARK,
383 TextEditCommandAuraLinux::SET_MARK, std::string(), false); 417 std::string());
384 } 418 }
385 419
386 void Gtk2KeyBindingsHandler::ToggleCursorVisible(GtkTextView* text_view) { 420 void Gtk2KeyBindingsHandler::ToggleCursorVisible(GtkTextView* text_view) {
387 // Not supported by webkit. 421 // Not supported by webkit.
388 } 422 }
389 423
390 void Gtk2KeyBindingsHandler::ToggleOverwrite(GtkTextView* text_view) { 424 void Gtk2KeyBindingsHandler::ToggleOverwrite(GtkTextView* text_view) {
391 // Not supported by webkit. 425 // Not supported by webkit.
392 } 426 }
393 427
394 gboolean Gtk2KeyBindingsHandler::ShowHelp(GtkWidget* widget, 428 gboolean Gtk2KeyBindingsHandler::ShowHelp(GtkWidget* widget,
395 GtkWidgetHelpType arg1) { 429 GtkWidgetHelpType arg1) {
396 // Just for disabling the default handler. 430 // Just for disabling the default handler.
397 return FALSE; 431 return FALSE;
398 } 432 }
399 433
400 void Gtk2KeyBindingsHandler::MoveFocus(GtkWidget* widget, 434 void Gtk2KeyBindingsHandler::MoveFocus(GtkWidget* widget,
401 GtkDirectionType arg1) { 435 GtkDirectionType arg1) {
402 // Just for disabling the default handler. 436 // Just for disabling the default handler.
403 } 437 }
404 438
405 } // namespace libgtk2ui 439 } // namespace libgtk2ui
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.h ('k') | chrome/browser/ui/libgtk2ui/gtk2_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698