| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_GUEST_VIEW_RENDERER_GUEST_VIEW_CONTAINER_H_ | 5 #ifndef COMPONENTS_GUEST_VIEW_RENDERER_GUEST_VIEW_CONTAINER_H_ |
| 6 #define COMPONENTS_GUEST_VIEW_RENDERER_GUEST_VIEW_CONTAINER_H_ | 6 #define COMPONENTS_GUEST_VIEW_RENDERER_GUEST_VIEW_CONTAINER_H_ |
| 7 | 7 |
| 8 #include "base/memory/linked_ptr.h" | 8 #include "base/memory/linked_ptr.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "content/public/renderer/browser_plugin_delegate.h" | 10 #include "content/public/renderer/browser_plugin_delegate.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 static GuestViewContainer* FromID(int element_instance_id); | 22 static GuestViewContainer* FromID(int element_instance_id); |
| 23 | 23 |
| 24 // IssueRequest queues up a |request| until the container is ready and | 24 // IssueRequest queues up a |request| until the container is ready and |
| 25 // the browser process has responded to the last request if it's still | 25 // the browser process has responded to the last request if it's still |
| 26 // pending. | 26 // pending. |
| 27 void IssueRequest(linked_ptr<GuestViewRequest> request); | 27 void IssueRequest(linked_ptr<GuestViewRequest> request); |
| 28 | 28 |
| 29 int element_instance_id() const { return element_instance_id_; } | 29 int element_instance_id() const { return element_instance_id_; } |
| 30 content::RenderFrame* render_frame() const { return render_frame_; } | 30 content::RenderFrame* render_frame() const { return render_frame_; } |
| 31 | 31 |
| 32 // Called by GuestViewContainerDispatcher to dispatch message to this |
| 33 // container. |
| 34 bool OnMessageReceived(const IPC::Message& message); |
| 35 |
| 32 // Called when the embedding RenderFrame is destroyed. | 36 // Called when the embedding RenderFrame is destroyed. |
| 33 virtual void OnRenderFrameDestroyed() {} | 37 virtual void OnRenderFrameDestroyed() {} |
| 34 | 38 |
| 35 // Called to respond to IPCs from the browser process that have not been | 39 // Called to respond to IPCs from the browser process that have not been |
| 36 // handled by GuestViewContainer. | 40 // handled by GuestViewContainer. |
| 37 virtual bool OnMessage(const IPC::Message& message); | 41 virtual bool OnMessage(const IPC::Message& message); |
| 38 | 42 |
| 39 // Called to perform actions when a GuestViewContainer gets a geometry. | 43 // Called to perform actions when a GuestViewContainer gets a geometry. |
| 40 virtual void OnReady() {} | 44 virtual void OnReady() {} |
| 41 | 45 |
| 42 private: | 46 private: |
| 43 class RenderFrameLifetimeObserver; | 47 class RenderFrameLifetimeObserver; |
| 44 friend class RenderFrameLifetimeObserver; | 48 friend class RenderFrameLifetimeObserver; |
| 45 | 49 |
| 46 void RenderFrameDestroyed(); | 50 void RenderFrameDestroyed(); |
| 47 | 51 |
| 48 void EnqueueRequest(linked_ptr<GuestViewRequest> request); | 52 void EnqueueRequest(linked_ptr<GuestViewRequest> request); |
| 49 void PerformPendingRequest(); | 53 void PerformPendingRequest(); |
| 50 void HandlePendingResponseCallback(const IPC::Message& message); | 54 void HandlePendingResponseCallback(const IPC::Message& message); |
| 51 | 55 |
| 52 void OnHandleCallback(const IPC::Message& message); | 56 void OnHandleCallback(const IPC::Message& message); |
| 53 | 57 |
| 54 // BrowserPluginDelegate implementation. | 58 // BrowserPluginDelegate implementation. |
| 55 bool OnMessageReceived(const IPC::Message& message) final; | |
| 56 void Ready() final; | 59 void Ready() final; |
| 57 void SetElementInstanceID(int element_instance_id) final; | 60 void SetElementInstanceID(int element_instance_id) final; |
| 58 | 61 |
| 59 int element_instance_id_; | 62 int element_instance_id_; |
| 60 content::RenderFrame* render_frame_; | 63 content::RenderFrame* render_frame_; |
| 61 scoped_ptr<RenderFrameLifetimeObserver> render_frame_lifetime_observer_; | 64 scoped_ptr<RenderFrameLifetimeObserver> render_frame_lifetime_observer_; |
| 62 | 65 |
| 63 bool ready_; | 66 bool ready_; |
| 64 | 67 |
| 65 std::deque<linked_ptr<GuestViewRequest> > pending_requests_; | 68 std::deque<linked_ptr<GuestViewRequest> > pending_requests_; |
| 66 linked_ptr<GuestViewRequest> pending_response_; | 69 linked_ptr<GuestViewRequest> pending_response_; |
| 67 | 70 |
| 68 DISALLOW_COPY_AND_ASSIGN(GuestViewContainer); | 71 DISALLOW_COPY_AND_ASSIGN(GuestViewContainer); |
| 69 }; | 72 }; |
| 70 | 73 |
| 71 } // namespace guest_view | 74 } // namespace guest_view |
| 72 | 75 |
| 73 #endif // COMPONENTS_GUEST_VIEW_RENDERER_GUEST_VIEW_CONTAINER_H_ | 76 #endif // COMPONENTS_GUEST_VIEW_RENDERER_GUEST_VIEW_CONTAINER_H_ |
| OLD | NEW |