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/renderer_host/render_widget_host_view_mac.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
6 | 6 |
7 #include <QuartzCore/QuartzCore.h> | 7 #include <QuartzCore/QuartzCore.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "content/browser/renderer_host/backing_store_mac.h" | 37 #include "content/browser/renderer_host/backing_store_mac.h" |
38 #include "content/browser/renderer_host/render_process_host.h" | 38 #include "content/browser/renderer_host/render_process_host.h" |
39 #include "content/browser/renderer_host/render_view_host.h" | 39 #include "content/browser/renderer_host/render_view_host.h" |
40 #include "content/browser/renderer_host/render_view_host_observer.h" | 40 #include "content/browser/renderer_host/render_view_host_observer.h" |
41 #include "content/browser/renderer_host/render_widget_host.h" | 41 #include "content/browser/renderer_host/render_widget_host.h" |
42 #import "content/browser/renderer_host/text_input_client_mac.h" | 42 #import "content/browser/renderer_host/text_input_client_mac.h" |
43 #include "content/common/edit_command.h" | 43 #include "content/common/edit_command.h" |
44 #include "content/common/gpu/gpu_messages.h" | 44 #include "content/common/gpu/gpu_messages.h" |
45 #include "content/common/native_web_keyboard_event.h" | 45 #include "content/common/native_web_keyboard_event.h" |
46 #include "content/common/plugin_messages.h" | 46 #include "content/common/plugin_messages.h" |
47 #include "content/common/view_messages.h" | |
48 #include "skia/ext/platform_canvas.h" | 47 #include "skia/ext/platform_canvas.h" |
49 #import "third_party/mozilla/ComplexTextInputPanel.h" | 48 #import "third_party/mozilla/ComplexTextInputPanel.h" |
50 #include "third_party/skia/include/core/SkColor.h" | 49 #include "third_party/skia/include/core/SkColor.h" |
51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
52 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
53 #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebInputEventFact
ory.h" | 52 #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebInputEventFact
ory.h" |
54 #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebScreenInfoFact
ory.h" | 53 #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebScreenInfoFact
ory.h" |
55 #include "ui/gfx/point.h" | 54 #include "ui/gfx/point.h" |
56 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 55 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
57 #include "ui/gfx/surface/io_surface_support_mac.h" | 56 #include "ui/gfx/surface/io_surface_support_mac.h" |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 // for WebKit purposes, but isn't considered a key event by the OS. | 789 // for WebKit purposes, but isn't considered a key event by the OS. |
791 if (event.type == WebInputEvent::RawKeyDown && | 790 if (event.type == WebInputEvent::RawKeyDown && |
792 [event.os_event type] == NSKeyDown) | 791 [event.os_event type] == NSKeyDown) |
793 return [cocoa_view_ postProcessEventForPluginIme:event.os_event]; | 792 return [cocoa_view_ postProcessEventForPluginIme:event.os_event]; |
794 return false; | 793 return false; |
795 } | 794 } |
796 | 795 |
797 void RenderWidgetHostViewMac::PluginImeCompositionCompleted( | 796 void RenderWidgetHostViewMac::PluginImeCompositionCompleted( |
798 const string16& text, int plugin_id) { | 797 const string16& text, int plugin_id) { |
799 if (render_widget_host_) { | 798 if (render_widget_host_) { |
800 render_widget_host_->Send(new ViewMsg_PluginImeCompositionCompleted( | 799 render_widget_host_->NotifyPluginImeCompletion(plugin_id, text); |
801 render_widget_host_->routing_id(), text, plugin_id)); | |
802 } | 800 } |
803 } | 801 } |
804 | 802 |
805 gfx::PluginWindowHandle | 803 gfx::PluginWindowHandle |
806 RenderWidgetHostViewMac::AllocateFakePluginWindowHandle(bool opaque, | 804 RenderWidgetHostViewMac::AllocateFakePluginWindowHandle(bool opaque, |
807 bool root) { | 805 bool root) { |
808 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 806 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
809 | 807 |
810 // |render_widget_host_| is set to NULL when |RWHVMac::Destroy()| has | 808 // |render_widget_host_| is set to NULL when |RWHVMac::Destroy()| has |
811 // completed. If |AllocateFakePluginWindowHandle()| is called after that, | 809 // completed. If |AllocateFakePluginWindowHandle()| is called after that, |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 render_widget_host_->Shutdown(); | 1103 render_widget_host_->Shutdown(); |
1106 // Do not touch any members at this point, |this| has been deleted. | 1104 // Do not touch any members at this point, |this| has been deleted. |
1107 } | 1105 } |
1108 | 1106 |
1109 gfx::Rect RenderWidgetHostViewMac::GetViewCocoaBounds() const { | 1107 gfx::Rect RenderWidgetHostViewMac::GetViewCocoaBounds() const { |
1110 return gfx::Rect(NSRectToCGRect([cocoa_view_ bounds])); | 1108 return gfx::Rect(NSRectToCGRect([cocoa_view_ bounds])); |
1111 } | 1109 } |
1112 | 1110 |
1113 void RenderWidgetHostViewMac::SetActive(bool active) { | 1111 void RenderWidgetHostViewMac::SetActive(bool active) { |
1114 if (render_widget_host_) { | 1112 if (render_widget_host_) { |
1115 render_widget_host_->Send(new ViewMsg_SetActive( | 1113 render_widget_host_->SetActive(active); |
1116 render_widget_host_->routing_id(), active)); | |
1117 } | 1114 } |
1118 if (HasFocus()) | 1115 if (HasFocus()) |
1119 SetTextInputActive(active); | 1116 SetTextInputActive(active); |
1120 if (!active) | 1117 if (!active) |
1121 [cocoa_view_ setPluginImeActive:NO]; | 1118 [cocoa_view_ setPluginImeActive:NO]; |
1122 } | 1119 } |
1123 | 1120 |
1124 void RenderWidgetHostViewMac::SetWindowVisibility(bool visible) { | 1121 void RenderWidgetHostViewMac::SetWindowVisibility(bool visible) { |
1125 if (render_widget_host_) { | 1122 if (render_widget_host_) { |
1126 render_widget_host_->Send(new ViewMsg_SetWindowVisibility( | 1123 render_widget_host_->SetWindowVisibility(visible); |
1127 render_widget_host_->routing_id(), visible)); | |
1128 } | 1124 } |
1129 } | 1125 } |
1130 | 1126 |
1131 void RenderWidgetHostViewMac::WindowFrameChanged() { | 1127 void RenderWidgetHostViewMac::WindowFrameChanged() { |
1132 if (render_widget_host_) { | 1128 if (render_widget_host_) { |
1133 render_widget_host_->Send(new ViewMsg_WindowFrameChanged( | 1129 render_widget_host_->NotifyWindowFrameChanged(GetRootWindowBounds(), |
1134 render_widget_host_->routing_id(), GetRootWindowBounds(), | 1130 GetViewBounds()); |
1135 GetViewBounds())); | |
1136 } | 1131 } |
1137 } | 1132 } |
1138 | 1133 |
1139 void RenderWidgetHostViewMac::SetBackground(const SkBitmap& background) { | 1134 void RenderWidgetHostViewMac::SetBackground(const SkBitmap& background) { |
1140 RenderWidgetHostView::SetBackground(background); | 1135 RenderWidgetHostView::SetBackground(background); |
1141 if (render_widget_host_) | 1136 if (render_widget_host_) |
1142 render_widget_host_->Send(new ViewMsg_SetBackground( | 1137 render_widget_host_->SetBackground(background); |
1143 render_widget_host_->routing_id(), background)); | |
1144 } | 1138 } |
1145 | 1139 |
1146 void RenderWidgetHostViewMac::OnAccessibilityNotifications( | 1140 void RenderWidgetHostViewMac::OnAccessibilityNotifications( |
1147 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { | 1141 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { |
1148 if (!browser_accessibility_manager_.get()) { | 1142 if (!browser_accessibility_manager_.get()) { |
1149 browser_accessibility_manager_.reset( | 1143 browser_accessibility_manager_.reset( |
1150 BrowserAccessibilityManager::CreateEmptyDocument( | 1144 BrowserAccessibilityManager::CreateEmptyDocument( |
1151 cocoa_view_, static_cast<WebAccessibility::State>(0), NULL)); | 1145 cocoa_view_, static_cast<WebAccessibility::State>(0), NULL)); |
1152 } | 1146 } |
1153 browser_accessibility_manager_->OnAccessibilityNotifications(params); | 1147 browser_accessibility_manager_->OnAccessibilityNotifications(params); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1470 // -doCommandBySelector: (invoked by the call to -interpretKeyEvents: above) | 1464 // -doCommandBySelector: (invoked by the call to -interpretKeyEvents: above) |
1471 // enqueued edit commands, then in order to let webkit handle them | 1465 // enqueued edit commands, then in order to let webkit handle them |
1472 // correctly, we need to send the real key event and corresponding edit | 1466 // correctly, we need to send the real key event and corresponding edit |
1473 // commands after processing the input method result. | 1467 // commands after processing the input method result. |
1474 // We shouldn't do this if a new marked text was set by the input method, | 1468 // We shouldn't do this if a new marked text was set by the input method, |
1475 // otherwise the new marked text might be cancelled by webkit. | 1469 // otherwise the new marked text might be cancelled by webkit. |
1476 if (hasEditCommands_ && !hasMarkedText_) | 1470 if (hasEditCommands_ && !hasMarkedText_) |
1477 delayEventUntilAfterImeCompostion = YES; | 1471 delayEventUntilAfterImeCompostion = YES; |
1478 } else { | 1472 } else { |
1479 if (!editCommands_.empty()) { | 1473 if (!editCommands_.empty()) { |
1480 widgetHost->Send(new ViewMsg_SetEditCommandsForNextKeyEvent( | 1474 widgetHost->SetEditCommandsForNextKeyEvent(editCommands_); |
1481 widgetHost->routing_id(), editCommands_)); | |
1482 } | 1475 } |
1483 widgetHost->ForwardKeyboardEvent(event); | 1476 widgetHost->ForwardKeyboardEvent(event); |
1484 } | 1477 } |
1485 | 1478 |
1486 // Calling ForwardKeyboardEvent() could have destroyed the widget. When the | 1479 // Calling ForwardKeyboardEvent() could have destroyed the widget. When the |
1487 // widget was destroyed, |renderWidgetHostView_->render_widget_host_| will | 1480 // widget was destroyed, |renderWidgetHostView_->render_widget_host_| will |
1488 // be set to NULL. So we check it here and return immediately if it's NULL. | 1481 // be set to NULL. So we check it here and return immediately if it's NULL. |
1489 if (!renderWidgetHostView_->render_widget_host_) | 1482 if (!renderWidgetHostView_->render_widget_host_) |
1490 return; | 1483 return; |
1491 | 1484 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1536 // event to balance it. | 1529 // event to balance it. |
1537 NativeWebKeyboardEvent fakeEvent = event; | 1530 NativeWebKeyboardEvent fakeEvent = event; |
1538 fakeEvent.type = WebKit::WebInputEvent::KeyUp; | 1531 fakeEvent.type = WebKit::WebInputEvent::KeyUp; |
1539 fakeEvent.skip_in_browser = true; | 1532 fakeEvent.skip_in_browser = true; |
1540 widgetHost->ForwardKeyboardEvent(fakeEvent); | 1533 widgetHost->ForwardKeyboardEvent(fakeEvent); |
1541 // Not checking |renderWidgetHostView_->render_widget_host_| here because | 1534 // Not checking |renderWidgetHostView_->render_widget_host_| here because |
1542 // a key event with |skip_in_browser| == true won't be handled by browser, | 1535 // a key event with |skip_in_browser| == true won't be handled by browser, |
1543 // thus it won't destroy the widget. | 1536 // thus it won't destroy the widget. |
1544 | 1537 |
1545 if (!editCommands_.empty()) { | 1538 if (!editCommands_.empty()) { |
1546 widgetHost->Send(new ViewMsg_SetEditCommandsForNextKeyEvent( | 1539 widgetHost->SetEditCommandsForNextKeyEvent(editCommands_); |
1547 widgetHost->routing_id(), editCommands_)); | |
1548 } | 1540 } |
1549 widgetHost->ForwardKeyboardEvent(event); | 1541 widgetHost->ForwardKeyboardEvent(event); |
1550 | 1542 |
1551 // Calling ForwardKeyboardEvent() could have destroyed the widget. When the | 1543 // Calling ForwardKeyboardEvent() could have destroyed the widget. When the |
1552 // widget was destroyed, |renderWidgetHostView_->render_widget_host_| will | 1544 // widget was destroyed, |renderWidgetHostView_->render_widget_host_| will |
1553 // be set to NULL. So we check it here and return immediately if it's NULL. | 1545 // be set to NULL. So we check it here and return immediately if it's NULL. |
1554 if (!renderWidgetHostView_->render_widget_host_) | 1546 if (!renderWidgetHostView_->render_widget_host_) |
1555 return; | 1547 return; |
1556 } | 1548 } |
1557 | 1549 |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2082 DCHECK(focused_item_cocoa); | 2074 DCHECK(focused_item_cocoa); |
2083 if (focused_item_cocoa) | 2075 if (focused_item_cocoa) |
2084 return focused_item_cocoa; | 2076 return focused_item_cocoa; |
2085 } | 2077 } |
2086 } | 2078 } |
2087 return [super accessibilityFocusedUIElement]; | 2079 return [super accessibilityFocusedUIElement]; |
2088 } | 2080 } |
2089 | 2081 |
2090 - (void)doDefaultAction:(int32)accessibilityObjectId { | 2082 - (void)doDefaultAction:(int32)accessibilityObjectId { |
2091 RenderWidgetHost* rwh = renderWidgetHostView_->render_widget_host_; | 2083 RenderWidgetHost* rwh = renderWidgetHostView_->render_widget_host_; |
2092 rwh->Send(new ViewMsg_AccessibilityDoDefaultAction( | 2084 rwh->AccessibilityDoDefaultAction(accessibilityObjectId); |
2093 rwh->routing_id(), accessibilityObjectId)); | |
2094 } | 2085 } |
2095 | 2086 |
2096 // Convert a web accessibility's location in web coordinates into a cocoa | 2087 // Convert a web accessibility's location in web coordinates into a cocoa |
2097 // screen coordinate. | 2088 // screen coordinate. |
2098 - (NSPoint)accessibilityPointInScreen: | 2089 - (NSPoint)accessibilityPointInScreen: |
2099 (BrowserAccessibilityCocoa*)accessibility { | 2090 (BrowserAccessibilityCocoa*)accessibility { |
2100 NSPoint origin = [accessibility origin]; | 2091 NSPoint origin = [accessibility origin]; |
2101 NSSize size = [[accessibility size] sizeValue]; | 2092 NSSize size = [[accessibility size] sizeValue]; |
2102 origin.y = NSHeight([self bounds]) - origin.y; | 2093 origin.y = NSHeight([self bounds]) - origin.y; |
2103 NSPoint originInWindow = [self convertPoint:origin toView:nil]; | 2094 NSPoint originInWindow = [self convertPoint:origin toView:nil]; |
2104 NSPoint originInScreen = [[self window] convertBaseToScreen:originInWindow]; | 2095 NSPoint originInScreen = [[self window] convertBaseToScreen:originInWindow]; |
2105 originInScreen.y = originInScreen.y - size.height; | 2096 originInScreen.y = originInScreen.y - size.height; |
2106 return originInScreen; | 2097 return originInScreen; |
2107 } | 2098 } |
2108 | 2099 |
2109 - (void)setAccessibilityFocus:(BOOL)focus | 2100 - (void)setAccessibilityFocus:(BOOL)focus |
2110 accessibilityId:(int32)accessibilityObjectId { | 2101 accessibilityId:(int32)accessibilityObjectId { |
2111 if (focus) { | 2102 if (focus) { |
2112 RenderWidgetHost* rwh = renderWidgetHostView_->render_widget_host_; | 2103 RenderWidgetHost* rwh = renderWidgetHostView_->render_widget_host_; |
2113 rwh->Send(new ViewMsg_SetAccessibilityFocus( | 2104 rwh->AccessibilitySetFocus(accessibilityObjectId); |
2114 rwh->routing_id(), accessibilityObjectId)); | |
2115 } | 2105 } |
2116 } | 2106 } |
2117 | 2107 |
2118 - (void)performShowMenuAction:(BrowserAccessibilityCocoa*)accessibility { | 2108 - (void)performShowMenuAction:(BrowserAccessibilityCocoa*)accessibility { |
2119 // Performs a right click copying WebKit's | 2109 // Performs a right click copying WebKit's |
2120 // accessibilityPerformShowMenuAction. | 2110 // accessibilityPerformShowMenuAction. |
2121 NSPoint location = [self accessibilityPointInScreen:accessibility]; | 2111 NSPoint location = [self accessibilityPointInScreen:accessibility]; |
2122 NSSize size = [[accessibility size] sizeValue]; | 2112 NSSize size = [[accessibility size] sizeValue]; |
2123 location = [[self window] convertScreenToBase:location]; | 2113 location = [[self window] convertScreenToBase:location]; |
2124 location.x += size.width/2; | 2114 location.x += size.width/2; |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2610 // it here. | 2600 // it here. |
2611 if (handlingKeyDown_) { | 2601 if (handlingKeyDown_) { |
2612 hasEditCommands_ = YES; | 2602 hasEditCommands_ = YES; |
2613 // We ignore commands that insert characters, because this was causing | 2603 // We ignore commands that insert characters, because this was causing |
2614 // strange behavior (e.g. tab always inserted a tab rather than moving to | 2604 // strange behavior (e.g. tab always inserted a tab rather than moving to |
2615 // the next field on the page). | 2605 // the next field on the page). |
2616 if (!StartsWithASCII(command, "insert", false)) | 2606 if (!StartsWithASCII(command, "insert", false)) |
2617 editCommands_.push_back(EditCommand(command, "")); | 2607 editCommands_.push_back(EditCommand(command, "")); |
2618 } else { | 2608 } else { |
2619 RenderWidgetHost* rwh = renderWidgetHostView_->render_widget_host_; | 2609 RenderWidgetHost* rwh = renderWidgetHostView_->render_widget_host_; |
2620 rwh->Send(new ViewMsg_ExecuteEditCommand(rwh->routing_id(), command, "")); | 2610 rwh->ExecuteEditCommand(command, ""); |
2621 } | 2611 } |
2622 } | 2612 } |
2623 | 2613 |
2624 - (void)insertText:(id)string replacementRange:(NSRange)replacementRange { | 2614 - (void)insertText:(id)string replacementRange:(NSRange)replacementRange { |
2625 // An input method has characters to be inserted. | 2615 // An input method has characters to be inserted. |
2626 // Same as Linux, Mac calls this method not only: | 2616 // Same as Linux, Mac calls this method not only: |
2627 // * when an input method finishs composing text, but also; | 2617 // * when an input method finishs composing text, but also; |
2628 // * when we type an ASCII character (without using input methods). | 2618 // * when we type an ASCII character (without using input methods). |
2629 // When we aren't using input methods, we should send the given character as | 2619 // When we aren't using input methods, we should send the given character as |
2630 // a Char event so it is dispatched to an onkeypress() event handler of | 2620 // a Char event so it is dispatched to an onkeypress() event handler of |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2683 event.button = WebMouseEvent::ButtonLeft; | 2673 event.button = WebMouseEvent::ButtonLeft; |
2684 if (renderWidgetHostView_->render_widget_host_) | 2674 if (renderWidgetHostView_->render_widget_host_) |
2685 renderWidgetHostView_->render_widget_host_->ForwardMouseEvent(event); | 2675 renderWidgetHostView_->render_widget_host_->ForwardMouseEvent(event); |
2686 | 2676 |
2687 hasOpenMouseDown_ = NO; | 2677 hasOpenMouseDown_ = NO; |
2688 } | 2678 } |
2689 } | 2679 } |
2690 | 2680 |
2691 - (void)undo:(id)sender { | 2681 - (void)undo:(id)sender { |
2692 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { | 2682 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { |
2693 static_cast<RenderViewHost*>(renderWidgetHostView_->render_widget_host_)-> | 2683 renderWidgetHostView_->render_widget_host_->Undo(); |
2694 Undo(); | |
2695 } | 2684 } |
2696 } | 2685 } |
2697 | 2686 |
2698 - (void)redo:(id)sender { | 2687 - (void)redo:(id)sender { |
2699 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { | 2688 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { |
2700 static_cast<RenderViewHost*>(renderWidgetHostView_->render_widget_host_)-> | 2689 renderWidgetHostView_->render_widget_host_->Redo(); |
2701 Redo(); | |
2702 } | 2690 } |
2703 } | 2691 } |
2704 | 2692 |
2705 - (void)cut:(id)sender { | 2693 - (void)cut:(id)sender { |
2706 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { | 2694 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { |
2707 static_cast<RenderViewHost*>(renderWidgetHostView_->render_widget_host_)-> | 2695 renderWidgetHostView_->render_widget_host_->Cut(); |
2708 Cut(); | |
2709 } | 2696 } |
2710 } | 2697 } |
2711 | 2698 |
2712 - (void)copy:(id)sender { | 2699 - (void)copy:(id)sender { |
2713 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { | 2700 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { |
2714 static_cast<RenderViewHost*>(renderWidgetHostView_->render_widget_host_)-> | 2701 renderWidgetHostView_->render_widget_host_->Copy(); |
2715 Copy(); | |
2716 } | 2702 } |
2717 } | 2703 } |
2718 | 2704 |
2719 - (void)copyToFindPboard:(id)sender { | 2705 - (void)copyToFindPboard:(id)sender { |
2720 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { | 2706 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { |
2721 static_cast<RenderViewHost*>(renderWidgetHostView_->render_widget_host_)-> | 2707 renderWidgetHostView_->render_widget_host_->CopyToFindPboard(); |
2722 CopyToFindPboard(); | |
2723 } | 2708 } |
2724 } | 2709 } |
2725 | 2710 |
2726 - (void)paste:(id)sender { | 2711 - (void)paste:(id)sender { |
2727 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { | 2712 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { |
2728 static_cast<RenderViewHost*>(renderWidgetHostView_->render_widget_host_)-> | 2713 renderWidgetHostView_->render_widget_host_->Paste(); |
2729 Paste(); | |
2730 } | 2714 } |
2731 } | 2715 } |
2732 | 2716 |
2733 - (void)pasteAsPlainText:(id)sender { | 2717 - (void)pasteAsPlainText:(id)sender { |
2734 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { | 2718 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { |
2735 RenderWidgetHost* rwh = renderWidgetHostView_->render_widget_host_; | 2719 RenderWidgetHost* rwh = renderWidgetHostView_->render_widget_host_; |
2736 rwh->Send(new ViewMsg_ExecuteEditCommand( | 2720 rwh->ExecuteEditCommand("PasteAndMatchStyle", ""); |
2737 rwh->routing_id(), "PasteAndMatchStyle", "")); | |
2738 } | 2721 } |
2739 } | 2722 } |
2740 | 2723 |
2741 - (void)cancelComposition { | 2724 - (void)cancelComposition { |
2742 if (!hasMarkedText_) | 2725 if (!hasMarkedText_) |
2743 return; | 2726 return; |
2744 | 2727 |
2745 // Cancel the ongoing composition. [NSInputManager markedTextAbandoned:] | 2728 // Cancel the ongoing composition. [NSInputManager markedTextAbandoned:] |
2746 // doesn't call any NSTextInput functions, such as setMarkedText or | 2729 // doesn't call any NSTextInput functions, such as setMarkedText or |
2747 // insertText. So, we need to send an IPC message to a renderer so it can | 2730 // insertText. So, we need to send an IPC message to a renderer so it can |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2837 requestor = [super validRequestorForSendType:sendType | 2820 requestor = [super validRequestorForSendType:sendType |
2838 returnType:returnType]; | 2821 returnType:returnType]; |
2839 } | 2822 } |
2840 return requestor; | 2823 return requestor; |
2841 } | 2824 } |
2842 | 2825 |
2843 - (void)viewWillStartLiveResize { | 2826 - (void)viewWillStartLiveResize { |
2844 [super viewWillStartLiveResize]; | 2827 [super viewWillStartLiveResize]; |
2845 RenderWidgetHost* widget = renderWidgetHostView_->render_widget_host_; | 2828 RenderWidgetHost* widget = renderWidgetHostView_->render_widget_host_; |
2846 if (widget) | 2829 if (widget) |
2847 widget->Send(new ViewMsg_SetInLiveResize(widget->routing_id(), true)); | 2830 widget->NotifyInLiveResize(true); |
2848 } | 2831 } |
2849 | 2832 |
2850 - (void)viewDidEndLiveResize { | 2833 - (void)viewDidEndLiveResize { |
2851 [super viewDidEndLiveResize]; | 2834 [super viewDidEndLiveResize]; |
2852 RenderWidgetHost* widget = renderWidgetHostView_->render_widget_host_; | 2835 RenderWidgetHost* widget = renderWidgetHostView_->render_widget_host_; |
2853 if (widget) | 2836 if (widget) |
2854 widget->Send(new ViewMsg_SetInLiveResize(widget->routing_id(), false)); | 2837 widget->NotifyInLiveResize(false); |
2855 } | 2838 } |
2856 | 2839 |
2857 @end | 2840 @end |
2858 | 2841 |
2859 // | 2842 // |
2860 // Supporting application services | 2843 // Supporting application services |
2861 // | 2844 // |
2862 @implementation RenderWidgetHostViewCocoa(NSServicesRequests) | 2845 @implementation RenderWidgetHostViewCocoa(NSServicesRequests) |
2863 | 2846 |
2864 - (BOOL)writeSelectionToPasteboard:(NSPasteboard*)pboard | 2847 - (BOOL)writeSelectionToPasteboard:(NSPasteboard*)pboard |
(...skipping 13 matching lines...) Expand all Loading... |
2878 if (!string) return NO; | 2861 if (!string) return NO; |
2879 | 2862 |
2880 // If the user is currently using an IME, confirm the IME input, | 2863 // If the user is currently using an IME, confirm the IME input, |
2881 // and then insert the text from the service, the same as TextEdit and Safari. | 2864 // and then insert the text from the service, the same as TextEdit and Safari. |
2882 [self confirmComposition]; | 2865 [self confirmComposition]; |
2883 [self insertText:string]; | 2866 [self insertText:string]; |
2884 return YES; | 2867 return YES; |
2885 } | 2868 } |
2886 | 2869 |
2887 @end | 2870 @end |
OLD | NEW |