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 "components/guest_view/renderer/guest_view_container.h" | 10 #include "components/guest_view/renderer/guest_view_container.h" |
11 #include "v8/include/v8.h" | 11 #include "v8/include/v8.h" |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 class Size; | 14 class Size; |
15 } | 15 } |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
18 | 18 |
19 class ExtensionsGuestViewContainer : public guest_view::GuestViewContainer { | 19 class ExtensionsGuestViewContainer : public guest_view::GuestViewContainer { |
20 public: | 20 public: |
21 explicit ExtensionsGuestViewContainer(content::RenderFrame* render_frame); | 21 explicit ExtensionsGuestViewContainer(content::RenderFrame* render_frame); |
22 | 22 |
23 void RegisterDestructionCallback(v8::Local<v8::Function> callback, | |
24 v8::Isolate* isolate); | |
25 void RegisterElementResizeCallback(v8::Local<v8::Function> callback, | 23 void RegisterElementResizeCallback(v8::Local<v8::Function> callback, |
26 v8::Isolate* isolate); | 24 v8::Isolate* isolate); |
27 | 25 |
28 // BrowserPluginDelegate implementation. | 26 // BrowserPluginDelegate implementation. |
29 void DidResizeElement(const gfx::Size& new_size) override; | 27 void DidResizeElement(const gfx::Size& new_size) override; |
30 | 28 |
31 protected: | 29 protected: |
32 ~ExtensionsGuestViewContainer() override; | 30 ~ExtensionsGuestViewContainer() override; |
33 | 31 |
34 private: | 32 private: |
35 void CallElementResizeCallback(const gfx::Size& new_size); | 33 void CallElementResizeCallback(const gfx::Size& new_size); |
36 | 34 |
37 // GuestViewContainer implementation. | 35 // GuestViewContainer implementation. |
38 void OnDestroy(bool embedder_frame_destroyed) override; | 36 void OnDestroy(bool embedder_frame_destroyed) override; |
39 | 37 |
40 v8::Global<v8::Function> destruction_callback_; | |
41 v8::Isolate* destruction_isolate_; | |
42 | |
43 v8::Global<v8::Function> element_resize_callback_; | 38 v8::Global<v8::Function> element_resize_callback_; |
44 v8::Isolate* element_resize_isolate_; | 39 v8::Isolate* element_resize_isolate_; |
45 | 40 |
46 // Weak pointer factory used for calling the element resize callback. | 41 // Weak pointer factory used for calling the element resize callback. |
47 base::WeakPtrFactory<ExtensionsGuestViewContainer> weak_ptr_factory_; | 42 base::WeakPtrFactory<ExtensionsGuestViewContainer> weak_ptr_factory_; |
48 | 43 |
49 DISALLOW_COPY_AND_ASSIGN(ExtensionsGuestViewContainer); | 44 DISALLOW_COPY_AND_ASSIGN(ExtensionsGuestViewContainer); |
50 }; | 45 }; |
51 | 46 |
52 } // namespace extensions | 47 } // namespace extensions |
53 | 48 |
54 #endif // EXTENSIONS_RENDERER_GUEST_VIEW_EXTENSIONS_GUEST_VIEW_CONTAINER_H_ | 49 #endif // EXTENSIONS_RENDERER_GUEST_VIEW_EXTENSIONS_GUEST_VIEW_CONTAINER_H_ |
OLD | NEW |