Popular sites on the NTP: Try to keep the ordering constant
[chromium-blink-merge.git] / content / public / browser / render_widget_host_view_mac_delegate.h
blobc00d8bd3109183e07a0f57f5f5e916720e60e5c9
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.
5 #ifndef CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_
6 #define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_
8 #import <Cocoa/Cocoa.h>
10 namespace blink {
11 class WebMouseWheelEvent;
14 // This protocol is used as a delegate for the NSView class used in the
15 // hierarchy. There are two ways to extend the view:
16 // - Implement the methods listed in the protocol below.
17 // - Implement any method, and if the view is requested to perform that method
18 // and cannot, the delegate's implementation will be used.
20 // Like any Objective-C delegate, it is not retained by the delegator object.
21 // The delegator object will call the -viewGone: method when it is going away.
23 @class NSEvent;
24 @protocol RenderWidgetHostViewMacDelegate
25 @optional
26 // Notification that the view is gone.
27 - (void)viewGone:(NSView*)view;
29 // Handle an event. All incoming key and mouse events flow through this delegate
30 // method if implemented. Return YES if the event is fully handled, or NO if
31 // normal processing should take place.
32 - (BOOL)handleEvent:(NSEvent*)event;
34 // Provides validation of user interface items. If the return value is NO, then
35 // the delegate is unaware of that item and |valid| is undefined. Otherwise,
36 // |valid| contains the validity of the specified item.
37 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item
38 isValidItem:(BOOL*)valid;
40 @required
41 // Notification of when a gesture begins/ends.
42 - (void)beginGestureWithEvent:(NSEvent*)event;
43 - (void)endGestureWithEvent:(NSEvent*)event;
45 // This is a low level API which provides touches associated with an event.
46 // It is used in conjunction with gestures to determine finger placement
47 // on the trackpad.
48 - (void)touchesMovedWithEvent:(NSEvent*)event;
49 - (void)touchesBeganWithEvent:(NSEvent*)event;
50 - (void)touchesCancelledWithEvent:(NSEvent*)event;
51 - (void)touchesEndedWithEvent:(NSEvent*)event;
53 // These methods control whether a given view is allowed to rubberband in the
54 // given direction. This is inversely related to whether the view is allowed to
55 // 2-finger history swipe in the given direction.
56 - (BOOL)canRubberbandLeft:(NSView*)view;
57 - (BOOL)canRubberbandRight:(NSView*)view;
59 // The browser process received an ACK from the renderer after it processed
60 // |event|.
61 - (void)rendererHandledWheelEvent:(const blink::WebMouseWheelEvent&)event
62 consumed:(BOOL)consumed;
63 @end
65 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_