| 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 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // IPC::Sender implementation. | 114 // IPC::Sender implementation. |
| 115 virtual bool Send(IPC::Message* message) OVERRIDE; | 115 virtual bool Send(IPC::Message* message) OVERRIDE; |
| 116 | 116 |
| 117 RenderView* render_view() const; | 117 RenderView* render_view() const; |
| 118 int routing_id() const { return routing_id_; } | 118 int routing_id() const { return routing_id_; } |
| 119 | 119 |
| 120 protected: | 120 protected: |
| 121 explicit RenderViewObserver(RenderView* render_view); | 121 explicit RenderViewObserver(RenderView* render_view); |
| 122 virtual ~RenderViewObserver(); | 122 virtual ~RenderViewObserver(); |
| 123 | 123 |
| 124 // Sets |render_view_| to track. | |
| 125 // Removes itself of previous (if any) |render_view_| observer list and adds | |
| 126 // to the new |render_view|. Since it assumes that observer outlives | |
| 127 // render_view, OnDestruct should be overridden. | |
| 128 void Observe(RenderView* render_view); | |
| 129 | |
| 130 private: | 124 private: |
| 131 friend class RenderViewImpl; | 125 friend class RenderViewImpl; |
| 132 | 126 |
| 133 // This is called by the RenderView when it's going away so that this object | 127 // This is called by the RenderView when it's going away so that this object |
| 134 // can null out its pointer. | 128 // can null out its pointer. |
| 135 void RenderViewGone(); | 129 void RenderViewGone(); |
| 136 | 130 |
| 137 RenderView* render_view_; | 131 RenderView* render_view_; |
| 138 // The routing ID of the associated RenderView. | 132 // The routing ID of the associated RenderView. |
| 139 int routing_id_; | 133 int routing_id_; |
| 140 | 134 |
| 141 DISALLOW_COPY_AND_ASSIGN(RenderViewObserver); | 135 DISALLOW_COPY_AND_ASSIGN(RenderViewObserver); |
| 142 }; | 136 }; |
| 143 | 137 |
| 144 } // namespace content | 138 } // namespace content |
| 145 | 139 |
| 146 #endif // CONTENT_PUBLIC_RENDERER_RENDER_VIEW_OBSERVER_H_ | 140 #endif // CONTENT_PUBLIC_RENDERER_RENDER_VIEW_OBSERVER_H_ |
| OLD | NEW |