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

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

Issue 325933003: Scroll offset pinning and content size notifications were only used for the Mac overlay navigation … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | 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 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 #include <QuartzCore/QuartzCore.h> 8 #include <QuartzCore/QuartzCore.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // Private methods: 135 // Private methods:
136 @interface RenderWidgetHostViewCocoa () 136 @interface RenderWidgetHostViewCocoa ()
137 @property(nonatomic, assign) NSRange selectedRange; 137 @property(nonatomic, assign) NSRange selectedRange;
138 @property(nonatomic, assign) NSRange markedRange; 138 @property(nonatomic, assign) NSRange markedRange;
139 139
140 + (BOOL)shouldAutohideCursorForEvent:(NSEvent*)event; 140 + (BOOL)shouldAutohideCursorForEvent:(NSEvent*)event;
141 - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r; 141 - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r;
142 - (void)processedWheelEvent:(const blink::WebMouseWheelEvent&)event 142 - (void)processedWheelEvent:(const blink::WebMouseWheelEvent&)event
143 consumed:(BOOL)consumed; 143 consumed:(BOOL)consumed;
144 144
145 - (void)scrollOffsetPinnedToLeft:(BOOL)left toRight:(BOOL)right;
146 - (void)setHasHorizontalScrollbar:(BOOL)has_horizontal_scrollbar;
147 - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv; 145 - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv;
148 - (void)windowDidChangeBackingProperties:(NSNotification*)notification; 146 - (void)windowDidChangeBackingProperties:(NSNotification*)notification;
149 - (void)windowChangedGlobalFrame:(NSNotification*)notification; 147 - (void)windowChangedGlobalFrame:(NSNotification*)notification;
150 - (void)checkForPluginImeCancellation; 148 - (void)checkForPluginImeCancellation;
151 - (void)updateScreenProperties; 149 - (void)updateScreenProperties;
152 - (void)setResponderDelegate: 150 - (void)setResponderDelegate:
153 (NSObject<RenderWidgetHostViewMacDelegate>*)delegate; 151 (NSObject<RenderWidgetHostViewMacDelegate>*)delegate;
154 @end 152 @end
155 153
156 // A window subclass that allows the fullscreen window to become main and gain 154 // A window subclass that allows the fullscreen window to become main and gain
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 DestroyCompositedIOSurfaceLayer(kRemoveLayerFromHierarchy); 645 DestroyCompositedIOSurfaceLayer(kRemoveLayerFromHierarchy);
648 compositing_iosurface_ = NULL; 646 compositing_iosurface_ = NULL;
649 compositing_iosurface_context_ = NULL; 647 compositing_iosurface_context_ = NULL;
650 } 648 }
651 649
652 bool RenderWidgetHostViewMac::OnMessageReceived(const IPC::Message& message) { 650 bool RenderWidgetHostViewMac::OnMessageReceived(const IPC::Message& message) {
653 bool handled = true; 651 bool handled = true;
654 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewMac, message) 652 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewMac, message)
655 IPC_MESSAGE_HANDLER(ViewHostMsg_PluginFocusChanged, OnPluginFocusChanged) 653 IPC_MESSAGE_HANDLER(ViewHostMsg_PluginFocusChanged, OnPluginFocusChanged)
656 IPC_MESSAGE_HANDLER(ViewHostMsg_StartPluginIme, OnStartPluginIme) 654 IPC_MESSAGE_HANDLER(ViewHostMsg_StartPluginIme, OnStartPluginIme)
657 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeScrollbarsForMainFrame,
658 OnDidChangeScrollbarsForMainFrame)
659 IPC_MESSAGE_UNHANDLED(handled = false) 655 IPC_MESSAGE_UNHANDLED(handled = false)
660 IPC_END_MESSAGE_MAP() 656 IPC_END_MESSAGE_MAP()
661 return handled; 657 return handled;
662 } 658 }
663 659
664 void RenderWidgetHostViewMac::InitAsChild( 660 void RenderWidgetHostViewMac::InitAsChild(
665 gfx::NativeView parent_view) { 661 gfx::NativeView parent_view) {
666 } 662 }
667 663
668 void RenderWidgetHostViewMac::InitAsPopup( 664 void RenderWidgetHostViewMac::InitAsPopup(
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 NSRect bounds = [enclosing_window frame]; 1853 NSRect bounds = [enclosing_window frame];
1858 return FlipNSRectToRectScreen(bounds); 1854 return FlipNSRectToRectScreen(bounds);
1859 } 1855 }
1860 1856
1861 gfx::GLSurfaceHandle RenderWidgetHostViewMac::GetCompositingSurface() { 1857 gfx::GLSurfaceHandle RenderWidgetHostViewMac::GetCompositingSurface() {
1862 // TODO(kbr): may be able to eliminate PluginWindowHandle argument 1858 // TODO(kbr): may be able to eliminate PluginWindowHandle argument
1863 // completely on Mac OS. 1859 // completely on Mac OS.
1864 return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::NATIVE_TRANSPORT); 1860 return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::NATIVE_TRANSPORT);
1865 } 1861 }
1866 1862
1867 void RenderWidgetHostViewMac::SetScrollOffsetPinning(
1868 bool is_pinned_to_left, bool is_pinned_to_right) {
1869 [cocoa_view_ scrollOffsetPinnedToLeft:is_pinned_to_left
1870 toRight:is_pinned_to_right];
1871 }
1872
1873 bool RenderWidgetHostViewMac::LockMouse() { 1863 bool RenderWidgetHostViewMac::LockMouse() {
1874 if (mouse_locked_) 1864 if (mouse_locked_)
1875 return true; 1865 return true;
1876 1866
1877 mouse_locked_ = true; 1867 mouse_locked_ = true;
1878 1868
1879 // Lock position of mouse cursor and hide it. 1869 // Lock position of mouse cursor and hide it.
1880 CGAssociateMouseAndMouseCursorPosition(NO); 1870 CGAssociateMouseAndMouseCursorPosition(NO);
1881 [NSCursor hide]; 1871 [NSCursor hide];
1882 1872
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
2089 2079
2090 void RenderWidgetHostViewMac::OnPluginFocusChanged(bool focused, 2080 void RenderWidgetHostViewMac::OnPluginFocusChanged(bool focused,
2091 int plugin_id) { 2081 int plugin_id) {
2092 [cocoa_view_ pluginFocusChanged:(focused ? YES : NO) forPlugin:plugin_id]; 2082 [cocoa_view_ pluginFocusChanged:(focused ? YES : NO) forPlugin:plugin_id];
2093 } 2083 }
2094 2084
2095 void RenderWidgetHostViewMac::OnStartPluginIme() { 2085 void RenderWidgetHostViewMac::OnStartPluginIme() {
2096 [cocoa_view_ setPluginImeActive:YES]; 2086 [cocoa_view_ setPluginImeActive:YES];
2097 } 2087 }
2098 2088
2099 void RenderWidgetHostViewMac::OnDidChangeScrollbarsForMainFrame(
2100 bool has_horizontal_scrollbar, bool has_vertical_scrollbar) {
2101 [cocoa_view_ setHasHorizontalScrollbar:has_horizontal_scrollbar];
2102 }
2103
2104 gfx::Rect RenderWidgetHostViewMac::GetScaledOpenGLPixelRect( 2089 gfx::Rect RenderWidgetHostViewMac::GetScaledOpenGLPixelRect(
2105 const gfx::Rect& rect) { 2090 const gfx::Rect& rect) {
2106 gfx::Rect src_gl_subrect = rect; 2091 gfx::Rect src_gl_subrect = rect;
2107 src_gl_subrect.set_y(GetViewBounds().height() - rect.bottom()); 2092 src_gl_subrect.set_y(GetViewBounds().height() - rect.bottom());
2108 2093
2109 return gfx::ToEnclosingRect(gfx::ScaleRect(src_gl_subrect, 2094 return gfx::ToEnclosingRect(gfx::ScaleRect(src_gl_subrect,
2110 ViewScaleFactor())); 2095 ViewScaleFactor()));
2111 } 2096 }
2112 2097
2113 void RenderWidgetHostViewMac::AddPendingLatencyInfo( 2098 void RenderWidgetHostViewMac::AddPendingLatencyInfo(
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
2385 [self addCursorRect:[self visibleRect] cursor:currentCursor_]; 2370 [self addCursorRect:[self visibleRect] cursor:currentCursor_];
2386 [currentCursor_ setOnMouseEntered:YES]; 2371 [currentCursor_ setOnMouseEntered:YES];
2387 } 2372 }
2388 } 2373 }
2389 2374
2390 - (void)processedWheelEvent:(const blink::WebMouseWheelEvent&)event 2375 - (void)processedWheelEvent:(const blink::WebMouseWheelEvent&)event
2391 consumed:(BOOL)consumed { 2376 consumed:(BOOL)consumed {
2392 [responderDelegate_ rendererHandledWheelEvent:event consumed:consumed]; 2377 [responderDelegate_ rendererHandledWheelEvent:event consumed:consumed];
2393 } 2378 }
2394 2379
2395 - (void)scrollOffsetPinnedToLeft:(BOOL)left toRight:(BOOL)right {
2396 if (responderDelegate_ &&
2397 [responderDelegate_
2398 respondsToSelector:@selector(scrollOffsetPinnedToLeft:toRight:)]) {
2399 [responderDelegate_ scrollOffsetPinnedToLeft:left toRight:right];
2400 }
2401 }
2402
2403 - (void)setHasHorizontalScrollbar:(BOOL)has_horizontal_scrollbar {
2404 if (responderDelegate_ &&
2405 [responderDelegate_
2406 respondsToSelector:@selector(setHasHorizontalScrollbar:)]) {
2407 [responderDelegate_ setHasHorizontalScrollbar:has_horizontal_scrollbar];
2408 }
2409 }
2410
2411 - (BOOL)respondsToSelector:(SEL)selector { 2380 - (BOOL)respondsToSelector:(SEL)selector {
2412 // Trickiness: this doesn't mean "does this object's superclass respond to 2381 // Trickiness: this doesn't mean "does this object's superclass respond to
2413 // this selector" but rather "does the -respondsToSelector impl from the 2382 // this selector" but rather "does the -respondsToSelector impl from the
2414 // superclass say that this class responds to the selector". 2383 // superclass say that this class responds to the selector".
2415 if ([super respondsToSelector:selector]) 2384 if ([super respondsToSelector:selector])
2416 return YES; 2385 return YES;
2417 2386
2418 if (responderDelegate_) 2387 if (responderDelegate_)
2419 return [responderDelegate_ respondsToSelector:selector]; 2388 return [responderDelegate_ respondsToSelector:selector];
2420 2389
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after
4006 3975
4007 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3976 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
4008 // regions that are not draggable. (See ControlRegionView in 3977 // regions that are not draggable. (See ControlRegionView in
4009 // native_app_window_cocoa.mm). This requires the render host view to be 3978 // native_app_window_cocoa.mm). This requires the render host view to be
4010 // draggable by default. 3979 // draggable by default.
4011 - (BOOL)mouseDownCanMoveWindow { 3980 - (BOOL)mouseDownCanMoveWindow {
4012 return YES; 3981 return YES;
4013 } 3982 }
4014 3983
4015 @end 3984 @end
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698