Home | History | Annotate | Download | only in renderer_host
      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 CONTENT_BROWSER_RENDER_WIDGET_HOST_DELEGATE_H_
      6 #define CONTENT_BROWSER_RENDER_WIDGET_HOST_DELEGATE_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "build/build_config.h"
     10 #include "content/common/content_export.h"
     11 #include "ui/gfx/native_widget_types.h"
     12 
     13 namespace blink {
     14 class WebMouseWheelEvent;
     15 class WebGestureEvent;
     16 }
     17 
     18 namespace content {
     19 
     20 class BrowserAccessibilityManager;
     21 class RenderWidgetHostImpl;
     22 struct NativeWebKeyboardEvent;
     23 
     24 //
     25 // RenderWidgetHostDelegate
     26 //
     27 //  An interface implemented by an object interested in knowing about the state
     28 //  of the RenderWidgetHost.
     29 class CONTENT_EXPORT RenderWidgetHostDelegate {
     30  public:
     31   // The RenderWidgetHost is going to be deleted.
     32   virtual void RenderWidgetDeleted(RenderWidgetHostImpl* render_widget_host) {}
     33 
     34   // Callback to give the browser a chance to handle the specified keyboard
     35   // event before sending it to the renderer.
     36   // Returns true if the |event| was handled. Otherwise, if the |event| would
     37   // be handled in HandleKeyboardEvent() method as a normal keyboard shortcut,
     38   // |*is_keyboard_shortcut| should be set to true.
     39   virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
     40                                       bool* is_keyboard_shortcut);
     41 
     42   // Callback to inform the browser that the renderer did not process the
     43   // specified events. This gives an opportunity to the browser to process the
     44   // event (used for keyboard shortcuts).
     45   virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {}
     46 
     47   // Callback to inform the browser that the renderer did not process the
     48   // specified mouse wheel event.  Returns true if the browser has handled
     49   // the event itself.
     50   virtual bool HandleWheelEvent(const blink::WebMouseWheelEvent& event);
     51 
     52   // Callback to give the browser a chance to handle the specified gesture
     53   // event before sending it to the renderer.
     54   // Returns true if the |event| was handled.
     55   virtual bool PreHandleGestureEvent(const blink::WebGestureEvent& event);
     56 
     57   // Callback to inform the browser that the renderer did not process the
     58   // specified gesture event.  Returns true if the |event| was handled.
     59   virtual bool HandleGestureEvent(const blink::WebGestureEvent& event);
     60 
     61   // Notifies that screen rects were sent to renderer process.
     62   virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) {}
     63 
     64   // Get the root BrowserAccessibilityManager for this frame tree.
     65   virtual BrowserAccessibilityManager* GetRootBrowserAccessibilityManager();
     66 
     67   // Get the root BrowserAccessibilityManager for this frame tree,
     68   // or create it if it doesn't exist.
     69   virtual BrowserAccessibilityManager*
     70       GetOrCreateRootBrowserAccessibilityManager();
     71 
     72 #if defined(OS_WIN)
     73   virtual gfx::NativeViewAccessible GetParentNativeViewAccessible();
     74 #endif
     75 
     76  protected:
     77   virtual ~RenderWidgetHostDelegate() {}
     78 };
     79 
     80 }  // namespace content
     81 
     82 #endif  // CONTENT_BROWSER_RENDER_WIDGET_HOST_DELEGATE_H_
     83