OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_RENDERER_RENDER_VIEW_OBSERVER_H_ | 5 #ifndef CHROME_RENDERER_RENDER_VIEW_OBSERVER_H_ |
6 #define CHROME_RENDERER_RENDER_VIEW_OBSERVER_H_ | 6 #define CHROME_RENDERER_RENDER_VIEW_OBSERVER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "ipc/ipc_channel.h" | 10 #include "ipc/ipc_channel.h" |
11 | 11 |
12 class RenderView; | 12 class RenderView; |
13 | 13 |
14 namespace WebKit { | 14 namespace WebKit { |
15 class WebFrame; | 15 class WebFrame; |
16 class WebMouseEvent; | 16 class WebMouseEvent; |
| 17 struct WebURLError; |
17 } | 18 } |
18 | 19 |
19 // Base class for objects that want to filter incoming IPCs, and also get | 20 // Base class for objects that want to filter incoming IPCs, and also get |
20 // notified of changes to the frame. | 21 // notified of changes to the frame. |
21 class RenderViewObserver : public IPC::Channel::Listener, | 22 class RenderViewObserver : public IPC::Channel::Listener, |
22 public IPC::Message::Sender { | 23 public IPC::Message::Sender { |
23 public: | 24 public: |
24 // By default, observers will be deleted when the RenderView goes away. If | 25 // By default, observers will be deleted when the RenderView goes away. If |
25 // they want to outlive it, they can override this function. | 26 // they want to outlive it, they can override this function. |
26 virtual void OnDestruct(); | 27 virtual void OnDestruct(); |
27 | 28 |
28 // These match the WebKit API notifications. | 29 // These match the WebKit API notifications. |
29 virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame) {} | 30 virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame) {} |
| 31 virtual void DidFailLoad(WebKit::WebFrame* frame, |
| 32 const WebKit::WebURLError& error) {} |
30 virtual void DidFinishLoad(WebKit::WebFrame* frame) {} | 33 virtual void DidFinishLoad(WebKit::WebFrame* frame) {} |
| 34 virtual void DidStartProvisionalLoad(WebKit::WebFrame* frame) {} |
| 35 virtual void DidFailProvisionalLoad(WebKit::WebFrame* frame, |
| 36 const WebKit::WebURLError& error) {} |
| 37 virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame, |
| 38 bool is_new_navigation) {} |
31 virtual void FrameDetached(WebKit::WebFrame* frame) {} | 39 virtual void FrameDetached(WebKit::WebFrame* frame) {} |
32 virtual void FrameWillClose(WebKit::WebFrame* frame) {} | 40 virtual void FrameWillClose(WebKit::WebFrame* frame) {} |
33 | 41 |
34 // These match the RenderView methods below. | 42 // These match the RenderView methods below. |
35 virtual void FrameTranslated(WebKit::WebFrame* frame) {} | 43 virtual void FrameTranslated(WebKit::WebFrame* frame) {} |
36 virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) {} | 44 virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) {} |
| 45 virtual void PageCaptured(const string16& page_text) {} |
37 | 46 |
38 protected: | 47 protected: |
39 RenderViewObserver(RenderView* render_view); | 48 RenderViewObserver(RenderView* render_view); |
40 virtual ~RenderViewObserver(); | 49 virtual ~RenderViewObserver(); |
41 | 50 |
42 // IPC::Channel::Listener implementation. | 51 // IPC::Channel::Listener implementation. |
43 virtual bool OnMessageReceived(const IPC::Message& message); | 52 virtual bool OnMessageReceived(const IPC::Message& message); |
44 | 53 |
45 // IPC::Message::Sender implementation. | 54 // IPC::Message::Sender implementation. |
46 virtual bool Send(IPC::Message* message); | 55 virtual bool Send(IPC::Message* message); |
47 | 56 |
48 RenderView* render_view() { return render_view_; } | 57 RenderView* render_view() { return render_view_; } |
49 int routing_id() { return routing_id_; } | 58 int routing_id() { return routing_id_; } |
50 | 59 |
51 private: | 60 private: |
52 friend class RenderView; | 61 friend class RenderView; |
53 | 62 |
54 void set_render_view(RenderView* rv) { render_view_ = rv; } | 63 void set_render_view(RenderView* rv) { render_view_ = rv; } |
55 | 64 |
56 RenderView* render_view_; | 65 RenderView* render_view_; |
57 // The routing ID of the associated RenderView. | 66 // The routing ID of the associated RenderView. |
58 int routing_id_; | 67 int routing_id_; |
59 | 68 |
60 DISALLOW_COPY_AND_ASSIGN(RenderViewObserver); | 69 DISALLOW_COPY_AND_ASSIGN(RenderViewObserver); |
61 }; | 70 }; |
62 | 71 |
63 #endif // CHROME_RENDERER_RENDER_VIEW_OBSERVER_H_ | 72 #endif // CHROME_RENDERER_RENDER_VIEW_OBSERVER_H_ |
OLD | NEW |