| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 virtual bool OnMessage(const IPC::Message& message); | 45 virtual bool OnMessage(const IPC::Message& message); |
| 46 | 46 |
| 47 // Called to perform actions when a GuestViewContainer gets a geometry. | 47 // Called to perform actions when a GuestViewContainer gets a geometry. |
| 48 virtual void OnReady() {} | 48 virtual void OnReady() {} |
| 49 | 49 |
| 50 // Called to perform actions when a GuestViewContainer is about to be | 50 // Called to perform actions when a GuestViewContainer is about to be |
| 51 // destroyed. | 51 // destroyed. |
| 52 // Note that this should be called exactly once. | 52 // Note that this should be called exactly once. |
| 53 virtual void OnDestroy(bool embedder_frame_destroyed) {} | 53 virtual void OnDestroy(bool embedder_frame_destroyed) {} |
| 54 | 54 |
| 55 // BrowserPluginGuestDelegate public implementation. |
| 56 void SetElementInstanceID(int element_instance_id) final; |
| 57 |
| 55 protected: | 58 protected: |
| 56 ~GuestViewContainer() override; | 59 ~GuestViewContainer() override; |
| 57 | 60 |
| 61 bool ready_; |
| 62 |
| 63 void OnHandleCallback(const IPC::Message& message); |
| 64 |
| 58 private: | 65 private: |
| 59 class RenderFrameLifetimeObserver; | 66 class RenderFrameLifetimeObserver; |
| 60 friend class RenderFrameLifetimeObserver; | 67 friend class RenderFrameLifetimeObserver; |
| 61 | 68 |
| 62 void RenderFrameDestroyed(); | 69 void RenderFrameDestroyed(); |
| 63 | 70 |
| 64 void EnqueueRequest(linked_ptr<GuestViewRequest> request); | 71 void EnqueueRequest(linked_ptr<GuestViewRequest> request); |
| 65 void PerformPendingRequest(); | 72 void PerformPendingRequest(); |
| 66 void HandlePendingResponseCallback(const IPC::Message& message); | 73 void HandlePendingResponseCallback(const IPC::Message& message); |
| 67 | 74 |
| 68 void OnHandleCallback(const IPC::Message& message); | |
| 69 | |
| 70 // BrowserPluginDelegate implementation. | 75 // BrowserPluginDelegate implementation. |
| 71 void Ready() final; | 76 void Ready() final; |
| 72 void SetElementInstanceID(int element_instance_id) final; | |
| 73 void DidDestroyElement() final; | 77 void DidDestroyElement() final; |
| 74 base::WeakPtr<BrowserPluginDelegate> GetWeakPtr() final; | 78 base::WeakPtr<BrowserPluginDelegate> GetWeakPtr() final; |
| 75 | 79 |
| 76 int element_instance_id_; | 80 int element_instance_id_; |
| 77 content::RenderFrame* render_frame_; | 81 content::RenderFrame* render_frame_; |
| 78 scoped_ptr<RenderFrameLifetimeObserver> render_frame_lifetime_observer_; | 82 scoped_ptr<RenderFrameLifetimeObserver> render_frame_lifetime_observer_; |
| 79 | 83 |
| 80 bool ready_; | |
| 81 bool in_destruction_; | 84 bool in_destruction_; |
| 82 | 85 |
| 83 std::deque<linked_ptr<GuestViewRequest> > pending_requests_; | 86 std::deque<linked_ptr<GuestViewRequest> > pending_requests_; |
| 84 linked_ptr<GuestViewRequest> pending_response_; | 87 linked_ptr<GuestViewRequest> pending_response_; |
| 85 | 88 |
| 86 base::WeakPtrFactory<GuestViewContainer> weak_ptr_factory_; | 89 base::WeakPtrFactory<GuestViewContainer> weak_ptr_factory_; |
| 87 | 90 |
| 88 DISALLOW_COPY_AND_ASSIGN(GuestViewContainer); | 91 DISALLOW_COPY_AND_ASSIGN(GuestViewContainer); |
| 89 }; | 92 }; |
| 90 | 93 |
| 91 } // namespace guest_view | 94 } // namespace guest_view |
| 92 | 95 |
| 93 #endif // COMPONENTS_GUEST_VIEW_RENDERER_GUEST_VIEW_CONTAINER_H_ | 96 #endif // COMPONENTS_GUEST_VIEW_RENDERER_GUEST_VIEW_CONTAINER_H_ |
| OLD | NEW |