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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_RENDERER_HOST_CHROME_RENDER_WIDGET_HOST_VIEW_DELEGATE_H_ 6 #define CHROME_BROWSER_RENDERER_HOST_CHROME_RENDER_WIDGET_HOST_VIEW_DELEGATE_H_ 7 8 #import <Cocoa/Cocoa.h> 9 10 #include "base/memory/scoped_ptr.h" 11 #import "content/public/browser/render_widget_host_view_mac_delegate.h" 12 13 namespace content { 14 class RenderWidgetHost; 15 } 16 17 namespace ChromeRenderWidgetHostViewMacDelegateInternal { 18 class SpellCheckRenderViewObserver; 19 } 20 21 @interface ChromeRenderWidgetHostViewMacDelegate 22 : NSObject<RenderWidgetHostViewMacDelegate> { 23 @private 24 content::RenderWidgetHost* renderWidgetHost_; // weak 25 scoped_ptr<ChromeRenderWidgetHostViewMacDelegateInternal:: 26 SpellCheckRenderViewObserver> spellingObserver_; 27 28 // If the viewport is scrolled all the way to the left or right. 29 // Used for history swiping. 30 BOOL isPinnedLeft_; 31 BOOL isPinnedRight_; 32 33 // If the main frame has a horizontal scrollbar. 34 // Used for history swiping. 35 BOOL hasHorizontalScrollbar_; 36 37 // If a scroll event came back unhandled from the renderer. Set to |NO| at 38 // the start of a scroll gesture, and then to |YES| if a scroll event comes 39 // back unhandled from the renderer. 40 // Used for history swiping. 41 BOOL gotUnhandledWheelEvent_; 42 43 // Cumulative scroll delta since scroll gesture start. Only valid during 44 // scroll gesture handling. Used for history swiping. 45 NSSize totalScrollDelta_; 46 47 // Used for continuous spell checking. 48 BOOL spellcheckEnabled_; 49 BOOL spellcheckChecked_; 50 } 51 52 - (id)initWithRenderWidgetHost:(content::RenderWidgetHost*)renderWidgetHost; 53 54 - (void)viewGone:(NSView*)view; 55 - (BOOL)handleEvent:(NSEvent*)event; 56 - (void)gotUnhandledWheelEvent; 57 - (void)scrollOffsetPinnedToLeft:(BOOL)left toRight:(BOOL)right; 58 - (void)setHasHorizontalScrollbar:(BOOL)hasHorizontalScrollbar; 59 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item 60 isValidItem:(BOOL*)valid; 61 62 @end 63 64 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_RENDER_WIDGET_HOST_VIEW_DELEGATE_H_ 65