| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 virtual void OnReady() {} | 59 virtual void OnReady() {} |
| 60 | 60 |
| 61 // Called to perform actions when a GuestViewContainer is about to be | 61 // Called to perform actions when a GuestViewContainer is about to be |
| 62 // destroyed. | 62 // destroyed. |
| 63 // Note that this should be called exactly once. | 63 // Note that this should be called exactly once. |
| 64 virtual void OnDestroy(bool embedder_frame_destroyed) {} | 64 virtual void OnDestroy(bool embedder_frame_destroyed) {} |
| 65 | 65 |
| 66 // BrowserPluginGuestDelegate public implementation. | 66 // BrowserPluginGuestDelegate public implementation. |
| 67 void SetElementInstanceID(int element_instance_id) final; | 67 void SetElementInstanceID(int element_instance_id) final; |
| 68 void DidResizeElement(const gfx::Size& new_size) override; | 68 void DidResizeElement(const gfx::Size& new_size) override; |
| 69 base::WeakPtr<BrowserPluginDelegate> GetWeakPtr() final; |
| 69 | 70 |
| 70 protected: | 71 protected: |
| 71 ~GuestViewContainer() override; | 72 ~GuestViewContainer() override; |
| 72 | 73 |
| 73 bool ready_; | 74 bool ready_; |
| 74 | 75 |
| 75 void OnHandleCallback(const IPC::Message& message); | 76 void OnHandleCallback(const IPC::Message& message); |
| 76 | 77 |
| 77 private: | 78 private: |
| 78 class RenderFrameLifetimeObserver; | 79 class RenderFrameLifetimeObserver; |
| 79 friend class RenderFrameLifetimeObserver; | 80 friend class RenderFrameLifetimeObserver; |
| 80 | 81 |
| 81 void RenderFrameDestroyed(); | 82 void RenderFrameDestroyed(); |
| 82 | 83 |
| 83 void EnqueueRequest(std::unique_ptr<GuestViewRequest> request); | 84 void EnqueueRequest(std::unique_ptr<GuestViewRequest> request); |
| 84 void PerformPendingRequest(); | 85 void PerformPendingRequest(); |
| 85 void HandlePendingResponseCallback(const IPC::Message& message); | 86 void HandlePendingResponseCallback(const IPC::Message& message); |
| 86 void RunDestructionCallback(bool embedder_frame_destroyed); | 87 void RunDestructionCallback(bool embedder_frame_destroyed); |
| 87 void CallElementResizeCallback(const gfx::Size& new_size); | 88 void CallElementResizeCallback(const gfx::Size& new_size); |
| 88 | 89 |
| 89 // BrowserPluginDelegate implementation. | 90 // BrowserPluginDelegate implementation. |
| 90 void Ready() final; | 91 void Ready() final; |
| 91 void DidDestroyElement() final; | 92 void DidDestroyElement() final; |
| 92 base::WeakPtr<BrowserPluginDelegate> GetWeakPtr() final; | |
| 93 | 93 |
| 94 int element_instance_id_; | 94 int element_instance_id_; |
| 95 content::RenderFrame* render_frame_; | 95 content::RenderFrame* render_frame_; |
| 96 std::unique_ptr<RenderFrameLifetimeObserver> render_frame_lifetime_observer_; | 96 std::unique_ptr<RenderFrameLifetimeObserver> render_frame_lifetime_observer_; |
| 97 | 97 |
| 98 bool in_destruction_; | 98 bool in_destruction_; |
| 99 | 99 |
| 100 std::deque<std::unique_ptr<GuestViewRequest>> pending_requests_; | 100 std::deque<std::unique_ptr<GuestViewRequest>> pending_requests_; |
| 101 std::unique_ptr<GuestViewRequest> pending_response_; | 101 std::unique_ptr<GuestViewRequest> pending_response_; |
| 102 | 102 |
| 103 v8::Global<v8::Function> destruction_callback_; | 103 v8::Global<v8::Function> destruction_callback_; |
| 104 v8::Isolate* destruction_isolate_; | 104 v8::Isolate* destruction_isolate_; |
| 105 | 105 |
| 106 v8::Global<v8::Function> element_resize_callback_; | 106 v8::Global<v8::Function> element_resize_callback_; |
| 107 v8::Isolate* element_resize_isolate_; | 107 v8::Isolate* element_resize_isolate_; |
| 108 | 108 |
| 109 base::WeakPtrFactory<GuestViewContainer> weak_ptr_factory_; | 109 base::WeakPtrFactory<GuestViewContainer> weak_ptr_factory_; |
| 110 | 110 |
| 111 DISALLOW_COPY_AND_ASSIGN(GuestViewContainer); | 111 DISALLOW_COPY_AND_ASSIGN(GuestViewContainer); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 } // namespace guest_view | 114 } // namespace guest_view |
| 115 | 115 |
| 116 #endif // COMPONENTS_GUEST_VIEW_RENDERER_GUEST_VIEW_CONTAINER_H_ | 116 #endif // COMPONENTS_GUEST_VIEW_RENDERER_GUEST_VIEW_CONTAINER_H_ |
| OLD | NEW |