| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_PUBLIC_RENDERER_RENDER_VIEW_OBSERVER_H_ | 5 #ifndef CONTENT_PUBLIC_RENDERER_RENDER_VIEW_OBSERVER_H_ |
| 6 #define CONTENT_PUBLIC_RENDERER_RENDER_VIEW_OBSERVER_H_ | 6 #define CONTENT_PUBLIC_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 "base/compiler_specific.h" |
| 10 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 11 #include "ipc/ipc_channel.h" | 12 #include "ipc/ipc_listener.h" |
| 13 #include "ipc/ipc_sender.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIconURL.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIconURL.h" |
| 13 | 15 |
| 14 class RenderViewImpl; | 16 class RenderViewImpl; |
| 15 | 17 |
| 16 namespace WebKit { | 18 namespace WebKit { |
| 17 class WebDataSource; | 19 class WebDataSource; |
| 18 class WebFrame; | 20 class WebFrame; |
| 19 class WebFormElement; | 21 class WebFormElement; |
| 20 class WebMediaPlayerClient; | 22 class WebMediaPlayerClient; |
| 21 class WebMouseEvent; | 23 class WebMouseEvent; |
| 22 class WebNode; | 24 class WebNode; |
| 23 class WebTouchEvent; | 25 class WebTouchEvent; |
| 24 class WebURL; | 26 class WebURL; |
| 25 struct WebURLError; | 27 struct WebURLError; |
| 26 } | 28 } |
| 27 | 29 |
| 28 namespace content { | 30 namespace content { |
| 29 | 31 |
| 30 class RenderView; | 32 class RenderView; |
| 31 | 33 |
| 32 // Base class for objects that want to filter incoming IPCs, and also get | 34 // Base class for objects that want to filter incoming IPCs, and also get |
| 33 // notified of changes to the frame. | 35 // notified of changes to the frame. |
| 34 class CONTENT_EXPORT RenderViewObserver : public IPC::Channel::Listener, | 36 class CONTENT_EXPORT RenderViewObserver : public IPC::Listener, |
| 35 public IPC::Message::Sender { | 37 public IPC::Sender { |
| 36 public: | 38 public: |
| 37 // By default, observers will be deleted when the RenderView goes away. If | 39 // By default, observers will be deleted when the RenderView goes away. If |
| 38 // they want to outlive it, they can override this function. | 40 // they want to outlive it, they can override this function. |
| 39 virtual void OnDestruct(); | 41 virtual void OnDestruct(); |
| 40 | 42 |
| 41 // These match the WebKit API notifications | 43 // These match the WebKit API notifications |
| 42 virtual void DidStartLoading() {} | 44 virtual void DidStartLoading() {} |
| 43 virtual void DidStopLoading() {} | 45 virtual void DidStopLoading() {} |
| 44 virtual void DidChangeIcon(WebKit::WebFrame* frame, | 46 virtual void DidChangeIcon(WebKit::WebFrame* frame, |
| 45 WebKit::WebIconURL::Type) {} | 47 WebKit::WebIconURL::Type) {} |
| (...skipping 29 matching lines...) Expand all Loading... |
| 75 | 77 |
| 76 // These match the RenderView methods. | 78 // These match the RenderView methods. |
| 77 virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) {} | 79 virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) {} |
| 78 virtual void DidHandleTouchEvent(const WebKit::WebTouchEvent& event) {} | 80 virtual void DidHandleTouchEvent(const WebKit::WebTouchEvent& event) {} |
| 79 | 81 |
| 80 // These match incoming IPCs. | 82 // These match incoming IPCs. |
| 81 virtual void ContextMenuAction(unsigned id) {} | 83 virtual void ContextMenuAction(unsigned id) {} |
| 82 virtual void Navigate(const GURL& url) {} | 84 virtual void Navigate(const GURL& url) {} |
| 83 virtual void ClosePage() {} | 85 virtual void ClosePage() {} |
| 84 | 86 |
| 85 // IPC::Channel::Listener implementation. | 87 // IPC::Listener implementation. |
| 86 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 88 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 87 | 89 |
| 88 protected: | 90 protected: |
| 89 explicit RenderViewObserver(RenderView* render_view); | 91 explicit RenderViewObserver(RenderView* render_view); |
| 90 virtual ~RenderViewObserver(); | 92 virtual ~RenderViewObserver(); |
| 91 | 93 |
| 92 // IPC::Message::Sender implementation. | 94 // IPC::Sender implementation. |
| 93 virtual bool Send(IPC::Message* message) OVERRIDE; | 95 virtual bool Send(IPC::Message* message) OVERRIDE; |
| 94 | 96 |
| 95 RenderView* render_view(); | 97 RenderView* render_view(); |
| 96 int routing_id() { return routing_id_; } | 98 int routing_id() { return routing_id_; } |
| 97 | 99 |
| 98 private: | 100 private: |
| 99 friend class ::RenderViewImpl; | 101 friend class ::RenderViewImpl; |
| 100 | 102 |
| 101 // This is called by the RenderView when it's going away so that this object | 103 // This is called by the RenderView when it's going away so that this object |
| 102 // can null out its pointer. | 104 // can null out its pointer. |
| 103 void RenderViewGone(); | 105 void RenderViewGone(); |
| 104 | 106 |
| 105 RenderView* render_view_; | 107 RenderView* render_view_; |
| 106 // The routing ID of the associated RenderView. | 108 // The routing ID of the associated RenderView. |
| 107 int routing_id_; | 109 int routing_id_; |
| 108 | 110 |
| 109 DISALLOW_COPY_AND_ASSIGN(RenderViewObserver); | 111 DISALLOW_COPY_AND_ASSIGN(RenderViewObserver); |
| 110 }; | 112 }; |
| 111 | 113 |
| 112 } // namespace content | 114 } // namespace content |
| 113 | 115 |
| 114 #endif // CONTENT_PUBLIC_RENDERER_RENDER_VIEW_OBSERVER_H_ | 116 #endif // CONTENT_PUBLIC_RENDERER_RENDER_VIEW_OBSERVER_H_ |
| OLD | NEW |