| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/id_map.h" | 12 #include "base/id_map.h" |
| 13 #include "content/common/browser_plugin_info.h" |
| 13 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
| 14 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
| 15 #include "content/public/browser/web_contents_delegate.h" | 16 #include "content/public/browser/web_contents_delegate.h" |
| 16 #include "content/public/browser/web_contents_observer.h" | 17 #include "content/public/browser/web_contents_observer.h" |
| 17 #include "ppapi/c/pp_instance.h" | 18 #include "ppapi/c/pp_instance.h" |
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.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 | 22 |
| 23 struct BrowserPlugin_SwapInfo; |
| 22 class WebContentsImpl; | 24 class WebContentsImpl; |
| 23 struct ViewHostMsg_UpdateRect_Params; | 25 struct ViewHostMsg_UpdateRect_Params; |
| 24 | 26 |
| 25 namespace IPC { | 27 namespace IPC { |
| 26 struct ChannelHandle; | 28 struct ChannelHandle; |
| 27 } | 29 } |
| 28 | 30 |
| 29 namespace content { | 31 namespace content { |
| 30 | 32 |
| 31 class RenderProcessHost; | 33 class RenderProcessHost; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 47 explicit BrowserPluginHost(WebContentsImpl* web_contents); | 49 explicit BrowserPluginHost(WebContentsImpl* web_contents); |
| 48 | 50 |
| 49 virtual ~BrowserPluginHost(); | 51 virtual ~BrowserPluginHost(); |
| 50 | 52 |
| 51 // This is called on the first navigation of the browser plugin. It creates | 53 // This is called on the first navigation of the browser plugin. It creates |
| 52 // a new WebContentsImpl for the guest, associates it with its embedder, sets | 54 // a new WebContentsImpl for the guest, associates it with its embedder, sets |
| 53 // its size and navigates it to the src URL. | 55 // its size and navigates it to the src URL. |
| 54 void NavigateGuestFromEmbedder(RenderViewHost* render_view_host, | 56 void NavigateGuestFromEmbedder(RenderViewHost* render_view_host, |
| 55 int container_instance_id, | 57 int container_instance_id, |
| 56 long long frame_id, | 58 long long frame_id, |
| 57 const std::string& src); | 59 const std::string& src, |
| 60 const BrowserPluginHostMsg_Surface_Params& para
ms); |
| 58 | 61 |
| 59 void ResizeGuest(int container_instance_id, | 62 void ResizeGuest(int container_instance_id, |
| 60 TransportDIB* damage_buffer, | 63 TransportDIB* damage_buffer, |
| 61 int width, | 64 int width, |
| 62 int height); | 65 int height); |
| 63 | 66 |
| 64 void UpdateRect(RenderViewHost* render_view_host, | 67 void UpdateRect(RenderViewHost* render_view_host, |
| 65 const ViewHostMsg_UpdateRect_Params& params); | 68 const ViewHostMsg_UpdateRect_Params& params); |
| 66 | 69 |
| 67 // Called on the guest BrowserPluginHost. | 70 // Called on the guest BrowserPluginHost. |
| 68 void UpdateRectACK(int message_id); | 71 void UpdateRectACK(int message_id); |
| 69 void HandleInputEvent(RenderViewHost* render_view_host, | 72 void HandleInputEvent(RenderViewHost* render_view_host, |
| 70 const WebKit::WebInputEvent& event, | 73 const WebKit::WebInputEvent& event, |
| 71 IPC::Message* reply_message); | 74 IPC::Message* reply_message); |
| 72 void HandleInputEventAck(bool handled); | 75 void HandleInputEventAck(bool handled); |
| 73 void SetFocus(bool focused); | 76 void SetFocus(bool focused); |
| 74 | 77 |
| 75 RenderProcessHost* embedder_render_process_host() const { | 78 RenderProcessHost* embedder_render_process_host() const { |
| 76 return embedder_render_process_host_; | 79 return embedder_render_process_host_; |
| 77 } | 80 } |
| 78 int instance_id() const { return instance_id_; } | 81 int instance_id() const { return instance_id_; } |
| 79 void SetDamageBuffer(TransportDIB* damage_buffer, const gfx::Size& size); | 82 void SetDamageBuffer(TransportDIB* damage_buffer, const gfx::Size& size); |
| 80 TransportDIB* damage_buffer() const { return damage_buffer_; } | 83 TransportDIB* damage_buffer() const { return damage_buffer_; } |
| 81 const gfx::Size& damage_buffer_size() const { return damage_buffer_size_; } | 84 const gfx::Size& damage_buffer_size() const { return damage_buffer_size_; } |
| 82 | 85 |
| 86 void SendBuffersSwappedToEmbedder(uint64 surface_handle, const BrowserPlugin_S
wapInfo& info); |
| 87 |
| 88 void set_surface_params(const BrowserPluginHostMsg_Surface_Params& params) { |
| 89 surface_params_ = params; |
| 90 } |
| 83 | 91 |
| 84 private: | 92 private: |
| 85 typedef std::map<WebContentsImpl*, int64> GuestMap; | 93 typedef std::map<WebContentsImpl*, int64> GuestMap; |
| 86 typedef std::map<int, BrowserPluginHost*> ContainerInstanceMap; | 94 typedef std::map<int, BrowserPluginHost*> ContainerInstanceMap; |
| 87 friend class BrowserPluginHostHelper; | 95 friend class BrowserPluginHostHelper; |
| 88 | 96 |
| 89 // Get a guest BrowserPluginHost by its container ID specified | 97 // Get a guest BrowserPluginHost by its container ID specified |
| 90 // in BrowserPlugin. | 98 // in BrowserPlugin. |
| 91 BrowserPluginHost* GetGuestByContainerID(int container_id); | 99 BrowserPluginHost* GetGuestByContainerID(int container_id); |
| 92 | 100 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 int instance_id_; | 148 int instance_id_; |
| 141 TransportDIB* damage_buffer_; | 149 TransportDIB* damage_buffer_; |
| 142 gfx::Size damage_buffer_size_; | 150 gfx::Size damage_buffer_size_; |
| 143 GuestMap guests_; | 151 GuestMap guests_; |
| 144 ContainerInstanceMap guests_by_container_id_; | 152 ContainerInstanceMap guests_by_container_id_; |
| 145 | 153 |
| 146 IDMap<RenderViewHost> pending_updates_; | 154 IDMap<RenderViewHost> pending_updates_; |
| 147 int pending_update_counter_; | 155 int pending_update_counter_; |
| 148 scoped_ptr<IPC::Message> pending_input_event_reply_; | 156 scoped_ptr<IPC::Message> pending_input_event_reply_; |
| 149 | 157 |
| 158 BrowserPluginHostMsg_Surface_Params surface_params_; |
| 159 |
| 150 DISALLOW_COPY_AND_ASSIGN(BrowserPluginHost); | 160 DISALLOW_COPY_AND_ASSIGN(BrowserPluginHost); |
| 151 }; | 161 }; |
| 152 | 162 |
| 153 } // namespace browser_plugin | 163 } // namespace browser_plugin |
| 154 } // namespace content | 164 } // namespace content |
| 155 | 165 |
| 156 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_OLD_BROWSER_PLUGIN_HOST_H_ | 166 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_OLD_BROWSER_PLUGIN_HOST_H_ |
| OLD | NEW |