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 EXTENSIONS_RENDERER_GUEST_VIEW_EXTENSIONS_GUEST_VIEW_CONTAINER_H_ | 5 #ifndef EXTENSIONS_RENDERER_GUEST_VIEW_EXTENSIONS_GUEST_VIEW_CONTAINER_H_ |
6 #define EXTENSIONS_RENDERER_GUEST_VIEW_EXTENSIONS_GUEST_VIEW_CONTAINER_H_ | 6 #define EXTENSIONS_RENDERER_GUEST_VIEW_EXTENSIONS_GUEST_VIEW_CONTAINER_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "extensions/renderer/guest_view/guest_view_container.h" | 13 #include "extensions/renderer/guest_view/guest_view_container.h" |
14 #include "extensions/renderer/scoped_persistent.h" | 14 #include "extensions/renderer/scoped_persistent.h" |
15 | 15 |
| 16 namespace gfx { |
| 17 class Size; |
| 18 } |
| 19 |
16 namespace extensions { | 20 namespace extensions { |
17 | 21 |
18 class ExtensionsGuestViewContainer : public GuestViewContainer { | 22 class ExtensionsGuestViewContainer : public GuestViewContainer { |
19 public: | 23 public: |
20 | 24 |
21 class Request { | 25 class Request { |
22 public: | 26 public: |
23 Request(GuestViewContainer* container, | 27 Request(GuestViewContainer* container, |
24 v8::Handle<v8::Function> callback, | 28 v8::Handle<v8::Function> callback, |
25 v8::Isolate* isolate); | 29 v8::Isolate* isolate); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 }; | 79 }; |
76 | 80 |
77 explicit ExtensionsGuestViewContainer(content::RenderFrame* render_frame); | 81 explicit ExtensionsGuestViewContainer(content::RenderFrame* render_frame); |
78 ~ExtensionsGuestViewContainer() override; | 82 ~ExtensionsGuestViewContainer() override; |
79 | 83 |
80 static ExtensionsGuestViewContainer* FromID(int element_instance_id); | 84 static ExtensionsGuestViewContainer* FromID(int element_instance_id); |
81 | 85 |
82 void IssueRequest(linked_ptr<Request> request); | 86 void IssueRequest(linked_ptr<Request> request); |
83 void RegisterDestructionCallback(v8::Handle<v8::Function> callback, | 87 void RegisterDestructionCallback(v8::Handle<v8::Function> callback, |
84 v8::Isolate* isolate); | 88 v8::Isolate* isolate); |
| 89 void RegisterElementResizeCallback(v8::Handle<v8::Function> callback, |
| 90 v8::Isolate* isolate); |
85 | 91 |
86 // BrowserPluginDelegate implementation. | 92 // BrowserPluginDelegate implementation. |
87 bool OnMessageReceived(const IPC::Message& message) override; | 93 bool OnMessageReceived(const IPC::Message& message) override; |
88 void SetElementInstanceID(int element_instance_id) override; | 94 void SetElementInstanceID(int element_instance_id) override; |
89 void Ready() override; | 95 void Ready() override; |
| 96 void DidResizeElement(const gfx::Size& old_size, |
| 97 const gfx::Size& new_size) override; |
90 | 98 |
91 private: | 99 private: |
92 void OnHandleCallback(const IPC::Message& message); | 100 void OnHandleCallback(const IPC::Message& message); |
93 | 101 |
94 void EnqueueRequest(linked_ptr<Request> request); | 102 void EnqueueRequest(linked_ptr<Request> request); |
95 void PerformPendingRequest(); | 103 void PerformPendingRequest(); |
96 void HandlePendingResponseCallback(const IPC::Message& message); | 104 void HandlePendingResponseCallback(const IPC::Message& message); |
97 | 105 |
98 bool ready_; | 106 bool ready_; |
99 | 107 |
100 std::deque<linked_ptr<Request> > pending_requests_; | 108 std::deque<linked_ptr<Request> > pending_requests_; |
101 linked_ptr<Request> pending_response_; | 109 linked_ptr<Request> pending_response_; |
102 | 110 |
103 ScopedPersistent<v8::Function> destruction_callback_; | 111 ScopedPersistent<v8::Function> destruction_callback_; |
104 v8::Isolate* destruction_isolate_; | 112 v8::Isolate* destruction_isolate_; |
105 | 113 |
| 114 ScopedPersistent<v8::Function> element_resize_callback_; |
| 115 v8::Isolate* element_resize_isolate_; |
| 116 |
106 DISALLOW_COPY_AND_ASSIGN(ExtensionsGuestViewContainer); | 117 DISALLOW_COPY_AND_ASSIGN(ExtensionsGuestViewContainer); |
107 }; | 118 }; |
108 | 119 |
109 } // namespace extensions | 120 } // namespace extensions |
110 | 121 |
111 #endif // EXTENSIONS_RENDERER_GUEST_VIEW_EXTENSIONS_GUEST_VIEW_CONTAINER_H_ | 122 #endif // EXTENSIONS_RENDERER_GUEST_VIEW_EXTENSIONS_GUEST_VIEW_CONTAINER_H_ |
OLD | NEW |