Dismiss autofill popup on screen orientation change.
[chromium-blink-merge.git] / content / public / renderer / render_view_observer.h
blob10dad336607c8e4d37da75a257a1a93a4c3a8f63
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/web/WebIconURL.h"
15 class GURL;
17 namespace ppapi {
18 namespace host {
19 class PpapiHost;
23 namespace WebKit {
24 class WebDataSource;
25 class WebFrame;
26 class WebFormElement;
27 class WebGestureEvent;
28 class WebMediaPlayerClient;
29 class WebMouseEvent;
30 class WebNode;
31 class WebTouchEvent;
32 class WebURL;
33 struct WebContextMenuData;
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(WebKit::WebFrame* frame) {}
56 virtual void DidFailLoad(WebKit::WebFrame* frame,
57 const WebKit::WebURLError& error) {}
58 virtual void DidFinishLoad(WebKit::WebFrame* frame) {}
59 virtual void DidStartProvisionalLoad(WebKit::WebFrame* frame) {}
60 virtual void DidFailProvisionalLoad(WebKit::WebFrame* frame,
61 const WebKit::WebURLError& error) {}
62 virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame,
63 bool is_new_navigation) {}
64 virtual void DidClearWindowObject(WebKit::WebFrame* frame) {}
65 virtual void DidCreateDocumentElement(WebKit::WebFrame* frame) {}
66 virtual void FrameCreated(WebKit::WebFrame* parent,
67 WebKit::WebFrame* frame) {}
68 virtual void FrameDetached(WebKit::WebFrame* frame) {}
69 virtual void FrameWillClose(WebKit::WebFrame* frame) {}
70 virtual void WillSendSubmitEvent(WebKit::WebFrame* frame,
71 const WebKit::WebFormElement& form) {}
72 virtual void WillSubmitForm(WebKit::WebFrame* frame,
73 const WebKit::WebFormElement& form) {}
74 virtual void DidCreateDataSource(WebKit::WebFrame* frame,
75 WebKit::WebDataSource* ds) {}
76 virtual void PrintPage(WebKit::WebFrame* frame, bool user_initiated) {}
77 virtual void FocusedNodeChanged(const WebKit::WebNode& node) {}
78 virtual void WillCreateMediaPlayer(WebKit::WebFrame* frame,
79 WebKit::WebMediaPlayerClient* client) {}
80 virtual void ZoomLevelChanged() {};
81 virtual void DidChangeScrollOffset(WebKit::WebFrame* frame) {}
82 virtual void DraggableRegionsChanged(WebKit::WebFrame* frame) {}
83 virtual void DidRequestShowContextMenu(
84 WebKit::WebFrame* frame,
85 const WebKit::WebContextMenuData& data) {}
86 virtual void DidCommitCompositorFrame() {}
88 // These match the RenderView methods.
89 virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) {}
90 virtual void DidHandleTouchEvent(const WebKit::WebTouchEvent& event) {}
91 virtual void DidHandleGestureEvent(const WebKit::WebGestureEvent& event) {}
92 virtual void DidCreatePepperPlugin(RendererPpapiHost* host) {}
94 // These match incoming IPCs.
95 virtual void Navigate(const GURL& url) {}
96 virtual void ClosePage() {}
97 virtual void OrientationChangeEvent(int orientation) {}
99 // IPC::Listener implementation.
100 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
102 // IPC::Sender implementation.
103 virtual bool Send(IPC::Message* message) OVERRIDE;
105 RenderView* render_view() const;
106 int routing_id() const { return routing_id_; }
108 protected:
109 explicit RenderViewObserver(RenderView* render_view);
110 virtual ~RenderViewObserver();
112 private:
113 friend class RenderViewImpl;
115 // This is called by the RenderView when it's going away so that this object
116 // can null out its pointer.
117 void RenderViewGone();
119 RenderView* render_view_;
120 // The routing ID of the associated RenderView.
121 int routing_id_;
123 DISALLOW_COPY_AND_ASSIGN(RenderViewObserver);
126 } // namespace content
128 #endif // CONTENT_PUBLIC_RENDERER_RENDER_VIEW_OBSERVER_H_