Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 #import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_h elper.h" | 33 #import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_h elper.h" |
| 34 #import "content/browser/renderer_host/text_input_client_mac.h" | 34 #import "content/browser/renderer_host/text_input_client_mac.h" |
| 35 #include "content/common/accessibility_messages.h" | 35 #include "content/common/accessibility_messages.h" |
| 36 #include "content/common/edit_command.h" | 36 #include "content/common/edit_command.h" |
| 37 #include "content/common/gpu/gpu_messages.h" | 37 #include "content/common/gpu/gpu_messages.h" |
| 38 #include "content/common/plugin_messages.h" | 38 #include "content/common/plugin_messages.h" |
| 39 #include "content/common/view_messages.h" | 39 #include "content/common/view_messages.h" |
| 40 #include "content/public/browser/browser_thread.h" | 40 #include "content/public/browser/browser_thread.h" |
| 41 #include "content/public/browser/native_web_keyboard_event.h" | 41 #include "content/public/browser/native_web_keyboard_event.h" |
| 42 #import "content/public/browser/render_widget_host_view_mac_delegate.h" | 42 #import "content/public/browser/render_widget_host_view_mac_delegate.h" |
| 43 #include "content/public/browser/web_contents_view_delegate.h" | |
| 43 #include "skia/ext/platform_canvas.h" | 44 #include "skia/ext/platform_canvas.h" |
| 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
| 46 #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebInputEventFact ory.h" | 47 #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebInputEventFact ory.h" |
| 47 #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebScreenInfoFact ory.h" | 48 #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebScreenInfoFact ory.h" |
| 48 #import "third_party/mozilla/ComplexTextInputPanel.h" | 49 #import "third_party/mozilla/ComplexTextInputPanel.h" |
| 49 #include "third_party/skia/include/core/SkColor.h" | 50 #include "third_party/skia/include/core/SkColor.h" |
| 51 #import "ui/base/cocoa/event_hook_application.h" | |
| 50 #import "ui/base/cocoa/fullscreen_window_manager.h" | 52 #import "ui/base/cocoa/fullscreen_window_manager.h" |
| 51 #import "ui/base/cocoa/underlay_opengl_hosting_window.h" | 53 #import "ui/base/cocoa/underlay_opengl_hosting_window.h" |
| 52 #include "ui/base/keycodes/keyboard_codes.h" | 54 #include "ui/base/keycodes/keyboard_codes.h" |
| 53 #include "ui/base/layout.h" | 55 #include "ui/base/layout.h" |
| 54 #include "ui/gfx/point.h" | 56 #include "ui/gfx/point.h" |
| 55 #include "ui/gfx/rect_conversions.h" | 57 #include "ui/gfx/rect_conversions.h" |
| 56 #include "ui/gfx/size_conversions.h" | 58 #include "ui/gfx/size_conversions.h" |
| 57 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 59 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
| 60 #include "ui/gfx/native_widget_types.h" | |
|
Avi (use Gerrit)
2012/12/12 15:59:49
in alphabetical order
keishi
2012/12/13 07:51:12
Didn't need this. Removed.
| |
| 58 #include "ui/surface/io_surface_support_mac.h" | 61 #include "ui/surface/io_surface_support_mac.h" |
| 59 #include "webkit/plugins/npapi/webplugin.h" | 62 #include "webkit/plugins/npapi/webplugin.h" |
| 60 | 63 |
| 61 using content::BackingStoreMac; | 64 using content::BackingStoreMac; |
| 62 using content::BrowserAccessibility; | 65 using content::BrowserAccessibility; |
| 63 using content::BrowserAccessibilityManager; | 66 using content::BrowserAccessibilityManager; |
| 64 using content::EditCommand; | 67 using content::EditCommand; |
| 65 using content::NativeWebKeyboardEvent; | 68 using content::NativeWebKeyboardEvent; |
| 66 using content::RenderViewHostImpl; | 69 using content::RenderViewHostImpl; |
| 67 using content::RenderWidgetHostImpl; | 70 using content::RenderWidgetHostImpl; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 - (BOOL)canBecomeKeyWindow { | 163 - (BOOL)canBecomeKeyWindow { |
| 161 return YES; | 164 return YES; |
| 162 } | 165 } |
| 163 | 166 |
| 164 - (BOOL)canBecomeMainWindow { | 167 - (BOOL)canBecomeMainWindow { |
| 165 return YES; | 168 return YES; |
| 166 } | 169 } |
| 167 | 170 |
| 168 @end | 171 @end |
| 169 | 172 |
| 173 @interface RenderWidgetPopupWindow : NSWindow<CrEventHookProtocol> | |
| 174 @end | |
| 175 | |
| 176 @implementation RenderWidgetPopupWindow | |
| 177 | |
| 178 - (id)initWithContentRect:(NSRect)contentRect | |
| 179 styleMask:(NSUInteger)windowStyle | |
| 180 backing:(NSBackingStoreType)bufferingType | |
| 181 defer:(BOOL)deferCreation { | |
| 182 if (self = [super initWithContentRect:contentRect | |
| 183 styleMask:windowStyle | |
| 184 backing:bufferingType | |
| 185 defer:deferCreation]) { | |
| 186 [self setOpaque:NO]; | |
| 187 [self setBackgroundColor:[NSColor clearColor]]; | |
| 188 [self startObservingClick]; | |
| 189 } | |
| 190 return self; | |
| 191 } | |
| 192 | |
| 193 - (void)close { | |
| 194 [self stopObservingClick]; | |
| 195 [super close]; | |
| 196 } | |
| 197 | |
| 198 // Gets called for all events in application. Watching for a click outside the | |
| 199 // window so we can close. | |
| 200 - (void)hookForEvent:(NSEvent*)theEvent { | |
| 201 if ([theEvent window] == self) | |
| 202 return; | |
| 203 NSEventType eventType = [theEvent type]; | |
| 204 if (eventType == NSLeftMouseDown || eventType == NSRightMouseDown) { | |
| 205 [self close]; | |
| 206 } | |
|
Avi (use Gerrit)
2012/12/12 15:59:49
You don't need {} for a one-liner.
I'm still curi
keishi
2012/12/13 07:51:12
resignFirstResponder isn't enough. For example it
| |
| 207 } | |
| 208 | |
| 209 // Gets called when the menubar is clicked. | |
| 210 // Needed because the hookForEvent method doesn't see the click on the menubar. | |
| 211 - (void)begunTracking:(NSNotification *)notification { | |
|
Avi (use Gerrit)
2012/12/12 15:59:49
No space before *.
keishi
2012/12/13 07:51:12
Done.
| |
| 212 [self close]; | |
| 213 } | |
| 214 | |
| 215 // Install the callback. | |
| 216 - (void)startObservingClick { | |
|
Avi (use Gerrit)
2012/12/12 15:59:49
-startObservingClicks is more grammatical. (And -s
keishi
2012/12/13 07:51:12
Done.
| |
| 217 CrEventHookApplication* app = static_cast<CrEventHookApplication*>( | |
| 218 [CrEventHookApplication sharedApplication]); | |
| 219 [app addEventHook:self]; | |
| 220 | |
| 221 NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; | |
|
Avi (use Gerrit)
2012/12/12 15:59:49
Space after, not before *.
keishi
2012/12/13 07:51:12
Done.
| |
| 222 [nc addObserver:self | |
| 223 selector:@selector(begunTracking:) | |
| 224 name:NSMenuDidBeginTrackingNotification | |
| 225 object:[NSApp mainMenu]]; | |
| 226 } | |
| 227 | |
| 228 // Remove the callback. | |
| 229 - (void)stopObservingClick { | |
| 230 CrEventHookApplication* app = static_cast<CrEventHookApplication*>( | |
| 231 [CrEventHookApplication sharedApplication]); | |
| 232 [app removeEventHook:self]; | |
| 233 | |
| 234 NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; | |
| 235 [nc removeObserver:self | |
| 236 name:NSMenuDidBeginTrackingNotification | |
| 237 object:[NSApp mainMenu]]; | |
| 238 } | |
| 239 | |
| 240 @end | |
| 241 | |
| 170 namespace { | 242 namespace { |
| 171 | 243 |
| 172 // Maximum number of characters we allow in a tooltip. | 244 // Maximum number of characters we allow in a tooltip. |
| 173 const size_t kMaxTooltipLength = 1024; | 245 const size_t kMaxTooltipLength = 1024; |
| 174 | 246 |
| 175 // TODO(suzhe): Upstream this function. | 247 // TODO(suzhe): Upstream this function. |
| 176 WebKit::WebColor WebColorFromNSColor(NSColor *color) { | 248 WebKit::WebColor WebColorFromNSColor(NSColor *color) { |
| 177 CGFloat r, g, b, a; | 249 CGFloat r, g, b, a; |
| 178 [color getRed:&r green:&g blue:&b alpha:&a]; | 250 [color getRed:&r green:&g blue:&b alpha:&a]; |
| 179 | 251 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 } | 394 } |
| 323 | 395 |
| 324 /////////////////////////////////////////////////////////////////////////////// | 396 /////////////////////////////////////////////////////////////////////////////// |
| 325 // RenderWidgetHostViewMac, RenderWidgetHostView implementation: | 397 // RenderWidgetHostViewMac, RenderWidgetHostView implementation: |
| 326 | 398 |
| 327 void RenderWidgetHostViewMac::InitAsChild( | 399 void RenderWidgetHostViewMac::InitAsChild( |
| 328 gfx::NativeView parent_view) { | 400 gfx::NativeView parent_view) { |
| 329 } | 401 } |
| 330 | 402 |
| 331 void RenderWidgetHostViewMac::InitAsPopup( | 403 void RenderWidgetHostViewMac::InitAsPopup( |
| 332 RenderWidgetHostView* parent_host_view, | 404 RenderWidgetHostView* parent_host_view, const gfx::Rect& pos) { |
| 333 const gfx::Rect& pos) { | |
| 334 bool activatable = popup_type_ == WebKit::WebPopupTypeNone; | 405 bool activatable = popup_type_ == WebKit::WebPopupTypeNone; |
| 335 [cocoa_view_ setCloseOnDeactivate:YES]; | 406 [cocoa_view_ setCloseOnDeactivate:YES]; |
| 336 [cocoa_view_ setCanBeKeyView:activatable ? YES : NO]; | 407 [cocoa_view_ setCanBeKeyView:activatable ? YES : NO]; |
| 337 [parent_host_view->GetNativeView() addSubview:cocoa_view_]; | 408 [parent_host_view->GetNativeView() addSubview:cocoa_view_]; |
|
Avi (use Gerrit)
2012/12/12 15:59:49
This line doesn't make sense any more. If we're in
keishi
2012/12/13 07:51:12
Removed.
| |
| 338 | 409 |
| 339 NSPoint origin_global = NSPointFromCGPoint(pos.origin().ToCGPoint()); | 410 NSPoint origin_global = NSPointFromCGPoint(pos.origin().ToCGPoint()); |
| 340 if ([[NSScreen screens] count] > 0) { | 411 if ([[NSScreen screens] count] > 0) { |
| 341 origin_global.y = [[[NSScreen screens] objectAtIndex:0] frame].size.height - | 412 origin_global.y = [[[NSScreen screens] objectAtIndex:0] frame].size.height - |
| 342 pos.height() - origin_global.y; | 413 pos.height() - origin_global.y; |
| 343 } | 414 } |
| 344 NSPoint origin_window = | 415 |
| 345 [[cocoa_view_ window] convertScreenToBase:origin_global]; | 416 popup_window_.reset([[RenderWidgetPopupWindow alloc] |
| 346 NSPoint origin_view = | 417 initWithContentRect:NSMakeRect(origin_global.x, origin_global.y, |
| 347 [cocoa_view_ convertPoint:origin_window fromView:nil]; | 418 pos.width(), pos.height()) |
| 348 NSRect initial_frame = NSMakeRect(origin_view.x, | 419 styleMask:NSBorderlessWindowMask |
| 349 origin_view.y, | 420 backing:NSBackingStoreBuffered |
| 350 pos.width(), | 421 defer:NO]); |
| 351 pos.height()); | 422 [popup_window_ setLevel:NSPopUpMenuWindowLevel]; |
| 352 [cocoa_view_ setFrame:initial_frame]; | 423 [popup_window_ setReleasedWhenClosed:NO]; |
| 424 [popup_window_ makeKeyAndOrderFront:nil]; | |
| 425 [[popup_window_ contentView] addSubview:cocoa_view_]; | |
| 426 [cocoa_view_ setFrame:[[popup_window_ contentView] bounds]]; | |
| 427 [cocoa_view_ setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; | |
| 428 [[NSNotificationCenter defaultCenter] | |
| 429 addObserver:cocoa_view_ | |
| 430 selector:@selector(popupWindowWillClose:) | |
| 431 name:NSWindowWillCloseNotification | |
| 432 object:popup_window_]; | |
|
Avi (use Gerrit)
2012/12/12 15:59:49
What is the case that you are trying to catch here
keishi
2012/12/13 07:51:12
When a click is observed RenderWidgetPopupWindow w
| |
| 353 } | 433 } |
| 354 | 434 |
| 355 // This function creates the fullscreen window and hides the dock and menubar if | 435 // This function creates the fullscreen window and hides the dock and menubar if |
| 356 // necessary. Note, this codepath is only used for pepper flash when | 436 // necessary. Note, this codepath is only used for pepper flash when |
| 357 // pp::FlashFullScreen::SetFullscreen() is called. If | 437 // pp::FlashFullScreen::SetFullscreen() is called. If |
| 358 // pp::FullScreen::SetFullscreen() is called then the entire browser window | 438 // pp::FullScreen::SetFullscreen() is called then the entire browser window |
| 359 // will enter fullscreen instead. | 439 // will enter fullscreen instead. |
| 360 void RenderWidgetHostViewMac::InitAsFullscreen( | 440 void RenderWidgetHostViewMac::InitAsFullscreen( |
| 361 RenderWidgetHostView* reference_host_view) { | 441 RenderWidgetHostView* reference_host_view) { |
| 362 fullscreen_parent_host_view_ = | 442 fullscreen_parent_host_view_ = |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 451 if (rect.size().IsEmpty()) | 531 if (rect.size().IsEmpty()) |
| 452 return; | 532 return; |
| 453 | 533 |
| 454 // Ignore the position of |rect| for non-popup rwhvs. This is because | 534 // Ignore the position of |rect| for non-popup rwhvs. This is because |
| 455 // background tabs do not have a window, but the window is required for the | 535 // background tabs do not have a window, but the window is required for the |
| 456 // coordinate conversions. Popups are always for a visible tab. | 536 // coordinate conversions. Popups are always for a visible tab. |
| 457 if (IsPopup()) { | 537 if (IsPopup()) { |
| 458 // The position of |rect| is screen coordinate system and we have to | 538 // The position of |rect| is screen coordinate system and we have to |
| 459 // consider Cocoa coordinate system is upside-down and also multi-screen. | 539 // consider Cocoa coordinate system is upside-down and also multi-screen. |
| 460 NSPoint origin_global = NSPointFromCGPoint(rect.origin().ToCGPoint()); | 540 NSPoint origin_global = NSPointFromCGPoint(rect.origin().ToCGPoint()); |
| 541 NSSize size = NSMakeSize(rect.width(), rect.height()); | |
| 542 size = [cocoa_view_ convertSize:size toView:nil]; | |
| 461 if ([[NSScreen screens] count] > 0) { | 543 if ([[NSScreen screens] count] > 0) { |
| 462 NSSize size = NSMakeSize(rect.width(), rect.height()); | |
| 463 size = [cocoa_view_ convertSize:size toView:nil]; | |
| 464 NSScreen* screen = | 544 NSScreen* screen = |
| 465 static_cast<NSScreen*>([[NSScreen screens] objectAtIndex:0]); | 545 static_cast<NSScreen*>([[NSScreen screens] objectAtIndex:0]); |
| 466 origin_global.y = | 546 origin_global.y = |
| 467 NSHeight([screen frame]) - size.height - origin_global.y; | 547 NSHeight([screen frame]) - size.height - origin_global.y; |
| 468 } | 548 } |
| 469 | 549 [popup_window_ setFrame:NSMakeRect(origin_global.x, origin_global.y, |
| 470 // Then |origin_global| is converted to client coordinate system. | 550 size.width, size.height) |
| 471 DCHECK([cocoa_view_ window]); | 551 display:YES]; |
| 472 NSPoint origin_window = | |
| 473 [[cocoa_view_ window] convertScreenToBase:origin_global]; | |
| 474 NSPoint origin_view = | |
| 475 [[cocoa_view_ superview] convertPoint:origin_window fromView:nil]; | |
| 476 NSRect frame = NSMakeRect(origin_view.x, origin_view.y, | |
| 477 rect.width(), rect.height()); | |
| 478 [cocoa_view_ setFrame:frame]; | |
| 479 } else { | 552 } else { |
| 480 DCHECK([[cocoa_view_ superview] isKindOfClass:[BaseView class]]); | 553 DCHECK([[cocoa_view_ superview] isKindOfClass:[BaseView class]]); |
| 481 BaseView* superview = static_cast<BaseView*>([cocoa_view_ superview]); | 554 BaseView* superview = static_cast<BaseView*>([cocoa_view_ superview]); |
| 482 gfx::Rect rect2 = [superview flipNSRectToRect:[cocoa_view_ frame]]; | 555 gfx::Rect rect2 = [superview flipNSRectToRect:[cocoa_view_ frame]]; |
| 483 rect2.set_width(rect.width()); | 556 rect2.set_width(rect.width()); |
| 484 rect2.set_height(rect.height()); | 557 rect2.set_height(rect.height()); |
| 485 [cocoa_view_ setFrame:[superview flipRectToNSRect:rect2]]; | 558 [cocoa_view_ setFrame:[superview flipRectToNSRect:rect2]]; |
| 486 } | 559 } |
| 487 } | 560 } |
| 488 | 561 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 718 for (NSView* subview in [cocoa_view_ subviews]) { | 791 for (NSView* subview in [cocoa_view_ subviews]) { |
| 719 if ([subview isKindOfClass:[RenderWidgetHostViewCocoa class]]) { | 792 if ([subview isKindOfClass:[RenderWidgetHostViewCocoa class]]) { |
| 720 [static_cast<RenderWidgetHostViewCocoa*>(subview) | 793 [static_cast<RenderWidgetHostViewCocoa*>(subview) |
| 721 renderWidgetHostViewMac]->ShutdownHost(); | 794 renderWidgetHostViewMac]->ShutdownHost(); |
| 722 } else if ([subview isKindOfClass:[AcceleratedPluginView class]]) { | 795 } else if ([subview isKindOfClass:[AcceleratedPluginView class]]) { |
| 723 [static_cast<AcceleratedPluginView*>(subview) | 796 [static_cast<AcceleratedPluginView*>(subview) |
| 724 onRenderWidgetHostViewGone]; | 797 onRenderWidgetHostViewGone]; |
| 725 } | 798 } |
| 726 } | 799 } |
| 727 | 800 |
| 801 [[NSNotificationCenter defaultCenter] | |
| 802 removeObserver:cocoa_view_ | |
| 803 name:NSWindowWillCloseNotification | |
| 804 object:popup_window_]; | |
| 805 | |
| 728 // We've been told to destroy. | 806 // We've been told to destroy. |
| 729 [cocoa_view_ retain]; | 807 [cocoa_view_ retain]; |
| 730 [cocoa_view_ removeFromSuperview]; | 808 [cocoa_view_ removeFromSuperview]; |
| 731 [cocoa_view_ autorelease]; | 809 [cocoa_view_ autorelease]; |
| 732 | 810 |
| 811 [popup_window_ close]; | |
| 812 popup_window_.autorelease(); | |
| 813 | |
| 733 [fullscreen_window_manager_ exitFullscreenMode]; | 814 [fullscreen_window_manager_ exitFullscreenMode]; |
| 734 fullscreen_window_manager_.reset(); | 815 fullscreen_window_manager_.reset(); |
| 735 [pepper_fullscreen_window_ close]; | 816 [pepper_fullscreen_window_ close]; |
| 736 | 817 |
| 737 // This can be called as part of processing the window's responder | 818 // This can be called as part of processing the window's responder |
| 738 // chain, for instance |-performKeyEquivalent:|. In that case the | 819 // chain, for instance |-performKeyEquivalent:|. In that case the |
| 739 // object needs to survive until the stack unwinds. | 820 // object needs to survive until the stack unwinds. |
| 740 pepper_fullscreen_window_.autorelease(); | 821 pepper_fullscreen_window_.autorelease(); |
| 741 | 822 |
| 742 // We get this call just before |render_widget_host_| deletes | 823 // We get this call just before |render_widget_host_| deletes |
| (...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2097 } | 2178 } |
| 2098 | 2179 |
| 2099 // Possibly autohide the cursor. | 2180 // Possibly autohide the cursor. |
| 2100 if ([RenderWidgetHostViewCocoa shouldAutohideCursorForEvent:theEvent]) | 2181 if ([RenderWidgetHostViewCocoa shouldAutohideCursorForEvent:theEvent]) |
| 2101 [NSCursor setHiddenUntilMouseMoves:YES]; | 2182 [NSCursor setHiddenUntilMouseMoves:YES]; |
| 2102 } | 2183 } |
| 2103 | 2184 |
| 2104 - (void)scrollWheel:(NSEvent*)theEvent { | 2185 - (void)scrollWheel:(NSEvent*)theEvent { |
| 2105 // Cancel popups before calling the delegate because even if the delegate eats | 2186 // Cancel popups before calling the delegate because even if the delegate eats |
| 2106 // the event, it's still an explicit user action outside the popup. | 2187 // the event, it's still an explicit user action outside the popup. |
| 2107 [self cancelChildPopups]; | 2188 [self cancelChildPopups]; |
|
Avi (use Gerrit)
2012/12/12 15:59:49
How does this code work?
As I noted above, it use
keishi
2012/12/13 07:51:12
You're right. We can't do this if we use NSWindow.
| |
| 2108 | 2189 |
| 2109 if (delegate_ && [delegate_ respondsToSelector:@selector(handleEvent:)]) { | 2190 if (delegate_ && [delegate_ respondsToSelector:@selector(handleEvent:)]) { |
| 2110 BOOL handled = [delegate_ handleEvent:theEvent]; | 2191 BOOL handled = [delegate_ handleEvent:theEvent]; |
| 2111 if (handled) | 2192 if (handled) |
| 2112 return; | 2193 return; |
| 2113 } | 2194 } |
| 2114 | 2195 |
| 2115 const WebMouseWheelEvent& event = | 2196 const WebMouseWheelEvent& event = |
| 2116 WebInputEventFactory::mouseWheelEvent(theEvent, self); | 2197 WebInputEventFactory::mouseWheelEvent(theEvent, self); |
| 2117 if (renderWidgetHostView_->render_widget_host_) | 2198 if (renderWidgetHostView_->render_widget_host_) |
| (...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3346 } | 3427 } |
| 3347 | 3428 |
| 3348 - (void)updateCursor:(NSCursor*)cursor { | 3429 - (void)updateCursor:(NSCursor*)cursor { |
| 3349 if (currentCursor_ == cursor) | 3430 if (currentCursor_ == cursor) |
| 3350 return; | 3431 return; |
| 3351 | 3432 |
| 3352 currentCursor_.reset(cursor, base::scoped_policy::RETAIN); | 3433 currentCursor_.reset(cursor, base::scoped_policy::RETAIN); |
| 3353 [[self window] invalidateCursorRectsForView:self]; | 3434 [[self window] invalidateCursorRectsForView:self]; |
| 3354 } | 3435 } |
| 3355 | 3436 |
| 3437 - (void)popupWindowWillClose:(NSNotification *)notification { | |
| 3438 [self resignFirstResponder]; | |
|
keishi
2012/12/13 07:51:12
Changing this line because cocoa_view_ for a popup
| |
| 3439 } | |
| 3440 | |
| 3356 @end | 3441 @end |
| 3357 | 3442 |
| 3358 // | 3443 // |
| 3359 // Supporting application services | 3444 // Supporting application services |
| 3360 // | 3445 // |
| 3361 @implementation RenderWidgetHostViewCocoa(NSServicesRequests) | 3446 @implementation RenderWidgetHostViewCocoa(NSServicesRequests) |
| 3362 | 3447 |
| 3363 - (BOOL)writeSelectionToPasteboard:(NSPasteboard*)pboard | 3448 - (BOOL)writeSelectionToPasteboard:(NSPasteboard*)pboard |
| 3364 types:(NSArray*)types { | 3449 types:(NSArray*)types { |
| 3365 const std::string& str = renderWidgetHostView_->selected_text(); | 3450 const std::string& str = renderWidgetHostView_->selected_text(); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 3377 if (!string) return NO; | 3462 if (!string) return NO; |
| 3378 | 3463 |
| 3379 // If the user is currently using an IME, confirm the IME input, | 3464 // If the user is currently using an IME, confirm the IME input, |
| 3380 // and then insert the text from the service, the same as TextEdit and Safari. | 3465 // and then insert the text from the service, the same as TextEdit and Safari. |
| 3381 [self confirmComposition]; | 3466 [self confirmComposition]; |
| 3382 [self insertText:string]; | 3467 [self insertText:string]; |
| 3383 return YES; | 3468 return YES; |
| 3384 } | 3469 } |
| 3385 | 3470 |
| 3386 @end | 3471 @end |
| OLD | NEW |