| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_OBSERVER_H_ | |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_OBSERVER_H_ | |
| 7 | |
| 8 #include "ipc/ipc_channel.h" | |
| 9 #include "content/common/content_export.h" | |
| 10 | |
| 11 class GURL; | |
| 12 class RenderViewHost; | |
| 13 | |
| 14 // An observer API implemented by classes which want to filter IPC messages from | |
| 15 // RenderViewHost. | |
| 16 class CONTENT_EXPORT RenderViewHostObserver : public IPC::Channel::Listener, | |
| 17 public IPC::Message::Sender { | |
| 18 public: | |
| 19 | |
| 20 protected: | |
| 21 explicit RenderViewHostObserver(RenderViewHost* render_view_host); | |
| 22 | |
| 23 virtual ~RenderViewHostObserver(); | |
| 24 | |
| 25 // Invoked after the RenderViewHost is created in the renderer process. After | |
| 26 // this point, messages can be sent to it (or to observers in the renderer). | |
| 27 virtual void RenderViewHostInitialized(); | |
| 28 | |
| 29 // Invoked when the RenderViewHost is being destroyed. Gives subclasses a | |
| 30 // chance to cleanup. The base implementation will delete the object. | |
| 31 // |render_view_host| is passed as an argument since render_view_host() will | |
| 32 // return NULL once this method enters. | |
| 33 virtual void RenderViewHostDestroyed(RenderViewHost* render_view_host); | |
| 34 | |
| 35 // Notifies that a navigation is starting. | |
| 36 virtual void Navigate(const GURL& url); | |
| 37 | |
| 38 // IPC::Channel::Listener implementation. | |
| 39 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
| 40 | |
| 41 // IPC::Message::Sender implementation. | |
| 42 virtual bool Send(IPC::Message* message) OVERRIDE; | |
| 43 | |
| 44 RenderViewHost* render_view_host() const { return render_view_host_; } | |
| 45 int routing_id() { return routing_id_; } | |
| 46 | |
| 47 private: | |
| 48 friend class RenderViewHost; | |
| 49 | |
| 50 // Invoked from RenderViewHost. Invokes RenderViewHostDestroyed and NULL out | |
| 51 // |render_view_host_|. | |
| 52 void RenderViewHostDestruction(); | |
| 53 | |
| 54 RenderViewHost* render_view_host_; | |
| 55 | |
| 56 // The routing ID of the associated RenderViewHost. | |
| 57 int routing_id_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(RenderViewHostObserver); | |
| 60 }; | |
| 61 | |
| 62 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_OBSERVER_H_ | |
| OLD | NEW |