| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "ui/views/cocoa/bridged_content_view.h" | 5 #import "ui/views/cocoa/bridged_content_view.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "base/mac/mac_util.h" | 8 #import "base/mac/mac_util.h" |
| 9 #import "base/mac/scoped_nsobject.h" | 9 #import "base/mac/scoped_nsobject.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| 11 #include "skia/ext/skia_utils_mac.h" | 11 #include "skia/ext/skia_utils_mac.h" |
| 12 #include "ui/base/cocoa/cocoa_base_utils.h" | 12 #include "ui/base/cocoa/cocoa_base_utils.h" |
| 13 #include "ui/base/dragdrop/drag_drop_types.h" | 13 #include "ui/base/dragdrop/drag_drop_types.h" |
| 14 #include "ui/base/dragdrop/os_exchange_data_provider_mac.h" | 14 #include "ui/base/dragdrop/os_exchange_data_provider_mac.h" |
| 15 #include "ui/base/ime/input_method.h" | 15 #include "ui/base/ime/input_method.h" |
| 16 #include "ui/base/ime/text_edit_commands.h" |
| 16 #include "ui/base/ime/text_input_client.h" | 17 #include "ui/base/ime/text_input_client.h" |
| 17 #include "ui/compositor/canvas_painter.h" | 18 #include "ui/compositor/canvas_painter.h" |
| 18 #import "ui/events/cocoa/cocoa_event_utils.h" | 19 #import "ui/events/cocoa/cocoa_event_utils.h" |
| 19 #include "ui/events/keycodes/dom/dom_code.h" | 20 #include "ui/events/keycodes/dom/dom_code.h" |
| 20 #import "ui/events/keycodes/keyboard_code_conversion_mac.h" | 21 #import "ui/events/keycodes/keyboard_code_conversion_mac.h" |
| 21 #include "ui/gfx/canvas_paint_mac.h" | 22 #include "ui/gfx/canvas_paint_mac.h" |
| 22 #include "ui/gfx/geometry/rect.h" | 23 #include "ui/gfx/geometry/rect.h" |
| 23 #import "ui/gfx/mac/coordinate_conversion.h" | 24 #import "ui/gfx/mac/coordinate_conversion.h" |
| 24 #include "ui/gfx/path.h" | 25 #include "ui/gfx/path.h" |
| 25 #import "ui/gfx/path_mac.h" | 26 #import "ui/gfx/path_mac.h" |
| 26 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 27 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
| 27 #include "ui/strings/grit/ui_strings.h" | |
| 28 #import "ui/views/cocoa/bridged_native_widget.h" | 28 #import "ui/views/cocoa/bridged_native_widget.h" |
| 29 #import "ui/views/cocoa/drag_drop_client_mac.h" | 29 #import "ui/views/cocoa/drag_drop_client_mac.h" |
| 30 #include "ui/views/controls/menu/menu_config.h" | 30 #include "ui/views/controls/menu/menu_config.h" |
| 31 #include "ui/views/controls/menu/menu_controller.h" | 31 #include "ui/views/controls/menu/menu_controller.h" |
| 32 #include "ui/views/view.h" | 32 #include "ui/views/view.h" |
| 33 #include "ui/views/widget/native_widget_mac.h" | 33 #include "ui/views/widget/native_widget_mac.h" |
| 34 #include "ui/views/widget/widget.h" | 34 #include "ui/views/widget/widget.h" |
| 35 | 35 |
| 36 using views::MenuController; | 36 using views::MenuController; |
| 37 | 37 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 // TextInputClient, the keyCode that toolkit-views expects internally. | 211 // TextInputClient, the keyCode that toolkit-views expects internally. |
| 212 // For example, moveToLeftEndOfLine: would pass ui::VKEY_HOME in non-RTL locales | 212 // For example, moveToLeftEndOfLine: would pass ui::VKEY_HOME in non-RTL locales |
| 213 // even though the Home key on Mac defaults to moveToBeginningOfDocument:. | 213 // even though the Home key on Mac defaults to moveToBeginningOfDocument:. |
| 214 // This approach also allows action messages a user | 214 // This approach also allows action messages a user |
| 215 // may have remapped in ~/Library/KeyBindings/DefaultKeyBinding.dict to be | 215 // may have remapped in ~/Library/KeyBindings/DefaultKeyBinding.dict to be |
| 216 // catered for. | 216 // catered for. |
| 217 // Note: default key bindings in Mac can be read from StandardKeyBinding.dict | 217 // Note: default key bindings in Mac can be read from StandardKeyBinding.dict |
| 218 // which lives in /System/Library/Frameworks/AppKit.framework/Resources. Do | 218 // which lives in /System/Library/Frameworks/AppKit.framework/Resources. Do |
| 219 // `plutil -convert xml1 -o StandardKeyBinding.xml StandardKeyBinding.dict` to | 219 // `plutil -convert xml1 -o StandardKeyBinding.xml StandardKeyBinding.dict` to |
| 220 // get something readable. | 220 // get something readable. |
| 221 - (void)handleAction:(int)commandId | 221 - (void)handleAction:(ui::TextEditCommand)command |
| 222 keyCode:(ui::KeyboardCode)keyCode | 222 keyCode:(ui::KeyboardCode)keyCode |
| 223 domCode:(ui::DomCode)domCode | 223 domCode:(ui::DomCode)domCode |
| 224 eventFlags:(int)eventFlags; | 224 eventFlags:(int)eventFlags; |
| 225 | 225 |
| 226 // Notification handler invoked when the Full Keyboard Access mode is changed. | 226 // Notification handler invoked when the Full Keyboard Access mode is changed. |
| 227 - (void)onFullKeyboardAccessModeChanged:(NSNotification*)notification; | 227 - (void)onFullKeyboardAccessModeChanged:(NSNotification*)notification; |
| 228 | 228 |
| 229 // Returns the native Widget's drag drop client. Possibly null. | 229 // Returns the native Widget's drag drop client. Possibly null. |
| 230 - (views::DragDropClientMac*)dragDropClient; | 230 - (views::DragDropClientMac*)dragDropClient; |
| 231 | 231 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 return; | 368 return; |
| 369 | 369 |
| 370 DCHECK(theEvent); | 370 DCHECK(theEvent); |
| 371 ui::KeyEvent event(theEvent); | 371 ui::KeyEvent event(theEvent); |
| 372 if (DispatchEventToMenu(hostedView_->GetWidget(), event.key_code())) | 372 if (DispatchEventToMenu(hostedView_->GetWidget(), event.key_code())) |
| 373 return; | 373 return; |
| 374 | 374 |
| 375 hostedView_->GetWidget()->GetInputMethod()->DispatchKeyEvent(&event); | 375 hostedView_->GetWidget()->GetInputMethod()->DispatchKeyEvent(&event); |
| 376 } | 376 } |
| 377 | 377 |
| 378 - (void)handleAction:(int)commandId | 378 - (void)handleAction:(ui::TextEditCommand)command |
| 379 keyCode:(ui::KeyboardCode)keyCode | 379 keyCode:(ui::KeyboardCode)keyCode |
| 380 domCode:(ui::DomCode)domCode | 380 domCode:(ui::DomCode)domCode |
| 381 eventFlags:(int)eventFlags { | 381 eventFlags:(int)eventFlags { |
| 382 if (!hostedView_) | 382 if (!hostedView_) |
| 383 return; | 383 return; |
| 384 | 384 |
| 385 if (DispatchEventToMenu(hostedView_->GetWidget(), keyCode)) | 385 if (DispatchEventToMenu(hostedView_->GetWidget(), keyCode)) |
| 386 return; | 386 return; |
| 387 | 387 |
| 388 // If there's an active TextInputClient, schedule the editing command to be | 388 // If there's an active TextInputClient, schedule the editing command to be |
| 389 // performed. | 389 // performed. |
| 390 if (commandId && textInputClient_ && | 390 if (textInputClient_ && textInputClient_->IsTextEditCommandEnabled(command)) |
| 391 textInputClient_->IsEditCommandEnabled(commandId)) | 391 textInputClient_->SetTextEditCommandForNextKeyEvent(command); |
| 392 textInputClient_->SetEditCommandForNextKeyEvent(commandId); | |
| 393 | 392 |
| 394 // Generate a synthetic event with the keycode toolkit-views expects. | 393 // Generate a synthetic event with the keycode toolkit-views expects. |
| 395 ui::KeyEvent event(ui::ET_KEY_PRESSED, keyCode, domCode, eventFlags); | 394 ui::KeyEvent event(ui::ET_KEY_PRESSED, keyCode, domCode, eventFlags); |
| 396 hostedView_->GetWidget()->GetInputMethod()->DispatchKeyEvent(&event); | 395 hostedView_->GetWidget()->GetInputMethod()->DispatchKeyEvent(&event); |
| 397 } | 396 } |
| 398 | 397 |
| 399 - (void)onFullKeyboardAccessModeChanged:(NSNotification*)notification { | 398 - (void)onFullKeyboardAccessModeChanged:(NSNotification*)notification { |
| 400 DCHECK([[notification name] | 399 DCHECK([[notification name] |
| 401 isEqualToString:kFullKeyboardAccessChangedNotification]); | 400 isEqualToString:kFullKeyboardAccessChangedNotification]); |
| 402 [self updateFullKeyboardAccess]; | 401 [self updateFullKeyboardAccess]; |
| 403 } | 402 } |
| 404 | 403 |
| 405 - (views::DragDropClientMac*)dragDropClient { | 404 - (views::DragDropClientMac*)dragDropClient { |
| 406 views::BridgedNativeWidget* bridge = | 405 views::BridgedNativeWidget* bridge = |
| 407 views::NativeWidgetMac::GetBridgeForNativeWindow([self window]); | 406 views::NativeWidgetMac::GetBridgeForNativeWindow([self window]); |
| 408 return bridge ? bridge->drag_drop_client() : nullptr; | 407 return bridge ? bridge->drag_drop_client() : nullptr; |
| 409 } | 408 } |
| 410 | 409 |
| 411 - (void)undo:(id)sender { | 410 - (void)undo:(id)sender { |
| 412 // This DCHECK is more strict than a similar check in handleAction:. It can be | 411 // This DCHECK is more strict than a similar check in handleAction:. It can be |
| 413 // done here because the actors sending these actions should be calling | 412 // done here because the actors sending these actions should be calling |
| 414 // validateUserInterfaceItem: before enabling UI that allows these messages to | 413 // validateUserInterfaceItem: before enabling UI that allows these messages to |
| 415 // be sent. Checking it here would be too late to provide correct UI feedback | 414 // be sent. Checking it here would be too late to provide correct UI feedback |
| 416 // (e.g. there will be no "beep"). | 415 // (e.g. there will be no "beep"). |
| 417 DCHECK(textInputClient_->IsEditCommandEnabled(IDS_APP_UNDO)); | 416 DCHECK(textInputClient_->IsTextEditCommandEnabled(ui::TextEditCommand::UNDO)); |
| 418 [self handleAction:IDS_APP_UNDO | 417 [self handleAction:ui::TextEditCommand::UNDO |
| 419 keyCode:ui::VKEY_Z | 418 keyCode:ui::VKEY_Z |
| 420 domCode:ui::DomCode::US_Z | 419 domCode:ui::DomCode::US_Z |
| 421 eventFlags:ui::EF_CONTROL_DOWN]; | 420 eventFlags:ui::EF_CONTROL_DOWN]; |
| 422 } | 421 } |
| 423 | 422 |
| 424 - (void)redo:(id)sender { | 423 - (void)redo:(id)sender { |
| 425 DCHECK(textInputClient_->IsEditCommandEnabled(IDS_APP_REDO)); | 424 DCHECK(textInputClient_->IsTextEditCommandEnabled(ui::TextEditCommand::REDO)); |
| 426 [self handleAction:IDS_APP_REDO | 425 [self handleAction:ui::TextEditCommand::REDO |
| 427 keyCode:ui::VKEY_Z | 426 keyCode:ui::VKEY_Z |
| 428 domCode:ui::DomCode::US_Z | 427 domCode:ui::DomCode::US_Z |
| 429 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; | 428 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; |
| 430 } | 429 } |
| 431 | 430 |
| 432 - (void)cut:(id)sender { | 431 - (void)cut:(id)sender { |
| 433 DCHECK(textInputClient_->IsEditCommandEnabled(IDS_APP_CUT)); | 432 DCHECK(textInputClient_->IsTextEditCommandEnabled(ui::TextEditCommand::CUT)); |
| 434 [self handleAction:IDS_APP_CUT | 433 [self handleAction:ui::TextEditCommand::CUT |
| 435 keyCode:ui::VKEY_X | 434 keyCode:ui::VKEY_X |
| 436 domCode:ui::DomCode::US_X | 435 domCode:ui::DomCode::US_X |
| 437 eventFlags:ui::EF_CONTROL_DOWN]; | 436 eventFlags:ui::EF_CONTROL_DOWN]; |
| 438 } | 437 } |
| 439 | 438 |
| 440 - (void)copy:(id)sender { | 439 - (void)copy:(id)sender { |
| 441 DCHECK(textInputClient_->IsEditCommandEnabled(IDS_APP_COPY)); | 440 DCHECK(textInputClient_->IsTextEditCommandEnabled(ui::TextEditCommand::COPY)); |
| 442 [self handleAction:IDS_APP_COPY | 441 [self handleAction:ui::TextEditCommand::COPY |
| 443 keyCode:ui::VKEY_C | 442 keyCode:ui::VKEY_C |
| 444 domCode:ui::DomCode::US_C | 443 domCode:ui::DomCode::US_C |
| 445 eventFlags:ui::EF_CONTROL_DOWN]; | 444 eventFlags:ui::EF_CONTROL_DOWN]; |
| 446 } | 445 } |
| 447 | 446 |
| 448 - (void)paste:(id)sender { | 447 - (void)paste:(id)sender { |
| 449 DCHECK(textInputClient_->IsEditCommandEnabled(IDS_APP_PASTE)); | 448 DCHECK( |
| 450 [self handleAction:IDS_APP_PASTE | 449 textInputClient_->IsTextEditCommandEnabled(ui::TextEditCommand::PASTE)); |
| 450 [self handleAction:ui::TextEditCommand::PASTE |
| 451 keyCode:ui::VKEY_V | 451 keyCode:ui::VKEY_V |
| 452 domCode:ui::DomCode::US_V | 452 domCode:ui::DomCode::US_V |
| 453 eventFlags:ui::EF_CONTROL_DOWN]; | 453 eventFlags:ui::EF_CONTROL_DOWN]; |
| 454 } | 454 } |
| 455 | 455 |
| 456 - (void)selectAll:(id)sender { | 456 - (void)selectAll:(id)sender { |
| 457 DCHECK(textInputClient_->IsEditCommandEnabled(IDS_APP_SELECT_ALL)); | 457 DCHECK(textInputClient_->IsTextEditCommandEnabled( |
| 458 [self handleAction:IDS_APP_SELECT_ALL | 458 ui::TextEditCommand::SELECT_ALL)); |
| 459 [self handleAction:ui::TextEditCommand::SELECT_ALL |
| 459 keyCode:ui::VKEY_A | 460 keyCode:ui::VKEY_A |
| 460 domCode:ui::DomCode::US_A | 461 domCode:ui::DomCode::US_A |
| 461 eventFlags:ui::EF_CONTROL_DOWN]; | 462 eventFlags:ui::EF_CONTROL_DOWN]; |
| 462 } | 463 } |
| 463 | 464 |
| 464 // BaseView implementation. | 465 // BaseView implementation. |
| 465 | 466 |
| 466 // Don't use tracking areas from BaseView. BridgedContentView's tracks | 467 // Don't use tracking areas from BaseView. BridgedContentView's tracks |
| 467 // NSTrackingCursorUpdate and Apple's documentation suggests it's incompatible. | 468 // NSTrackingCursorUpdate and Apple's documentation suggests it's incompatible. |
| 468 - (void)enableTracking { | 469 - (void)enableTracking { |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 } | 677 } |
| 677 | 678 |
| 678 // Selection movement and scrolling. | 679 // Selection movement and scrolling. |
| 679 | 680 |
| 680 - (void)moveForward:(id)sender { | 681 - (void)moveForward:(id)sender { |
| 681 IsTextRTL(textInputClient_) ? [self moveLeft:sender] | 682 IsTextRTL(textInputClient_) ? [self moveLeft:sender] |
| 682 : [self moveRight:sender]; | 683 : [self moveRight:sender]; |
| 683 } | 684 } |
| 684 | 685 |
| 685 - (void)moveRight:(id)sender { | 686 - (void)moveRight:(id)sender { |
| 686 [self handleAction:IDS_MOVE_RIGHT | 687 [self handleAction:ui::TextEditCommand::MOVE_RIGHT |
| 687 keyCode:ui::VKEY_RIGHT | 688 keyCode:ui::VKEY_RIGHT |
| 688 domCode:ui::DomCode::ARROW_RIGHT | 689 domCode:ui::DomCode::ARROW_RIGHT |
| 689 eventFlags:0]; | 690 eventFlags:0]; |
| 690 } | 691 } |
| 691 | 692 |
| 692 - (void)moveBackward:(id)sender { | 693 - (void)moveBackward:(id)sender { |
| 693 IsTextRTL(textInputClient_) ? [self moveRight:sender] | 694 IsTextRTL(textInputClient_) ? [self moveRight:sender] |
| 694 : [self moveLeft:sender]; | 695 : [self moveLeft:sender]; |
| 695 } | 696 } |
| 696 | 697 |
| 697 - (void)moveLeft:(id)sender { | 698 - (void)moveLeft:(id)sender { |
| 698 [self handleAction:IDS_MOVE_LEFT | 699 [self handleAction:ui::TextEditCommand::MOVE_LEFT |
| 699 keyCode:ui::VKEY_LEFT | 700 keyCode:ui::VKEY_LEFT |
| 700 domCode:ui::DomCode::ARROW_LEFT | 701 domCode:ui::DomCode::ARROW_LEFT |
| 701 eventFlags:0]; | 702 eventFlags:0]; |
| 702 } | 703 } |
| 703 | 704 |
| 704 - (void)moveUp:(id)sender { | 705 - (void)moveUp:(id)sender { |
| 705 [self handleAction:IDS_MOVE_TO_BEGINNING_OF_LINE | 706 [self handleAction:ui::TextEditCommand::MOVE_TO_BEGINNING_OF_LINE |
| 706 keyCode:ui::VKEY_UP | 707 keyCode:ui::VKEY_UP |
| 707 domCode:ui::DomCode::ARROW_UP | 708 domCode:ui::DomCode::ARROW_UP |
| 708 eventFlags:0]; | 709 eventFlags:0]; |
| 709 } | 710 } |
| 710 | 711 |
| 711 - (void)moveDown:(id)sender { | 712 - (void)moveDown:(id)sender { |
| 712 [self handleAction:IDS_MOVE_TO_END_OF_LINE | 713 [self handleAction:ui::TextEditCommand::MOVE_TO_END_OF_LINE |
| 713 keyCode:ui::VKEY_DOWN | 714 keyCode:ui::VKEY_DOWN |
| 714 domCode:ui::DomCode::ARROW_DOWN | 715 domCode:ui::DomCode::ARROW_DOWN |
| 715 eventFlags:0]; | 716 eventFlags:0]; |
| 716 } | 717 } |
| 717 | 718 |
| 718 - (void)moveWordForward:(id)sender { | 719 - (void)moveWordForward:(id)sender { |
| 719 IsTextRTL(textInputClient_) ? [self moveWordLeft:sender] | 720 IsTextRTL(textInputClient_) ? [self moveWordLeft:sender] |
| 720 : [self moveWordRight:sender]; | 721 : [self moveWordRight:sender]; |
| 721 } | 722 } |
| 722 | 723 |
| 723 - (void)moveWordBackward:(id)sender { | 724 - (void)moveWordBackward:(id)sender { |
| 724 IsTextRTL(textInputClient_) ? [self moveWordRight:sender] | 725 IsTextRTL(textInputClient_) ? [self moveWordRight:sender] |
| 725 : [self moveWordLeft:sender]; | 726 : [self moveWordLeft:sender]; |
| 726 } | 727 } |
| 727 | 728 |
| 728 - (void)moveToBeginningOfLine:(id)sender { | 729 - (void)moveToBeginningOfLine:(id)sender { |
| 729 [self handleAction:IDS_MOVE_TO_BEGINNING_OF_LINE | 730 [self handleAction:ui::TextEditCommand::MOVE_TO_BEGINNING_OF_LINE |
| 730 keyCode:ui::VKEY_HOME | 731 keyCode:ui::VKEY_HOME |
| 731 domCode:ui::DomCode::HOME | 732 domCode:ui::DomCode::HOME |
| 732 eventFlags:0]; | 733 eventFlags:0]; |
| 733 } | 734 } |
| 734 | 735 |
| 735 - (void)moveToEndOfLine:(id)sender { | 736 - (void)moveToEndOfLine:(id)sender { |
| 736 [self handleAction:IDS_MOVE_TO_END_OF_LINE | 737 [self handleAction:ui::TextEditCommand::MOVE_TO_END_OF_LINE |
| 737 keyCode:ui::VKEY_END | 738 keyCode:ui::VKEY_END |
| 738 domCode:ui::DomCode::END | 739 domCode:ui::DomCode::END |
| 739 eventFlags:0]; | 740 eventFlags:0]; |
| 740 } | 741 } |
| 741 | 742 |
| 742 - (void)moveToBeginningOfParagraph:(id)sender { | 743 - (void)moveToBeginningOfParagraph:(id)sender { |
| 743 [self moveToBeginningOfLine:sender]; | 744 [self moveToBeginningOfLine:sender]; |
| 744 } | 745 } |
| 745 | 746 |
| 746 - (void)moveToEndOfParagraph:(id)sender { | 747 - (void)moveToEndOfParagraph:(id)sender { |
| 747 [self moveToEndOfLine:sender]; | 748 [self moveToEndOfLine:sender]; |
| 748 } | 749 } |
| 749 | 750 |
| 750 - (void)moveToEndOfDocument:(id)sender { | 751 - (void)moveToEndOfDocument:(id)sender { |
| 751 [self handleAction:IDS_MOVE_TO_END_OF_LINE | 752 [self handleAction:ui::TextEditCommand::MOVE_TO_END_OF_LINE |
| 752 keyCode:ui::VKEY_END | 753 keyCode:ui::VKEY_END |
| 753 domCode:ui::DomCode::END | 754 domCode:ui::DomCode::END |
| 754 eventFlags:ui::EF_CONTROL_DOWN]; | 755 eventFlags:ui::EF_CONTROL_DOWN]; |
| 755 } | 756 } |
| 756 | 757 |
| 757 - (void)moveToBeginningOfDocument:(id)sender { | 758 - (void)moveToBeginningOfDocument:(id)sender { |
| 758 [self handleAction:IDS_MOVE_TO_BEGINNING_OF_LINE | 759 [self handleAction:ui::TextEditCommand::MOVE_TO_BEGINNING_OF_LINE |
| 759 keyCode:ui::VKEY_HOME | 760 keyCode:ui::VKEY_HOME |
| 760 domCode:ui::DomCode::HOME | 761 domCode:ui::DomCode::HOME |
| 761 eventFlags:ui::EF_CONTROL_DOWN]; | 762 eventFlags:ui::EF_CONTROL_DOWN]; |
| 762 } | 763 } |
| 763 | 764 |
| 764 - (void)pageDown:(id)sender { | 765 - (void)pageDown:(id)sender { |
| 765 [self handleAction:IDS_MOVE_TO_END_OF_LINE | 766 [self handleAction:ui::TextEditCommand::MOVE_TO_END_OF_LINE |
| 766 keyCode:ui::VKEY_NEXT | 767 keyCode:ui::VKEY_NEXT |
| 767 domCode:ui::DomCode::PAGE_DOWN | 768 domCode:ui::DomCode::PAGE_DOWN |
| 768 eventFlags:0]; | 769 eventFlags:0]; |
| 769 } | 770 } |
| 770 | 771 |
| 771 - (void)pageUp:(id)sender { | 772 - (void)pageUp:(id)sender { |
| 772 [self handleAction:IDS_MOVE_TO_BEGINNING_OF_LINE | 773 [self handleAction:ui::TextEditCommand::MOVE_TO_BEGINNING_OF_LINE |
| 773 keyCode:ui::VKEY_PRIOR | 774 keyCode:ui::VKEY_PRIOR |
| 774 domCode:ui::DomCode::PAGE_UP | 775 domCode:ui::DomCode::PAGE_UP |
| 775 eventFlags:0]; | 776 eventFlags:0]; |
| 776 } | 777 } |
| 777 | 778 |
| 778 - (void)moveBackwardAndModifySelection:(id)sender { | 779 - (void)moveBackwardAndModifySelection:(id)sender { |
| 779 IsTextRTL(textInputClient_) ? [self moveRightAndModifySelection:sender] | 780 IsTextRTL(textInputClient_) ? [self moveRightAndModifySelection:sender] |
| 780 : [self moveLeftAndModifySelection:sender]; | 781 : [self moveLeftAndModifySelection:sender]; |
| 781 } | 782 } |
| 782 | 783 |
| 783 - (void)moveForwardAndModifySelection:(id)sender { | 784 - (void)moveForwardAndModifySelection:(id)sender { |
| 784 IsTextRTL(textInputClient_) ? [self moveLeftAndModifySelection:sender] | 785 IsTextRTL(textInputClient_) ? [self moveLeftAndModifySelection:sender] |
| 785 : [self moveRightAndModifySelection:sender]; | 786 : [self moveRightAndModifySelection:sender]; |
| 786 } | 787 } |
| 787 | 788 |
| 788 - (void)moveWordForwardAndModifySelection:(id)sender { | 789 - (void)moveWordForwardAndModifySelection:(id)sender { |
| 789 IsTextRTL(textInputClient_) ? [self moveWordLeftAndModifySelection:sender] | 790 IsTextRTL(textInputClient_) ? [self moveWordLeftAndModifySelection:sender] |
| 790 : [self moveWordRightAndModifySelection:sender]; | 791 : [self moveWordRightAndModifySelection:sender]; |
| 791 } | 792 } |
| 792 | 793 |
| 793 - (void)moveWordBackwardAndModifySelection:(id)sender { | 794 - (void)moveWordBackwardAndModifySelection:(id)sender { |
| 794 IsTextRTL(textInputClient_) ? [self moveWordRightAndModifySelection:sender] | 795 IsTextRTL(textInputClient_) ? [self moveWordRightAndModifySelection:sender] |
| 795 : [self moveWordLeftAndModifySelection:sender]; | 796 : [self moveWordLeftAndModifySelection:sender]; |
| 796 } | 797 } |
| 797 | 798 |
| 798 - (void)moveUpAndModifySelection:(id)sender { | 799 - (void)moveUpAndModifySelection:(id)sender { |
| 799 [self handleAction:IDS_MOVE_TO_BEGINNING_OF_LINE_AND_MODIFY_SELECTION | 800 [self handleAction:ui::TextEditCommand:: |
| 801 MOVE_TO_BEGINNING_OF_LINE_AND_MODIFY_SELECTION |
| 800 keyCode:ui::VKEY_UP | 802 keyCode:ui::VKEY_UP |
| 801 domCode:ui::DomCode::ARROW_UP | 803 domCode:ui::DomCode::ARROW_UP |
| 802 eventFlags:ui::EF_SHIFT_DOWN]; | 804 eventFlags:ui::EF_SHIFT_DOWN]; |
| 803 } | 805 } |
| 804 | 806 |
| 805 - (void)moveDownAndModifySelection:(id)sender { | 807 - (void)moveDownAndModifySelection:(id)sender { |
| 806 [self handleAction:IDS_MOVE_TO_END_OF_LINE_AND_MODIFY_SELECTION | 808 [self |
| 807 keyCode:ui::VKEY_DOWN | 809 handleAction:ui::TextEditCommand::MOVE_TO_END_OF_LINE_AND_MODIFY_SELECTION |
| 808 domCode:ui::DomCode::ARROW_DOWN | 810 keyCode:ui::VKEY_DOWN |
| 809 eventFlags:ui::EF_SHIFT_DOWN]; | 811 domCode:ui::DomCode::ARROW_DOWN |
| 812 eventFlags:ui::EF_SHIFT_DOWN]; |
| 810 } | 813 } |
| 811 | 814 |
| 812 - (void)moveToBeginningOfLineAndModifySelection:(id)sender { | 815 - (void)moveToBeginningOfLineAndModifySelection:(id)sender { |
| 813 [self handleAction:IDS_MOVE_TO_BEGINNING_OF_LINE_AND_MODIFY_SELECTION | 816 [self handleAction:ui::TextEditCommand:: |
| 817 MOVE_TO_BEGINNING_OF_LINE_AND_MODIFY_SELECTION |
| 814 keyCode:ui::VKEY_HOME | 818 keyCode:ui::VKEY_HOME |
| 815 domCode:ui::DomCode::HOME | 819 domCode:ui::DomCode::HOME |
| 816 eventFlags:ui::EF_SHIFT_DOWN]; | 820 eventFlags:ui::EF_SHIFT_DOWN]; |
| 817 } | 821 } |
| 818 | 822 |
| 819 - (void)moveToEndOfLineAndModifySelection:(id)sender { | 823 - (void)moveToEndOfLineAndModifySelection:(id)sender { |
| 820 [self handleAction:IDS_MOVE_TO_END_OF_LINE_AND_MODIFY_SELECTION | 824 [self |
| 821 keyCode:ui::VKEY_END | 825 handleAction:ui::TextEditCommand::MOVE_TO_END_OF_LINE_AND_MODIFY_SELECTION |
| 822 domCode:ui::DomCode::END | 826 keyCode:ui::VKEY_END |
| 823 eventFlags:ui::EF_SHIFT_DOWN]; | 827 domCode:ui::DomCode::END |
| 828 eventFlags:ui::EF_SHIFT_DOWN]; |
| 824 } | 829 } |
| 825 | 830 |
| 826 - (void)moveToBeginningOfParagraphAndModifySelection:(id)sender { | 831 - (void)moveToBeginningOfParagraphAndModifySelection:(id)sender { |
| 827 [self moveToBeginningOfLineAndModifySelection:sender]; | 832 [self moveToBeginningOfLineAndModifySelection:sender]; |
| 828 } | 833 } |
| 829 | 834 |
| 830 - (void)moveToEndOfParagraphAndModifySelection:(id)sender { | 835 - (void)moveToEndOfParagraphAndModifySelection:(id)sender { |
| 831 [self moveToEndOfLineAndModifySelection:sender]; | 836 [self moveToEndOfLineAndModifySelection:sender]; |
| 832 } | 837 } |
| 833 | 838 |
| 834 - (void)moveToEndOfDocumentAndModifySelection:(id)sender { | 839 - (void)moveToEndOfDocumentAndModifySelection:(id)sender { |
| 835 [self handleAction:IDS_MOVE_TO_END_OF_LINE_AND_MODIFY_SELECTION | 840 [self |
| 836 keyCode:ui::VKEY_END | 841 handleAction:ui::TextEditCommand::MOVE_TO_END_OF_LINE_AND_MODIFY_SELECTION |
| 837 domCode:ui::DomCode::END | 842 keyCode:ui::VKEY_END |
| 838 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; | 843 domCode:ui::DomCode::END |
| 844 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; |
| 839 } | 845 } |
| 840 | 846 |
| 841 - (void)moveToBeginningOfDocumentAndModifySelection:(id)sender { | 847 - (void)moveToBeginningOfDocumentAndModifySelection:(id)sender { |
| 842 [self handleAction:IDS_MOVE_TO_BEGINNING_OF_LINE_AND_MODIFY_SELECTION | 848 [self handleAction:ui::TextEditCommand:: |
| 849 MOVE_TO_BEGINNING_OF_LINE_AND_MODIFY_SELECTION |
| 843 keyCode:ui::VKEY_HOME | 850 keyCode:ui::VKEY_HOME |
| 844 domCode:ui::DomCode::HOME | 851 domCode:ui::DomCode::HOME |
| 845 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; | 852 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; |
| 846 } | 853 } |
| 847 | 854 |
| 848 - (void)pageDownAndModifySelection:(id)sender { | 855 - (void)pageDownAndModifySelection:(id)sender { |
| 849 [self handleAction:IDS_MOVE_TO_END_OF_LINE_AND_MODIFY_SELECTION | 856 [self |
| 850 keyCode:ui::VKEY_NEXT | 857 handleAction:ui::TextEditCommand::MOVE_TO_END_OF_LINE_AND_MODIFY_SELECTION |
| 851 domCode:ui::DomCode::PAGE_DOWN | 858 keyCode:ui::VKEY_NEXT |
| 852 eventFlags:ui::EF_SHIFT_DOWN]; | 859 domCode:ui::DomCode::PAGE_DOWN |
| 860 eventFlags:ui::EF_SHIFT_DOWN]; |
| 853 } | 861 } |
| 854 | 862 |
| 855 - (void)pageUpAndModifySelection:(id)sender { | 863 - (void)pageUpAndModifySelection:(id)sender { |
| 856 [self handleAction:IDS_MOVE_TO_BEGINNING_OF_LINE_AND_MODIFY_SELECTION | 864 [self handleAction:ui::TextEditCommand:: |
| 865 MOVE_TO_BEGINNING_OF_LINE_AND_MODIFY_SELECTION |
| 857 keyCode:ui::VKEY_PRIOR | 866 keyCode:ui::VKEY_PRIOR |
| 858 domCode:ui::DomCode::PAGE_UP | 867 domCode:ui::DomCode::PAGE_UP |
| 859 eventFlags:ui::EF_SHIFT_DOWN]; | 868 eventFlags:ui::EF_SHIFT_DOWN]; |
| 860 } | 869 } |
| 861 | 870 |
| 862 - (void)moveParagraphForwardAndModifySelection:(id)sender { | 871 - (void)moveParagraphForwardAndModifySelection:(id)sender { |
| 863 [self handleAction:IDS_MOVE_TO_END_OF_LINE_AND_MODIFY_SELECTION | 872 [self |
| 864 keyCode:ui::VKEY_DOWN | 873 handleAction:ui::TextEditCommand::MOVE_TO_END_OF_LINE_AND_MODIFY_SELECTION |
| 865 domCode:ui::DomCode::ARROW_DOWN | 874 keyCode:ui::VKEY_DOWN |
| 866 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; | 875 domCode:ui::DomCode::ARROW_DOWN |
| 876 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; |
| 867 } | 877 } |
| 868 | 878 |
| 869 - (void)moveParagraphBackwardAndModifySelection:(id)sender { | 879 - (void)moveParagraphBackwardAndModifySelection:(id)sender { |
| 870 [self handleAction:IDS_MOVE_TO_BEGINNING_OF_LINE_AND_MODIFY_SELECTION | 880 [self handleAction:ui::TextEditCommand:: |
| 881 MOVE_TO_BEGINNING_OF_LINE_AND_MODIFY_SELECTION |
| 871 keyCode:ui::VKEY_UP | 882 keyCode:ui::VKEY_UP |
| 872 domCode:ui::DomCode::ARROW_UP | 883 domCode:ui::DomCode::ARROW_UP |
| 873 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; | 884 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; |
| 874 } | 885 } |
| 875 | 886 |
| 876 - (void)moveWordRight:(id)sender { | 887 - (void)moveWordRight:(id)sender { |
| 877 [self handleAction:IDS_MOVE_WORD_RIGHT | 888 [self handleAction:ui::TextEditCommand::MOVE_WORD_RIGHT |
| 878 keyCode:ui::VKEY_RIGHT | 889 keyCode:ui::VKEY_RIGHT |
| 879 domCode:ui::DomCode::ARROW_RIGHT | 890 domCode:ui::DomCode::ARROW_RIGHT |
| 880 eventFlags:ui::EF_CONTROL_DOWN]; | 891 eventFlags:ui::EF_CONTROL_DOWN]; |
| 881 } | 892 } |
| 882 | 893 |
| 883 - (void)moveWordLeft:(id)sender { | 894 - (void)moveWordLeft:(id)sender { |
| 884 [self handleAction:IDS_MOVE_WORD_LEFT | 895 [self handleAction:ui::TextEditCommand::MOVE_WORD_LEFT |
| 885 keyCode:ui::VKEY_LEFT | 896 keyCode:ui::VKEY_LEFT |
| 886 domCode:ui::DomCode::ARROW_LEFT | 897 domCode:ui::DomCode::ARROW_LEFT |
| 887 eventFlags:ui::EF_CONTROL_DOWN]; | 898 eventFlags:ui::EF_CONTROL_DOWN]; |
| 888 } | 899 } |
| 889 | 900 |
| 890 - (void)moveRightAndModifySelection:(id)sender { | 901 - (void)moveRightAndModifySelection:(id)sender { |
| 891 [self handleAction:IDS_MOVE_RIGHT_AND_MODIFY_SELECTION | 902 [self handleAction:ui::TextEditCommand::MOVE_RIGHT_AND_MODIFY_SELECTION |
| 892 keyCode:ui::VKEY_RIGHT | 903 keyCode:ui::VKEY_RIGHT |
| 893 domCode:ui::DomCode::ARROW_RIGHT | 904 domCode:ui::DomCode::ARROW_RIGHT |
| 894 eventFlags:ui::EF_SHIFT_DOWN]; | 905 eventFlags:ui::EF_SHIFT_DOWN]; |
| 895 } | 906 } |
| 896 | 907 |
| 897 - (void)moveLeftAndModifySelection:(id)sender { | 908 - (void)moveLeftAndModifySelection:(id)sender { |
| 898 [self handleAction:IDS_MOVE_LEFT_AND_MODIFY_SELECTION | 909 [self handleAction:ui::TextEditCommand::MOVE_LEFT_AND_MODIFY_SELECTION |
| 899 keyCode:ui::VKEY_LEFT | 910 keyCode:ui::VKEY_LEFT |
| 900 domCode:ui::DomCode::ARROW_LEFT | 911 domCode:ui::DomCode::ARROW_LEFT |
| 901 eventFlags:ui::EF_SHIFT_DOWN]; | 912 eventFlags:ui::EF_SHIFT_DOWN]; |
| 902 } | 913 } |
| 903 | 914 |
| 904 - (void)moveWordRightAndModifySelection:(id)sender { | 915 - (void)moveWordRightAndModifySelection:(id)sender { |
| 905 [self handleAction:IDS_MOVE_WORD_RIGHT_AND_MODIFY_SELECTION | 916 [self handleAction:ui::TextEditCommand::MOVE_WORD_RIGHT_AND_MODIFY_SELECTION |
| 906 keyCode:ui::VKEY_RIGHT | 917 keyCode:ui::VKEY_RIGHT |
| 907 domCode:ui::DomCode::ARROW_RIGHT | 918 domCode:ui::DomCode::ARROW_RIGHT |
| 908 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; | 919 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; |
| 909 } | 920 } |
| 910 | 921 |
| 911 - (void)moveWordLeftAndModifySelection:(id)sender { | 922 - (void)moveWordLeftAndModifySelection:(id)sender { |
| 912 [self handleAction:IDS_MOVE_WORD_LEFT_AND_MODIFY_SELECTION | 923 [self handleAction:ui::TextEditCommand::MOVE_WORD_LEFT_AND_MODIFY_SELECTION |
| 913 keyCode:ui::VKEY_LEFT | 924 keyCode:ui::VKEY_LEFT |
| 914 domCode:ui::DomCode::ARROW_LEFT | 925 domCode:ui::DomCode::ARROW_LEFT |
| 915 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; | 926 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; |
| 916 } | 927 } |
| 917 | 928 |
| 918 - (void)moveToLeftEndOfLine:(id)sender { | 929 - (void)moveToLeftEndOfLine:(id)sender { |
| 919 IsTextRTL(textInputClient_) ? [self moveToEndOfLine:sender] | 930 IsTextRTL(textInputClient_) ? [self moveToEndOfLine:sender] |
| 920 : [self moveToBeginningOfLine:sender]; | 931 : [self moveToBeginningOfLine:sender]; |
| 921 } | 932 } |
| 922 | 933 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 933 | 944 |
| 934 - (void)moveToRightEndOfLineAndModifySelection:(id)sender { | 945 - (void)moveToRightEndOfLineAndModifySelection:(id)sender { |
| 935 IsTextRTL(textInputClient_) | 946 IsTextRTL(textInputClient_) |
| 936 ? [self moveToBeginningOfLineAndModifySelection:sender] | 947 ? [self moveToBeginningOfLineAndModifySelection:sender] |
| 937 : [self moveToEndOfLineAndModifySelection:sender]; | 948 : [self moveToEndOfLineAndModifySelection:sender]; |
| 938 } | 949 } |
| 939 | 950 |
| 940 // Deletions. | 951 // Deletions. |
| 941 | 952 |
| 942 - (void)deleteForward:(id)sender { | 953 - (void)deleteForward:(id)sender { |
| 943 [self handleAction:IDS_DELETE_FORWARD | 954 [self handleAction:ui::TextEditCommand::DELETE_FORWARD |
| 944 keyCode:ui::VKEY_DELETE | 955 keyCode:ui::VKEY_DELETE |
| 945 domCode:ui::DomCode::DEL | 956 domCode:ui::DomCode::DEL |
| 946 eventFlags:0]; | 957 eventFlags:0]; |
| 947 } | 958 } |
| 948 | 959 |
| 949 - (void)deleteBackward:(id)sender { | 960 - (void)deleteBackward:(id)sender { |
| 950 [self handleAction:IDS_DELETE_BACKWARD | 961 [self handleAction:ui::TextEditCommand::DELETE_BACKWARD |
| 951 keyCode:ui::VKEY_BACK | 962 keyCode:ui::VKEY_BACK |
| 952 domCode:ui::DomCode::BACKSPACE | 963 domCode:ui::DomCode::BACKSPACE |
| 953 eventFlags:0]; | 964 eventFlags:0]; |
| 954 } | 965 } |
| 955 | 966 |
| 956 - (void)deleteWordForward:(id)sender { | 967 - (void)deleteWordForward:(id)sender { |
| 957 [self handleAction:IDS_DELETE_WORD_FORWARD | 968 [self handleAction:ui::TextEditCommand::DELETE_WORD_FORWARD |
| 958 keyCode:ui::VKEY_DELETE | 969 keyCode:ui::VKEY_DELETE |
| 959 domCode:ui::DomCode::DEL | 970 domCode:ui::DomCode::DEL |
| 960 eventFlags:ui::EF_CONTROL_DOWN]; | 971 eventFlags:ui::EF_CONTROL_DOWN]; |
| 961 } | 972 } |
| 962 | 973 |
| 963 - (void)deleteWordBackward:(id)sender { | 974 - (void)deleteWordBackward:(id)sender { |
| 964 [self handleAction:IDS_DELETE_WORD_BACKWARD | 975 [self handleAction:ui::TextEditCommand::DELETE_WORD_BACKWARD |
| 965 keyCode:ui::VKEY_BACK | 976 keyCode:ui::VKEY_BACK |
| 966 domCode:ui::DomCode::BACKSPACE | 977 domCode:ui::DomCode::BACKSPACE |
| 967 eventFlags:ui::EF_CONTROL_DOWN]; | 978 eventFlags:ui::EF_CONTROL_DOWN]; |
| 968 } | 979 } |
| 969 | 980 |
| 970 - (void)deleteToBeginningOfLine:(id)sender { | 981 - (void)deleteToBeginningOfLine:(id)sender { |
| 971 [self handleAction:IDS_DELETE_TO_BEGINNING_OF_LINE | 982 [self handleAction:ui::TextEditCommand::DELETE_TO_BEGINNING_OF_LINE |
| 972 keyCode:ui::VKEY_BACK | 983 keyCode:ui::VKEY_BACK |
| 973 domCode:ui::DomCode::BACKSPACE | 984 domCode:ui::DomCode::BACKSPACE |
| 974 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; | 985 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; |
| 975 } | 986 } |
| 976 | 987 |
| 977 - (void)deleteToEndOfLine:(id)sender { | 988 - (void)deleteToEndOfLine:(id)sender { |
| 978 [self handleAction:IDS_DELETE_TO_END_OF_LINE | 989 [self handleAction:ui::TextEditCommand::DELETE_TO_END_OF_LINE |
| 979 keyCode:ui::VKEY_DELETE | 990 keyCode:ui::VKEY_DELETE |
| 980 domCode:ui::DomCode::DEL | 991 domCode:ui::DomCode::DEL |
| 981 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; | 992 eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN]; |
| 982 } | 993 } |
| 983 | 994 |
| 984 - (void)deleteToBeginningOfParagraph:(id)sender { | 995 - (void)deleteToBeginningOfParagraph:(id)sender { |
| 985 [self deleteToBeginningOfLine:sender]; | 996 [self deleteToBeginningOfLine:sender]; |
| 986 } | 997 } |
| 987 | 998 |
| 988 - (void)deleteToEndOfParagraph:(id)sender { | 999 - (void)deleteToEndOfParagraph:(id)sender { |
| 989 [self deleteToEndOfLine:sender]; | 1000 [self deleteToEndOfLine:sender]; |
| 990 } | 1001 } |
| 991 | 1002 |
| 992 // Cancellation. | 1003 // Cancellation. |
| 993 | 1004 |
| 994 - (void)cancelOperation:(id)sender { | 1005 - (void)cancelOperation:(id)sender { |
| 995 [self handleAction:0 | 1006 [self handleAction:ui::TextEditCommand::INVALID_COMMAND |
| 996 keyCode:ui::VKEY_ESCAPE | 1007 keyCode:ui::VKEY_ESCAPE |
| 997 domCode:ui::DomCode::ESCAPE | 1008 domCode:ui::DomCode::ESCAPE |
| 998 eventFlags:0]; | 1009 eventFlags:0]; |
| 999 } | 1010 } |
| 1000 | 1011 |
| 1001 // Support for Services in context menus. | 1012 // Support for Services in context menus. |
| 1002 // Currently we only support reading and writing plain strings. | 1013 // Currently we only support reading and writing plain strings. |
| 1003 - (id)validRequestorForSendType:(NSString*)sendType | 1014 - (id)validRequestorForSendType:(NSString*)sendType |
| 1004 returnType:(NSString*)returnType { | 1015 returnType:(NSString*)returnType { |
| 1005 BOOL canWrite = [sendType isEqualToString:NSStringPboardType] && | 1016 BOOL canWrite = [sendType isEqualToString:NSStringPboardType] && |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1183 | 1194 |
| 1184 // NSUserInterfaceValidations protocol implementation. | 1195 // NSUserInterfaceValidations protocol implementation. |
| 1185 | 1196 |
| 1186 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { | 1197 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { |
| 1187 if (!textInputClient_) | 1198 if (!textInputClient_) |
| 1188 return NO; | 1199 return NO; |
| 1189 | 1200 |
| 1190 SEL action = [item action]; | 1201 SEL action = [item action]; |
| 1191 | 1202 |
| 1192 if (action == @selector(undo:)) | 1203 if (action == @selector(undo:)) |
| 1193 return textInputClient_->IsEditCommandEnabled(IDS_APP_UNDO); | 1204 return textInputClient_->IsTextEditCommandEnabled( |
| 1205 ui::TextEditCommand::UNDO); |
| 1194 if (action == @selector(redo:)) | 1206 if (action == @selector(redo:)) |
| 1195 return textInputClient_->IsEditCommandEnabled(IDS_APP_REDO); | 1207 return textInputClient_->IsTextEditCommandEnabled( |
| 1208 ui::TextEditCommand::REDO); |
| 1196 if (action == @selector(cut:)) | 1209 if (action == @selector(cut:)) |
| 1197 return textInputClient_->IsEditCommandEnabled(IDS_APP_CUT); | 1210 return textInputClient_->IsTextEditCommandEnabled(ui::TextEditCommand::CUT); |
| 1198 if (action == @selector(copy:)) | 1211 if (action == @selector(copy:)) |
| 1199 return textInputClient_->IsEditCommandEnabled(IDS_APP_COPY); | 1212 return textInputClient_->IsTextEditCommandEnabled( |
| 1213 ui::TextEditCommand::COPY); |
| 1200 if (action == @selector(paste:)) | 1214 if (action == @selector(paste:)) |
| 1201 return textInputClient_->IsEditCommandEnabled(IDS_APP_PASTE); | 1215 return textInputClient_->IsTextEditCommandEnabled( |
| 1216 ui::TextEditCommand::PASTE); |
| 1202 if (action == @selector(selectAll:)) | 1217 if (action == @selector(selectAll:)) |
| 1203 return textInputClient_->IsEditCommandEnabled(IDS_APP_SELECT_ALL); | 1218 return textInputClient_->IsTextEditCommandEnabled( |
| 1219 ui::TextEditCommand::SELECT_ALL); |
| 1204 | 1220 |
| 1205 return NO; | 1221 return NO; |
| 1206 } | 1222 } |
| 1207 | 1223 |
| 1208 // NSDraggingSource protocol implementation. | 1224 // NSDraggingSource protocol implementation. |
| 1209 | 1225 |
| 1210 - (NSDragOperation)draggingSession:(NSDraggingSession*)session | 1226 - (NSDragOperation)draggingSession:(NSDraggingSession*)session |
| 1211 sourceOperationMaskForDraggingContext:(NSDraggingContext)context { | 1227 sourceOperationMaskForDraggingContext:(NSDraggingContext)context { |
| 1212 return NSDragOperationEvery; | 1228 return NSDragOperationEvery; |
| 1213 } | 1229 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1228 } | 1244 } |
| 1229 | 1245 |
| 1230 return [super accessibilityAttributeValue:attribute]; | 1246 return [super accessibilityAttributeValue:attribute]; |
| 1231 } | 1247 } |
| 1232 | 1248 |
| 1233 - (id)accessibilityHitTest:(NSPoint)point { | 1249 - (id)accessibilityHitTest:(NSPoint)point { |
| 1234 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; | 1250 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; |
| 1235 } | 1251 } |
| 1236 | 1252 |
| 1237 @end | 1253 @end |
| OLD | NEW |