| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_PLUGIN_PLUGIN_WEBPLUGIN_PROXY_H__ | 5 #ifndef CHROME_PLUGIN_PLUGIN_WEBPLUGIN_PROXY_H__ |
| 6 #define CHROME_PLUGIN_PLUGIN_WEBPLUGIN_PROXY_H__ | 6 #define CHROME_PLUGIN_PLUGIN_WEBPLUGIN_PROXY_H__ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
| 11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
| 12 #if defined(OS_MACOSX) |
| 13 #include "base/scoped_cftyperef.h" |
| 14 #endif |
| 12 #include "base/scoped_handle.h" | 15 #include "base/scoped_handle.h" |
| 13 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
| 14 #include "base/shared_memory.h" | 17 #include "base/shared_memory.h" |
| 15 #include "base/timer.h" | 18 #include "base/timer.h" |
| 16 #include "chrome/common/ipc_message.h" | 19 #include "chrome/common/ipc_message.h" |
| 17 #include "chrome/common/chrome_plugin_api.h" | 20 #include "chrome/common/chrome_plugin_api.h" |
| 18 #include "chrome/common/transport_dib.h" | 21 #include "chrome/common/transport_dib.h" |
| 19 #include "googleurl/src/gurl.h" | 22 #include "googleurl/src/gurl.h" |
| 20 #include "webkit/glue/webplugin.h" | 23 #include "webkit/glue/webplugin.h" |
| 21 | 24 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 100 |
| 98 void HandleURLRequest(const char *method, | 101 void HandleURLRequest(const char *method, |
| 99 bool is_javascript_url, | 102 bool is_javascript_url, |
| 100 const char* target, unsigned int len, | 103 const char* target, unsigned int len, |
| 101 const char* buf, bool is_file_data, | 104 const char* buf, bool is_file_data, |
| 102 bool notify, const char* url, | 105 bool notify, const char* url, |
| 103 intptr_t notify_data, bool popups_allowed); | 106 intptr_t notify_data, bool popups_allowed); |
| 104 | 107 |
| 105 void UpdateGeometry(const gfx::Rect& window_rect, | 108 void UpdateGeometry(const gfx::Rect& window_rect, |
| 106 const gfx::Rect& clip_rect, | 109 const gfx::Rect& clip_rect, |
| 107 const TransportDIB::Id& windowless_buffer, | 110 const TransportDIB::Handle& windowless_buffer, |
| 108 const TransportDIB::Id& background_buffer); | 111 const TransportDIB::Handle& background_buffer); |
| 109 | 112 |
| 110 void CancelDocumentLoad(); | 113 void CancelDocumentLoad(); |
| 111 | 114 |
| 112 void InitiateHTTPRangeRequest(const char* url, | 115 void InitiateHTTPRangeRequest(const char* url, |
| 113 const char* range_info, | 116 const char* range_info, |
| 114 intptr_t existing_stream, | 117 intptr_t existing_stream, |
| 115 bool notify_needed, | 118 bool notify_needed, |
| 116 intptr_t notify_data); | 119 intptr_t notify_data); |
| 117 | 120 |
| 118 bool IsOffTheRecord(); | 121 bool IsOffTheRecord(); |
| 119 | 122 |
| 120 void ResourceClientDeleted(WebPluginResourceClient* resource_client); | 123 void ResourceClientDeleted(WebPluginResourceClient* resource_client); |
| 121 | 124 |
| 122 base::WaitableEvent* modal_dialog_event() { | 125 base::WaitableEvent* modal_dialog_event() { |
| 123 return modal_dialog_event_.get(); | 126 return modal_dialog_event_.get(); |
| 124 } | 127 } |
| 125 | 128 |
| 126 private: | 129 private: |
| 127 bool Send(IPC::Message* msg); | 130 bool Send(IPC::Message* msg); |
| 128 | 131 |
| 129 // Handler for sending over the paint event to the plugin. | 132 // Handler for sending over the paint event to the plugin. |
| 130 void OnPaint(const gfx::Rect& damaged_rect); | 133 void OnPaint(const gfx::Rect& damaged_rect); |
| 131 | 134 |
| 135 // Updates the shared memory section where windowless plugins paint. |
| 136 void SetWindowlessBuffer(const TransportDIB::Handle& windowless_buffer, |
| 137 const TransportDIB::Handle& background_buffer); |
| 138 |
| 132 #if defined(OS_WIN) | 139 #if defined(OS_WIN) |
| 133 // Updates the shared memory section where windowless plugins paint. | |
| 134 void SetWindowlessBuffer(const base::SharedMemoryHandle& windowless_buffer, | |
| 135 const base::SharedMemoryHandle& background_buffer); | |
| 136 | |
| 137 // Converts a shared memory section handle from the renderer process into a | 140 // Converts a shared memory section handle from the renderer process into a |
| 138 // bitmap and hdc that are mapped to this process. | 141 // bitmap and hdc that are mapped to this process. |
| 139 void ConvertBuffer(const base::SharedMemoryHandle& buffer, | 142 void ConvertBuffer(const base::SharedMemoryHandle& buffer, |
| 140 ScopedHandle* shared_section, | 143 ScopedHandle* shared_section, |
| 141 ScopedBitmap* bitmap, | 144 ScopedBitmap* bitmap, |
| 142 ScopedHDC* hdc); | 145 ScopedHDC* hdc); |
| 146 #endif |
| 143 | 147 |
| 144 // Called when a plugin's origin moves, so that we can update the world | 148 // Called when a plugin's origin moves, so that we can update the world |
| 145 // transform of the local HDC. | 149 // transform of the local HDC. |
| 146 void UpdateTransform(); | 150 void UpdateTransform(); |
| 147 #endif | |
| 148 | 151 |
| 149 typedef base::hash_map<int, WebPluginResourceClient*> ResourceClientMap; | 152 typedef base::hash_map<int, WebPluginResourceClient*> ResourceClientMap; |
| 150 ResourceClientMap resource_clients_; | 153 ResourceClientMap resource_clients_; |
| 151 | 154 |
| 152 scoped_refptr<PluginChannel> channel_; | 155 scoped_refptr<PluginChannel> channel_; |
| 153 int route_id_; | 156 int route_id_; |
| 154 uint32 cp_browsing_context_; | 157 uint32 cp_browsing_context_; |
| 155 NPObject* window_npobject_; | 158 NPObject* window_npobject_; |
| 156 NPObject* plugin_element_; | 159 NPObject* plugin_element_; |
| 157 WebPluginDelegate* delegate_; | 160 WebPluginDelegate* delegate_; |
| 158 gfx::Rect damaged_rect_; | 161 gfx::Rect damaged_rect_; |
| 159 bool waiting_for_paint_; | 162 bool waiting_for_paint_; |
| 160 scoped_ptr<base::WaitableEvent> modal_dialog_event_; | 163 scoped_ptr<base::WaitableEvent> modal_dialog_event_; |
| 161 // The url of the main frame hosting the plugin. | 164 // The url of the main frame hosting the plugin. |
| 162 GURL page_url_; | 165 GURL page_url_; |
| 163 | 166 |
| 164 #if defined(OS_WIN) | 167 #if defined(OS_WIN) |
| 165 // Variables used for desynchronized windowless plugin painting. See note in | 168 // Variables used for desynchronized windowless plugin painting. See note in |
| 166 // webplugin_delegate_proxy.h for how this works. | 169 // webplugin_delegate_proxy.h for how this works. |
| 167 | 170 |
| 168 // These hold the bitmap where the plugin draws. | 171 // These hold the bitmap where the plugin draws. |
| 169 ScopedHandle windowless_shared_section_; | 172 ScopedHandle windowless_shared_section_; |
| 170 ScopedBitmap windowless_bitmap_; | 173 ScopedBitmap windowless_bitmap_; |
| 171 ScopedHDC windowless_hdc_; | 174 ScopedHDC windowless_hdc_; |
| 172 | 175 |
| 173 // These hold the bitmap of the background image. | 176 // These hold the bitmap of the background image. |
| 174 ScopedHandle background_shared_section_; | 177 ScopedHandle background_shared_section_; |
| 175 ScopedBitmap background_bitmap_; | 178 ScopedBitmap background_bitmap_; |
| 176 ScopedHDC background_hdc_; | 179 ScopedHDC background_hdc_; |
| 180 #elif defined(OS_MACOSX) |
| 181 scoped_ptr<TransportDIB> windowless_dib_; |
| 182 scoped_ptr<TransportDIB> background_dib_; |
| 183 scoped_cftyperef<CGContextRef> windowless_context_; |
| 184 scoped_cftyperef<CGContextRef> background_context_; |
| 177 #endif | 185 #endif |
| 178 | 186 |
| 179 ScopedRunnableMethodFactory<WebPluginProxy> runnable_method_factory_; | 187 ScopedRunnableMethodFactory<WebPluginProxy> runnable_method_factory_; |
| 180 }; | 188 }; |
| 181 | 189 |
| 182 #endif // CHROME_PLUGIN_PLUGIN_WEBPLUGIN_PROXY_H__ | 190 #endif // CHROME_PLUGIN_PLUGIN_WEBPLUGIN_PROXY_H__ |
| OLD | NEW |