| 
									
										
										
										
											2015-03-13 16:33:06 -07:00
										 |  |  | // Copyright (c) 2015 GitHub, Inc.
 | 
					
						
							|  |  |  | // Use of this source code is governed by the MIT license that can be
 | 
					
						
							|  |  |  | // found in the LICENSE file.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef ATOM_RENDERER_GUEST_VIEW_CONTAINER_H_
 | 
					
						
							|  |  |  | #define ATOM_RENDERER_GUEST_VIEW_CONTAINER_H_
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-29 13:47:09 +08:00
										 |  |  | #include "base/callback.h"
 | 
					
						
							| 
									
										
										
										
											2015-03-13 16:33:06 -07:00
										 |  |  | #include "content/public/renderer/browser_plugin_delegate.h"
 | 
					
						
							| 
									
										
										
										
											2017-01-24 16:45:26 +09:00
										 |  |  | #include "content/public/renderer/render_frame.h"
 | 
					
						
							| 
									
										
										
										
											2015-05-29 13:47:09 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace gfx { | 
					
						
							|  |  |  | class Size; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2015-03-13 16:33:06 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace atom { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class GuestViewContainer : public content::BrowserPluginDelegate { | 
					
						
							|  |  |  |  public: | 
					
						
							| 
									
										
										
										
											2015-08-04 17:07:31 +08:00
										 |  |  |   typedef base::Callback<void(const gfx::Size&)> ResizeCallback; | 
					
						
							| 
									
										
										
										
											2015-05-29 13:47:09 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-13 16:33:06 -07:00
										 |  |  |   explicit GuestViewContainer(content::RenderFrame* render_frame); | 
					
						
							|  |  |  |   ~GuestViewContainer() override; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-29 13:47:09 +08:00
										 |  |  |   static GuestViewContainer* FromID(int element_instance_id); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   void RegisterElementResizeCallback(const ResizeCallback& callback); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // content::BrowserPluginDelegate:
 | 
					
						
							|  |  |  |   void SetElementInstanceID(int element_instance_id) final; | 
					
						
							| 
									
										
										
										
											2015-08-04 17:07:31 +08:00
										 |  |  |   void DidResizeElement(const gfx::Size& new_size) final; | 
					
						
							| 
									
										
										
										
											2015-09-02 15:16:49 +08:00
										 |  |  |   base::WeakPtr<BrowserPluginDelegate> GetWeakPtr() final; | 
					
						
							| 
									
										
										
										
											2015-05-29 13:47:09 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-13 16:33:06 -07:00
										 |  |  |  private: | 
					
						
							| 
									
										
										
										
											2015-05-29 13:47:09 +08:00
										 |  |  |   int element_instance_id_; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   ResizeCallback element_resize_callback_; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-02 15:16:49 +08:00
										 |  |  |   base::WeakPtrFactory<GuestViewContainer> weak_ptr_factory_; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-13 16:33:06 -07:00
										 |  |  |   DISALLOW_COPY_AND_ASSIGN(GuestViewContainer); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | }  // namespace atom
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif  // ATOM_RENDERER_GUEST_VIEW_CONTAINER_H_
 |