Removing uses of X11 native key events.
[chromium-blink-merge.git] / content / public / renderer / render_view_observer.h
blob49f013a720d589c3e1d3ed8ff3fd449ee7225cb4
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_RENDERER_RENDER_VIEW_OBSERVER_H_
6 #define CONTENT_PUBLIC_RENDERER_RENDER_VIEW_OBSERVER_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "content/common/content_export.h"
11 #include "ipc/ipc_listener.h"
12 #include "ipc/ipc_sender.h"
13 #include "third_party/WebKit/public/platform/WebVector.h"
15 class GURL;
17 namespace ppapi {
18 namespace host {
19 class PpapiHost;
23 namespace blink {
24 class WebDataSource;
25 class WebFrame;
26 class WebFormElement;
27 class WebGestureEvent;
28 class WebLocalFrame;
29 class WebMouseEvent;
30 class WebNode;
31 class WebString;
32 class WebTouchEvent;
33 class WebURL;
34 struct WebURLError;
37 namespace content {
39 class RendererPpapiHost;
40 class RenderView;
41 class RenderViewImpl;
43 // Base class for objects that want to filter incoming IPCs, and also get
44 // notified of changes to the frame.
45 class CONTENT_EXPORT RenderViewObserver : public IPC::Listener,
46 public IPC::Sender {
47 public:
48 // By default, observers will be deleted when the RenderView goes away. If
49 // they want to outlive it, they can override this function.
50 virtual void OnDestruct();
52 // These match the WebKit API notifications
53 virtual void DidStartLoading() {}
54 virtual void DidStopLoading() {}
55 virtual void DidFinishDocumentLoad(blink::WebLocalFrame* frame) {}
56 virtual void DidFailLoad(blink::WebLocalFrame* frame,
57 const blink::WebURLError& error) {}
58 virtual void DidFinishLoad(blink::WebLocalFrame* frame) {}
59 virtual void DidStartProvisionalLoad(blink::WebLocalFrame* frame) {}
60 virtual void DidFailProvisionalLoad(blink::WebLocalFrame* frame,
61 const blink::WebURLError& error) {}
62 virtual void DidCommitProvisionalLoad(blink::WebLocalFrame* frame,
63 bool is_new_navigation) {}
64 virtual void DidClearWindowObject(blink::WebLocalFrame* frame) {}
65 virtual void DidCreateDocumentElement(blink::WebLocalFrame* frame) {}
66 virtual void FrameCreated(blink::WebLocalFrame* parent,
67 blink::WebFrame* frame) {}
68 virtual void FrameDetached(blink::WebFrame* frame) {}
69 virtual void FrameWillClose(blink::WebFrame* frame) {}
70 virtual void DidMatchCSS(
71 blink::WebLocalFrame* frame,
72 const blink::WebVector<blink::WebString>& newly_matching_selectors,
73 const blink::WebVector<blink::WebString>& stopped_matching_selectors) {}
74 virtual void WillSendSubmitEvent(blink::WebLocalFrame* frame,
75 const blink::WebFormElement& form) {}
76 virtual void WillSubmitForm(blink::WebLocalFrame* frame,
77 const blink::WebFormElement& form) {}
78 virtual void DidCreateDataSource(blink::WebLocalFrame* frame,
79 blink::WebDataSource* ds) {}
80 virtual void PrintPage(blink::WebLocalFrame* frame, bool user_initiated) {}
81 virtual void FocusedNodeChanged(const blink::WebNode& node) {}
82 virtual void DidChangeScrollOffset(blink::WebLocalFrame* frame) {}
83 virtual void DraggableRegionsChanged(blink::WebFrame* frame) {}
84 virtual void DidCommitCompositorFrame() {}
85 virtual void DidUpdateLayout() {}
87 // These match the RenderView methods.
88 virtual void DidHandleMouseEvent(const blink::WebMouseEvent& event) {}
89 virtual void DidHandleTouchEvent(const blink::WebTouchEvent& event) {}
90 virtual void DidHandleGestureEvent(const blink::WebGestureEvent& event) {}
92 // These match incoming IPCs.
93 virtual void Navigate(const GURL& url) {}
94 virtual void ClosePage() {}
95 virtual void OrientationChangeEvent() {}
96 virtual void Resized() {}
98 virtual void OnStop() {}
100 // IPC::Listener implementation.
101 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
103 // IPC::Sender implementation.
104 virtual bool Send(IPC::Message* message) OVERRIDE;
106 RenderView* render_view() const;
107 int routing_id() const { return routing_id_; }
109 protected:
110 explicit RenderViewObserver(RenderView* render_view);
111 virtual ~RenderViewObserver();
113 // Sets |render_view_| to track.
114 // Removes itself of previous (if any) |render_view_| observer list and adds
115 // to the new |render_view|. Since it assumes that observer outlives
116 // render_view, OnDestruct should be overridden.
117 void Observe(RenderView* render_view);
119 private:
120 friend class RenderViewImpl;
122 // This is called by the RenderView when it's going away so that this object
123 // can null out its pointer.
124 void RenderViewGone();
126 RenderView* render_view_;
127 // The routing ID of the associated RenderView.
128 int routing_id_;
130 DISALLOW_COPY_AND_ASSIGN(RenderViewObserver);
133 } // namespace content
135 #endif // CONTENT_PUBLIC_RENDERER_RENDER_VIEW_OBSERVER_H_