| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_H__ | 5 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_H__ |
| 6 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_H__ | 6 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_H__ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/id_map.h" | 11 #include "base/id_map.h" |
| 12 #include "content/common/browser_plugin_info.h" |
| 12 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 13 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 14 #include "content/public/browser/web_contents_delegate.h" | 15 #include "content/public/browser/web_contents_delegate.h" |
| 15 #include "content/public/browser/web_contents_observer.h" | 16 #include "content/public/browser/web_contents_observer.h" |
| 16 #include "ppapi/c/pp_instance.h" | 17 #include "ppapi/c/pp_instance.h" |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 18 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
| 19 #include "ui/gfx/size.h" | 20 #include "ui/gfx/size.h" |
| 20 #include "ui/surface/transport_dib.h" | 21 #include "ui/surface/transport_dib.h" |
| 21 #include "webkit/glue/webcursor.h" | 22 #include "webkit/glue/webcursor.h" |
| 22 | 23 |
| 23 class WebContentsImpl; | 24 class WebContentsImpl; |
| 25 struct BrowserPlugin_SwapInfo; |
| 24 struct BrowserPluginHostMsg_PostMessage_Params; | 26 struct BrowserPluginHostMsg_PostMessage_Params; |
| 25 struct ViewHostMsg_UpdateRect_Params; | 27 struct ViewHostMsg_UpdateRect_Params; |
| 26 | 28 |
| 27 namespace IPC { | 29 namespace IPC { |
| 28 struct ChannelHandle; | 30 struct ChannelHandle; |
| 29 } | 31 } |
| 30 | 32 |
| 31 namespace content { | 33 namespace content { |
| 32 | 34 |
| 33 class BrowserPluginHost; | 35 class BrowserPluginHost; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 55 | 57 |
| 56 // This is called on navigation of the browser plugin. On the first | 58 // This is called on navigation of the browser plugin. On the first |
| 57 // navigation, it creates a new WebContentsImpl for the guest, associates | 59 // navigation, it creates a new WebContentsImpl for the guest, associates |
| 58 // it with its embedder, and navigates it to the src URL. On subsequent | 60 // it with its embedder, and navigates it to the src URL. On subsequent |
| 59 // navigations, it calls up the guest's existign WebContents and navigates | 61 // navigations, it calls up the guest's existign WebContents and navigates |
| 60 // it. | 62 // it. |
| 61 void NavigateGuest(RenderViewHost* render_view_host, | 63 void NavigateGuest(RenderViewHost* render_view_host, |
| 62 int instance_id, | 64 int instance_id, |
| 63 int64 frame_id, | 65 int64 frame_id, |
| 64 const std::string& src, | 66 const std::string& src, |
| 65 const gfx::Size& size); | 67 const gfx::Size& size, |
| 68 const BrowserPluginHostMsg_Surface_Params& params); |
| 66 | 69 |
| 67 // This is called when the browser plugin's container has resized in the | 70 // This is called when the browser plugin's container has resized in the |
| 68 // embedder. In additon to specifying the new size, and new scale factor, | 71 // embedder. In additon to specifying the new size, and new scale factor, |
| 69 // it also passes a TransportDIB that is shared with the embedder. | 72 // it also passes a TransportDIB that is shared with the embedder. |
| 70 // The browser process is free to write to this buffer whenever it receives | 73 // The browser process is free to write to this buffer whenever it receives |
| 71 // damage from the guest because if it receives damage from the guest, | 74 // damage from the guest because if it receives damage from the guest, |
| 72 // then the previous damage has already been accessed and ACK'ed by the | 75 // then the previous damage has already been accessed and ACK'ed by the |
| 73 // embedder. | 76 // embedder. |
| 74 void ResizeGuest(int instance_id, | 77 void ResizeGuest(int instance_id, |
| 75 TransportDIB* damage_buffer, | 78 TransportDIB* damage_buffer, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 96 | 99 |
| 97 RenderProcessHost* embedder_render_process_host() const { | 100 RenderProcessHost* embedder_render_process_host() const { |
| 98 return embedder_render_process_host_; | 101 return embedder_render_process_host_; |
| 99 } | 102 } |
| 100 int instance_id() const { return instance_id_; } | 103 int instance_id() const { return instance_id_; } |
| 101 void SetDamageBuffer(TransportDIB* damage_buffer, | 104 void SetDamageBuffer(TransportDIB* damage_buffer, |
| 102 const gfx::Size& size, | 105 const gfx::Size& size, |
| 103 float scale_factor); | 106 float scale_factor); |
| 104 TransportDIB* damage_buffer() const { return damage_buffer_; } | 107 TransportDIB* damage_buffer() const { return damage_buffer_; } |
| 105 const gfx::Size& damage_buffer_size() const { return damage_buffer_size_; } | 108 const gfx::Size& damage_buffer_size() const { return damage_buffer_size_; } |
| 109 |
| 110 void SendBuffersSwappedToEmbedder( |
| 111 uint64 surface_handle, |
| 112 const BrowserPlugin_SwapInfo& info); |
| 113 void SendSurfaceResizeToEmbedder(const gfx::Size& size); |
| 114 |
| 115 void set_surface_params(const BrowserPluginHostMsg_Surface_Params& params) { |
| 116 surface_params_ = params; |
| 117 } |
| 118 |
| 106 float damage_buffer_scale_factor() const { | 119 float damage_buffer_scale_factor() const { |
| 107 return damage_buffer_scale_factor_; | 120 return damage_buffer_scale_factor_; |
| 108 } | 121 } |
| 109 | 122 |
| 110 const ContainerInstanceMap& guests_for_testing() const { | 123 const ContainerInstanceMap& guests_for_testing() const { |
| 111 return guests_by_instance_id_; | 124 return guests_by_instance_id_; |
| 112 } | 125 } |
| 113 | 126 |
| 114 protected: | 127 protected: |
| 115 friend class BrowserPluginHostHelper; | 128 friend class BrowserPluginHostHelper; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 int instance_id_; | 179 int instance_id_; |
| 167 TransportDIB* damage_buffer_; | 180 TransportDIB* damage_buffer_; |
| 168 gfx::Size damage_buffer_size_; | 181 gfx::Size damage_buffer_size_; |
| 169 float damage_buffer_scale_factor_; | 182 float damage_buffer_scale_factor_; |
| 170 GuestMap guests_; | 183 GuestMap guests_; |
| 171 ContainerInstanceMap guests_by_instance_id_; | 184 ContainerInstanceMap guests_by_instance_id_; |
| 172 | 185 |
| 173 IDMap<RenderViewHost> pending_updates_; | 186 IDMap<RenderViewHost> pending_updates_; |
| 174 int pending_update_counter_; | 187 int pending_update_counter_; |
| 175 scoped_ptr<IPC::Message> pending_input_event_reply_; | 188 scoped_ptr<IPC::Message> pending_input_event_reply_; |
| 189 BrowserPluginHostMsg_Surface_Params surface_params_; |
| 176 gfx::Rect guest_rect_; | 190 gfx::Rect guest_rect_; |
| 177 WebCursor cursor_; | 191 WebCursor cursor_; |
| 178 | 192 |
| 179 DISALLOW_COPY_AND_ASSIGN(BrowserPluginHost); | 193 DISALLOW_COPY_AND_ASSIGN(BrowserPluginHost); |
| 180 }; | 194 }; |
| 181 | 195 |
| 182 } // namespace content | 196 } // namespace content |
| 183 | 197 |
| 184 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_OLD_BROWSER_PLUGIN_HOST_H_ | 198 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_OLD_BROWSER_PLUGIN_HOST_H_ |
| OLD | NEW |