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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 9473001: Extract minimal RenderViewHost interface for embedders, leaving (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to LKGR, fix a weird runtime issue. Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "content/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 "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // static 224 // static
225 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( 225 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo(
226 WebKit::WebScreenInfo* results) { 226 WebKit::WebScreenInfo* results) {
227 *results = WebKit::WebScreenInfoFactory::screenInfo(NULL); 227 *results = WebKit::WebScreenInfoFactory::screenInfo(NULL);
228 } 228 }
229 229
230 /////////////////////////////////////////////////////////////////////////////// 230 ///////////////////////////////////////////////////////////////////////////////
231 // RenderWidgetHostViewMac, public: 231 // RenderWidgetHostViewMac, public:
232 232
233 RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget) 233 RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget)
234 : about_to_validate_and_paint_(false), 234 : render_widget_host_(widget->AsRWHImpl()),
235 about_to_validate_and_paint_(false),
235 call_set_needs_display_in_rect_pending_(false), 236 call_set_needs_display_in_rect_pending_(false),
236 last_frame_was_accelerated_(false), 237 last_frame_was_accelerated_(false),
237 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), 238 text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
238 can_compose_inline_(true), 239 can_compose_inline_(true),
239 is_loading_(false), 240 is_loading_(false),
240 is_hidden_(false), 241 is_hidden_(false),
241 weak_factory_(this), 242 weak_factory_(this),
242 accelerated_compositing_active_(false), 243 accelerated_compositing_active_(false),
243 needs_gpu_visibility_update_after_repaint_(false), 244 needs_gpu_visibility_update_after_repaint_(false),
244 compositing_surface_(gfx::kNullPluginWindow) { 245 compositing_surface_(gfx::kNullPluginWindow) {
245 render_widget_host_ = static_cast<RenderWidgetHostImpl*>(widget);
246
247 // |cocoa_view_| owns us and we will be deleted when |cocoa_view_| 246 // |cocoa_view_| owns us and we will be deleted when |cocoa_view_|
248 // goes away. Since we autorelease it, our caller must put 247 // goes away. Since we autorelease it, our caller must put
249 // |GetNativeView()| into the view hierarchy right after calling us. 248 // |GetNativeView()| into the view hierarchy right after calling us.
250 cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc] 249 cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc]
251 initWithRenderWidgetHostViewMac:this] autorelease]; 250 initWithRenderWidgetHostViewMac:this] autorelease];
252 render_widget_host_->SetView(this); 251 render_widget_host_->SetView(this);
253 } 252 }
254 253
255 RenderWidgetHostViewMac::~RenderWidgetHostViewMac() { 254 RenderWidgetHostViewMac::~RenderWidgetHostViewMac() {
256 UnlockMouse(); 255 UnlockMouse();
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 if (event.type == WebInputEvent::RawKeyDown && 763 if (event.type == WebInputEvent::RawKeyDown &&
765 [event.os_event type] == NSKeyDown) 764 [event.os_event type] == NSKeyDown)
766 return [cocoa_view_ postProcessEventForPluginIme:event.os_event]; 765 return [cocoa_view_ postProcessEventForPluginIme:event.os_event];
767 return false; 766 return false;
768 } 767 }
769 768
770 void RenderWidgetHostViewMac::PluginImeCompositionCompleted( 769 void RenderWidgetHostViewMac::PluginImeCompositionCompleted(
771 const string16& text, int plugin_id) { 770 const string16& text, int plugin_id) {
772 if (render_widget_host_) { 771 if (render_widget_host_) {
773 render_widget_host_->Send(new ViewMsg_PluginImeCompositionCompleted( 772 render_widget_host_->Send(new ViewMsg_PluginImeCompositionCompleted(
774 render_widget_host_->routing_id(), text, plugin_id)); 773 render_widget_host_->GetRoutingID(), text, plugin_id));
775 } 774 }
776 } 775 }
777 776
778 gfx::PluginWindowHandle 777 gfx::PluginWindowHandle
779 RenderWidgetHostViewMac::AllocateFakePluginWindowHandle(bool opaque, 778 RenderWidgetHostViewMac::AllocateFakePluginWindowHandle(bool opaque,
780 bool root) { 779 bool root) {
781 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 780 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
782 781
783 // |render_widget_host_| is set to NULL when |RWHVMac::Destroy()| has 782 // |render_widget_host_| is set to NULL when |RWHVMac::Destroy()| has
784 // completed. If |AllocateFakePluginWindowHandle()| is called after that, 783 // completed. If |AllocateFakePluginWindowHandle()| is called after that,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 "RenderWidgetHostViewMac::HandleDelayedGpuViewHiding"); 962 "RenderWidgetHostViewMac::HandleDelayedGpuViewHiding");
964 if (needs_gpu_visibility_update_after_repaint_) { 963 if (needs_gpu_visibility_update_after_repaint_) {
965 UpdateRootGpuViewVisibility(false); 964 UpdateRootGpuViewVisibility(false);
966 needs_gpu_visibility_update_after_repaint_ = false; 965 needs_gpu_visibility_update_after_repaint_ = false;
967 } 966 }
968 } 967 }
969 968
970 void RenderWidgetHostViewMac::OnAcceleratedCompositingStateChange() { 969 void RenderWidgetHostViewMac::OnAcceleratedCompositingStateChange() {
971 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 970 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
972 bool activated = 971 bool activated =
973 GetRenderWidgetHostImpl()->is_accelerated_compositing_active(); 972 GetRenderWidgetHost()->AsRWHImpl()->is_accelerated_compositing_active();
974 bool changed = accelerated_compositing_active_ != activated; 973 bool changed = accelerated_compositing_active_ != activated;
975 accelerated_compositing_active_ = activated; 974 accelerated_compositing_active_ = activated;
976 if (!changed) 975 if (!changed)
977 return; 976 return;
978 977
979 TRACE_EVENT1("renderer_host", 978 TRACE_EVENT1("renderer_host",
980 "RenderWidgetHostViewMac::OnAcceleratedCompositingStateChange", 979 "RenderWidgetHostViewMac::OnAcceleratedCompositingStateChange",
981 "active", accelerated_compositing_active_); 980 "active", accelerated_compositing_active_);
982 if (accelerated_compositing_active_) { 981 if (accelerated_compositing_active_) {
983 UpdateRootGpuViewVisibility(accelerated_compositing_active_); 982 UpdateRootGpuViewVisibility(accelerated_compositing_active_);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 SetTextInputActive(active); 1097 SetTextInputActive(active);
1099 if (!active) { 1098 if (!active) {
1100 [cocoa_view_ setPluginImeActive:NO]; 1099 [cocoa_view_ setPluginImeActive:NO];
1101 UnlockMouse(); 1100 UnlockMouse();
1102 } 1101 }
1103 } 1102 }
1104 1103
1105 void RenderWidgetHostViewMac::SetWindowVisibility(bool visible) { 1104 void RenderWidgetHostViewMac::SetWindowVisibility(bool visible) {
1106 if (render_widget_host_) { 1105 if (render_widget_host_) {
1107 render_widget_host_->Send(new ViewMsg_SetWindowVisibility( 1106 render_widget_host_->Send(new ViewMsg_SetWindowVisibility(
1108 render_widget_host_->routing_id(), visible)); 1107 render_widget_host_->GetRoutingID(), visible));
1109 } 1108 }
1110 } 1109 }
1111 1110
1112 void RenderWidgetHostViewMac::WindowFrameChanged() { 1111 void RenderWidgetHostViewMac::WindowFrameChanged() {
1113 if (render_widget_host_) { 1112 if (render_widget_host_) {
1114 render_widget_host_->Send(new ViewMsg_WindowFrameChanged( 1113 render_widget_host_->Send(new ViewMsg_WindowFrameChanged(
1115 render_widget_host_->routing_id(), GetRootWindowBounds(), 1114 render_widget_host_->GetRoutingID(), GetRootWindowBounds(),
1116 GetViewBounds())); 1115 GetViewBounds()));
1117 } 1116 }
1118 } 1117 }
1119 1118
1120 void RenderWidgetHostViewMac::SetBackground(const SkBitmap& background) { 1119 void RenderWidgetHostViewMac::SetBackground(const SkBitmap& background) {
1121 content::RenderWidgetHostViewBase::SetBackground(background); 1120 content::RenderWidgetHostViewBase::SetBackground(background);
1122 if (render_widget_host_) 1121 if (render_widget_host_)
1123 render_widget_host_->Send(new ViewMsg_SetBackground( 1122 render_widget_host_->Send(new ViewMsg_SetBackground(
1124 render_widget_host_->routing_id(), background)); 1123 render_widget_host_->GetRoutingID(), background));
1125 } 1124 }
1126 1125
1127 void RenderWidgetHostViewMac::OnAccessibilityNotifications( 1126 void RenderWidgetHostViewMac::OnAccessibilityNotifications(
1128 const std::vector<AccessibilityHostMsg_NotificationParams>& params) { 1127 const std::vector<AccessibilityHostMsg_NotificationParams>& params) {
1129 if (!GetBrowserAccessibilityManager()) { 1128 if (!GetBrowserAccessibilityManager()) {
1130 SetBrowserAccessibilityManager( 1129 SetBrowserAccessibilityManager(
1131 BrowserAccessibilityManager::CreateEmptyDocument( 1130 BrowserAccessibilityManager::CreateEmptyDocument(
1132 cocoa_view_, static_cast<WebAccessibility::State>(0), NULL)); 1131 cocoa_view_, static_cast<WebAccessibility::State>(0), NULL));
1133 } 1132 }
1134 GetBrowserAccessibilityManager()->OnAccessibilityNotifications(params); 1133 GetBrowserAccessibilityManager()->OnAccessibilityNotifications(params);
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 // enqueued edit commands, then in order to let webkit handle them 1537 // enqueued edit commands, then in order to let webkit handle them
1539 // correctly, we need to send the real key event and corresponding edit 1538 // correctly, we need to send the real key event and corresponding edit
1540 // commands after processing the input method result. 1539 // commands after processing the input method result.
1541 // We shouldn't do this if a new marked text was set by the input method, 1540 // We shouldn't do this if a new marked text was set by the input method,
1542 // otherwise the new marked text might be cancelled by webkit. 1541 // otherwise the new marked text might be cancelled by webkit.
1543 if (hasEditCommands_ && !hasMarkedText_) 1542 if (hasEditCommands_ && !hasMarkedText_)
1544 delayEventUntilAfterImeCompostion = YES; 1543 delayEventUntilAfterImeCompostion = YES;
1545 } else { 1544 } else {
1546 if (!editCommands_.empty()) { 1545 if (!editCommands_.empty()) {
1547 widgetHost->Send(new ViewMsg_SetEditCommandsForNextKeyEvent( 1546 widgetHost->Send(new ViewMsg_SetEditCommandsForNextKeyEvent(
1548 widgetHost->routing_id(), editCommands_)); 1547 widgetHost->GetRoutingID(), editCommands_));
1549 } 1548 }
1550 widgetHost->ForwardKeyboardEvent(event); 1549 widgetHost->ForwardKeyboardEvent(event);
1551 } 1550 }
1552 1551
1553 // Calling ForwardKeyboardEvent() could have destroyed the widget. When the 1552 // Calling ForwardKeyboardEvent() could have destroyed the widget. When the
1554 // widget was destroyed, |renderWidgetHostView_->render_widget_host_| will 1553 // widget was destroyed, |renderWidgetHostView_->render_widget_host_| will
1555 // be set to NULL. So we check it here and return immediately if it's NULL. 1554 // be set to NULL. So we check it here and return immediately if it's NULL.
1556 if (!renderWidgetHostView_->render_widget_host_) 1555 if (!renderWidgetHostView_->render_widget_host_)
1557 return; 1556 return;
1558 1557
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 NativeWebKeyboardEvent fakeEvent = event; 1603 NativeWebKeyboardEvent fakeEvent = event;
1605 fakeEvent.type = WebKit::WebInputEvent::KeyUp; 1604 fakeEvent.type = WebKit::WebInputEvent::KeyUp;
1606 fakeEvent.skip_in_browser = true; 1605 fakeEvent.skip_in_browser = true;
1607 widgetHost->ForwardKeyboardEvent(fakeEvent); 1606 widgetHost->ForwardKeyboardEvent(fakeEvent);
1608 // Not checking |renderWidgetHostView_->render_widget_host_| here because 1607 // Not checking |renderWidgetHostView_->render_widget_host_| here because
1609 // a key event with |skip_in_browser| == true won't be handled by browser, 1608 // a key event with |skip_in_browser| == true won't be handled by browser,
1610 // thus it won't destroy the widget. 1609 // thus it won't destroy the widget.
1611 1610
1612 if (!editCommands_.empty()) { 1611 if (!editCommands_.empty()) {
1613 widgetHost->Send(new ViewMsg_SetEditCommandsForNextKeyEvent( 1612 widgetHost->Send(new ViewMsg_SetEditCommandsForNextKeyEvent(
1614 widgetHost->routing_id(), editCommands_)); 1613 widgetHost->GetRoutingID(), editCommands_));
1615 } 1614 }
1616 widgetHost->ForwardKeyboardEvent(event); 1615 widgetHost->ForwardKeyboardEvent(event);
1617 1616
1618 // Calling ForwardKeyboardEvent() could have destroyed the widget. When the 1617 // Calling ForwardKeyboardEvent() could have destroyed the widget. When the
1619 // widget was destroyed, |renderWidgetHostView_->render_widget_host_| will 1618 // widget was destroyed, |renderWidgetHostView_->render_widget_host_| will
1620 // be set to NULL. So we check it here and return immediately if it's NULL. 1619 // be set to NULL. So we check it here and return immediately if it's NULL.
1621 if (!renderWidgetHostView_->render_widget_host_) 1620 if (!renderWidgetHostView_->render_widget_host_)
1622 return; 1621 return;
1623 } 1622 }
1624 1623
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
2032 if (focused_item_cocoa) 2031 if (focused_item_cocoa)
2033 return focused_item_cocoa; 2032 return focused_item_cocoa;
2034 } 2033 }
2035 } 2034 }
2036 return [super accessibilityFocusedUIElement]; 2035 return [super accessibilityFocusedUIElement];
2037 } 2036 }
2038 2037
2039 - (void)doDefaultAction:(int32)accessibilityObjectId { 2038 - (void)doDefaultAction:(int32)accessibilityObjectId {
2040 RenderWidgetHostImpl* rwh = renderWidgetHostView_->render_widget_host_; 2039 RenderWidgetHostImpl* rwh = renderWidgetHostView_->render_widget_host_;
2041 rwh->Send(new AccessibilityMsg_DoDefaultAction( 2040 rwh->Send(new AccessibilityMsg_DoDefaultAction(
2042 rwh->routing_id(), accessibilityObjectId)); 2041 rwh->GetRoutingID(), accessibilityObjectId));
2043 } 2042 }
2044 2043
2045 // Convert a web accessibility's location in web coordinates into a cocoa 2044 // Convert a web accessibility's location in web coordinates into a cocoa
2046 // screen coordinate. 2045 // screen coordinate.
2047 - (NSPoint)accessibilityPointInScreen: 2046 - (NSPoint)accessibilityPointInScreen:
2048 (BrowserAccessibilityCocoa*)accessibility { 2047 (BrowserAccessibilityCocoa*)accessibility {
2049 NSPoint origin = [accessibility origin]; 2048 NSPoint origin = [accessibility origin];
2050 NSSize size = [[accessibility size] sizeValue]; 2049 NSSize size = [[accessibility size] sizeValue];
2051 origin.y = NSHeight([self bounds]) - origin.y; 2050 origin.y = NSHeight([self bounds]) - origin.y;
2052 NSPoint originInWindow = [self convertPoint:origin toView:nil]; 2051 NSPoint originInWindow = [self convertPoint:origin toView:nil];
2053 NSPoint originInScreen = [[self window] convertBaseToScreen:originInWindow]; 2052 NSPoint originInScreen = [[self window] convertBaseToScreen:originInWindow];
2054 originInScreen.y = originInScreen.y - size.height; 2053 originInScreen.y = originInScreen.y - size.height;
2055 return originInScreen; 2054 return originInScreen;
2056 } 2055 }
2057 2056
2058 - (void)setAccessibilityFocus:(BOOL)focus 2057 - (void)setAccessibilityFocus:(BOOL)focus
2059 accessibilityId:(int32)accessibilityObjectId { 2058 accessibilityId:(int32)accessibilityObjectId {
2060 if (focus) { 2059 if (focus) {
2061 RenderWidgetHostImpl* rwh = renderWidgetHostView_->render_widget_host_; 2060 RenderWidgetHostImpl* rwh = renderWidgetHostView_->render_widget_host_;
2062 rwh->Send(new AccessibilityMsg_SetFocus( 2061 rwh->Send(new AccessibilityMsg_SetFocus(
2063 rwh->routing_id(), accessibilityObjectId)); 2062 rwh->GetRoutingID(), accessibilityObjectId));
2064 } 2063 }
2065 } 2064 }
2066 2065
2067 - (void)performShowMenuAction:(BrowserAccessibilityCocoa*)accessibility { 2066 - (void)performShowMenuAction:(BrowserAccessibilityCocoa*)accessibility {
2068 // Performs a right click copying WebKit's 2067 // Performs a right click copying WebKit's
2069 // accessibilityPerformShowMenuAction. 2068 // accessibilityPerformShowMenuAction.
2070 NSPoint location = [self accessibilityPointInScreen:accessibility]; 2069 NSPoint location = [self accessibilityPointInScreen:accessibility];
2071 NSSize size = [[accessibility size] sizeValue]; 2070 NSSize size = [[accessibility size] sizeValue];
2072 location = [[self window] convertScreenToBase:location]; 2071 location = [[self window] convertScreenToBase:location];
2073 location.x += size.width/2; 2072 location.x += size.width/2;
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
2504 // it here. 2503 // it here.
2505 if (handlingKeyDown_) { 2504 if (handlingKeyDown_) {
2506 hasEditCommands_ = YES; 2505 hasEditCommands_ = YES;
2507 // We ignore commands that insert characters, because this was causing 2506 // We ignore commands that insert characters, because this was causing
2508 // strange behavior (e.g. tab always inserted a tab rather than moving to 2507 // strange behavior (e.g. tab always inserted a tab rather than moving to
2509 // the next field on the page). 2508 // the next field on the page).
2510 if (!StartsWithASCII(command, "insert", false)) 2509 if (!StartsWithASCII(command, "insert", false))
2511 editCommands_.push_back(EditCommand(command, "")); 2510 editCommands_.push_back(EditCommand(command, ""));
2512 } else { 2511 } else {
2513 RenderWidgetHostImpl* rwh = renderWidgetHostView_->render_widget_host_; 2512 RenderWidgetHostImpl* rwh = renderWidgetHostView_->render_widget_host_;
2514 rwh->Send(new ViewMsg_ExecuteEditCommand(rwh->routing_id(), command, "")); 2513 rwh->Send(new ViewMsg_ExecuteEditCommand(rwh->GetRoutingID(), command, ""));
2515 } 2514 }
2516 } 2515 }
2517 2516
2518 - (void)insertText:(id)string replacementRange:(NSRange)replacementRange { 2517 - (void)insertText:(id)string replacementRange:(NSRange)replacementRange {
2519 // An input method has characters to be inserted. 2518 // An input method has characters to be inserted.
2520 // Same as Linux, Mac calls this method not only: 2519 // Same as Linux, Mac calls this method not only:
2521 // * when an input method finishs composing text, but also; 2520 // * when an input method finishs composing text, but also;
2522 // * when we type an ASCII character (without using input methods). 2521 // * when we type an ASCII character (without using input methods).
2523 // When we aren't using input methods, we should send the given character as 2522 // When we aren't using input methods, we should send the given character as
2524 // a Char event so it is dispatched to an onkeypress() event handler of 2523 // 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
2577 event.button = WebMouseEvent::ButtonLeft; 2576 event.button = WebMouseEvent::ButtonLeft;
2578 if (renderWidgetHostView_->render_widget_host_) 2577 if (renderWidgetHostView_->render_widget_host_)
2579 renderWidgetHostView_->render_widget_host_->ForwardMouseEvent(event); 2578 renderWidgetHostView_->render_widget_host_->ForwardMouseEvent(event);
2580 2579
2581 hasOpenMouseDown_ = NO; 2580 hasOpenMouseDown_ = NO;
2582 } 2581 }
2583 } 2582 }
2584 2583
2585 - (void)undo:(id)sender { 2584 - (void)undo:(id)sender {
2586 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { 2585 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) {
2587 static_cast<RenderViewHost*>(renderWidgetHostView_->render_widget_host_)-> 2586 static_cast<RenderViewHostImpl*>(
2588 Undo(); 2587 renderWidgetHostView_->render_widget_host_)->Undo();
2589 } 2588 }
2590 } 2589 }
2591 2590
2592 - (void)redo:(id)sender { 2591 - (void)redo:(id)sender {
2593 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { 2592 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) {
2594 static_cast<RenderViewHost*>(renderWidgetHostView_->render_widget_host_)-> 2593 static_cast<RenderViewHostImpl*>(
2595 Redo(); 2594 renderWidgetHostView_->render_widget_host_)->Redo();
2596 } 2595 }
2597 } 2596 }
2598 2597
2599 - (void)cut:(id)sender { 2598 - (void)cut:(id)sender {
2600 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { 2599 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) {
2601 static_cast<RenderViewHost*>(renderWidgetHostView_->render_widget_host_)-> 2600 static_cast<RenderViewHostImpl*>(
2602 Cut(); 2601 renderWidgetHostView_->render_widget_host_)->Cut();
2603 } 2602 }
2604 } 2603 }
2605 2604
2606 - (void)copy:(id)sender { 2605 - (void)copy:(id)sender {
2607 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { 2606 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) {
2608 static_cast<RenderViewHost*>(renderWidgetHostView_->render_widget_host_)-> 2607 static_cast<RenderViewHostImpl*>(
2609 Copy(); 2608 renderWidgetHostView_->render_widget_host_)->Copy();
2610 } 2609 }
2611 } 2610 }
2612 2611
2613 - (void)copyToFindPboard:(id)sender { 2612 - (void)copyToFindPboard:(id)sender {
2614 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { 2613 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) {
2615 static_cast<RenderViewHost*>(renderWidgetHostView_->render_widget_host_)-> 2614 static_cast<RenderViewHostImpl*>(
2616 CopyToFindPboard(); 2615 renderWidgetHostView_->render_widget_host_)->CopyToFindPboard();
2617 } 2616 }
2618 } 2617 }
2619 2618
2620 - (void)paste:(id)sender { 2619 - (void)paste:(id)sender {
2621 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { 2620 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) {
2622 static_cast<RenderViewHost*>(renderWidgetHostView_->render_widget_host_)-> 2621 static_cast<RenderViewHostImpl*>(
2623 Paste(); 2622 renderWidgetHostView_->render_widget_host_)->Paste();
2624 } 2623 }
2625 } 2624 }
2626 2625
2627 - (void)pasteAndMatchStyle:(id)sender { 2626 - (void)pasteAndMatchStyle:(id)sender {
2628 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { 2627 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) {
2629 static_cast<RenderViewHost*>(renderWidgetHostView_->render_widget_host_)-> 2628 static_cast<RenderViewHostImpl*>(
2630 PasteAndMatchStyle(); 2629 renderWidgetHostView_->render_widget_host_)->PasteAndMatchStyle();
2631 } 2630 }
2632 } 2631 }
2633 2632
2634 - (void)cancelComposition { 2633 - (void)cancelComposition {
2635 if (!hasMarkedText_) 2634 if (!hasMarkedText_)
2636 return; 2635 return;
2637 2636
2638 // Cancel the ongoing composition. [NSInputManager markedTextAbandoned:] 2637 // Cancel the ongoing composition. [NSInputManager markedTextAbandoned:]
2639 // doesn't call any NSTextInput functions, such as setMarkedText or 2638 // doesn't call any NSTextInput functions, such as setMarkedText or
2640 // insertText. So, we need to send an IPC message to a renderer so it can 2639 // insertText. So, we need to send an IPC message to a renderer so it can
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2726 requestor = [super validRequestorForSendType:sendType 2725 requestor = [super validRequestorForSendType:sendType
2727 returnType:returnType]; 2726 returnType:returnType];
2728 } 2727 }
2729 return requestor; 2728 return requestor;
2730 } 2729 }
2731 2730
2732 - (void)viewWillStartLiveResize { 2731 - (void)viewWillStartLiveResize {
2733 [super viewWillStartLiveResize]; 2732 [super viewWillStartLiveResize];
2734 RenderWidgetHostImpl* widget = renderWidgetHostView_->render_widget_host_; 2733 RenderWidgetHostImpl* widget = renderWidgetHostView_->render_widget_host_;
2735 if (widget) 2734 if (widget)
2736 widget->Send(new ViewMsg_SetInLiveResize(widget->routing_id(), true)); 2735 widget->Send(new ViewMsg_SetInLiveResize(widget->GetRoutingID(), true));
2737 } 2736 }
2738 2737
2739 - (void)viewDidEndLiveResize { 2738 - (void)viewDidEndLiveResize {
2740 [super viewDidEndLiveResize]; 2739 [super viewDidEndLiveResize];
2741 RenderWidgetHostImpl* widget = renderWidgetHostView_->render_widget_host_; 2740 RenderWidgetHostImpl* widget = renderWidgetHostView_->render_widget_host_;
2742 if (widget) 2741 if (widget)
2743 widget->Send(new ViewMsg_SetInLiveResize(widget->routing_id(), false)); 2742 widget->Send(new ViewMsg_SetInLiveResize(widget->GetRoutingID(), false));
2744 } 2743 }
2745 2744
2746 @end 2745 @end
2747 2746
2748 // 2747 //
2749 // Supporting application services 2748 // Supporting application services
2750 // 2749 //
2751 @implementation RenderWidgetHostViewCocoa(NSServicesRequests) 2750 @implementation RenderWidgetHostViewCocoa(NSServicesRequests)
2752 2751
2753 - (BOOL)writeSelectionToPasteboard:(NSPasteboard*)pboard 2752 - (BOOL)writeSelectionToPasteboard:(NSPasteboard*)pboard
(...skipping 13 matching lines...) Expand all
2767 if (!string) return NO; 2766 if (!string) return NO;
2768 2767
2769 // If the user is currently using an IME, confirm the IME input, 2768 // If the user is currently using an IME, confirm the IME input,
2770 // and then insert the text from the service, the same as TextEdit and Safari. 2769 // and then insert the text from the service, the same as TextEdit and Safari.
2771 [self confirmComposition]; 2770 [self confirmComposition];
2772 [self insertText:string]; 2771 [self insertText:string];
2773 return YES; 2772 return YES;
2774 } 2773 }
2775 2774
2776 @end 2775 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698