| 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 "base/hash_tables.h" | 8 #include "base/hash_tables.h" |
| 9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
| 10 #include "base/scoped_handle.h" | 10 #include "base/scoped_handle.h" |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #include "base/shared_memory.h" | 12 #include "base/shared_memory.h" |
| 13 #include "base/timer.h" | 13 #include "base/timer.h" |
| 14 #include "chrome/common/ipc_message.h" | 14 #include "chrome/common/ipc_message.h" |
| 15 #include "chrome/common/chrome_plugin_api.h" | 15 #include "chrome/common/chrome_plugin_api.h" |
| 16 #include "chrome/common/transport_dib.h" |
| 16 #include "webkit/glue/webplugin.h" | 17 #include "webkit/glue/webplugin.h" |
| 17 | 18 |
| 18 namespace base { | 19 namespace base { |
| 19 class WaitableEvent; | 20 class WaitableEvent; |
| 20 } | 21 } |
| 21 | 22 |
| 22 class PluginChannel; | 23 class PluginChannel; |
| 23 class WebPluginDelegate; | 24 class WebPluginDelegate; |
| 24 | 25 |
| 25 // This is an implementation of WebPlugin that proxies all calls to the | 26 // This is an implementation of WebPlugin that proxies all calls to the |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 81 |
| 81 void HandleURLRequest(const char *method, | 82 void HandleURLRequest(const char *method, |
| 82 bool is_javascript_url, | 83 bool is_javascript_url, |
| 83 const char* target, unsigned int len, | 84 const char* target, unsigned int len, |
| 84 const char* buf, bool is_file_data, | 85 const char* buf, bool is_file_data, |
| 85 bool notify, const char* url, | 86 bool notify, const char* url, |
| 86 intptr_t notify_data, bool popups_allowed); | 87 intptr_t notify_data, bool popups_allowed); |
| 87 | 88 |
| 88 void UpdateGeometry(const gfx::Rect& window_rect, | 89 void UpdateGeometry(const gfx::Rect& window_rect, |
| 89 const gfx::Rect& clip_rect, | 90 const gfx::Rect& clip_rect, |
| 90 const base::SharedMemoryHandle& windowless_buffer, | 91 const TransportDIB::Id& windowless_buffer, |
| 91 const base::SharedMemoryHandle& background_buffer); | 92 const TransportDIB::Id& background_buffer); |
| 92 | 93 |
| 93 void CancelDocumentLoad(); | 94 void CancelDocumentLoad(); |
| 94 | 95 |
| 95 void InitiateHTTPRangeRequest(const char* url, | 96 void InitiateHTTPRangeRequest(const char* url, |
| 96 const char* range_info, | 97 const char* range_info, |
| 97 intptr_t existing_stream, | 98 intptr_t existing_stream, |
| 98 bool notify_needed, | 99 bool notify_needed, |
| 99 intptr_t notify_data); | 100 intptr_t notify_data); |
| 100 | 101 |
| 101 bool IsOffTheRecord(); | 102 bool IsOffTheRecord(); |
| 102 | 103 |
| 103 base::WaitableEvent* modal_dialog_event() { | 104 base::WaitableEvent* modal_dialog_event() { |
| 104 return modal_dialog_event_.get(); | 105 return modal_dialog_event_.get(); |
| 105 } | 106 } |
| 106 | 107 |
| 107 private: | 108 private: |
| 108 bool Send(IPC::Message* msg); | 109 bool Send(IPC::Message* msg); |
| 109 | 110 |
| 111 // Handler for sending over the paint event to the plugin. |
| 112 void OnPaint(const gfx::Rect& damaged_rect); |
| 113 |
| 114 #if defined(OS_WIN) |
| 110 // Updates the shared memory section where windowless plugins paint. | 115 // Updates the shared memory section where windowless plugins paint. |
| 111 void SetWindowlessBuffer(const base::SharedMemoryHandle& windowless_buffer, | 116 void SetWindowlessBuffer(const base::SharedMemoryHandle& windowless_buffer, |
| 112 const base::SharedMemoryHandle& background_buffer); | 117 const base::SharedMemoryHandle& background_buffer); |
| 113 | 118 |
| 114 // Converts a shared memory section handle from the renderer process into a | 119 // Converts a shared memory section handle from the renderer process into a |
| 115 // bitmap and hdc that are mapped to this process. | 120 // bitmap and hdc that are mapped to this process. |
| 116 void ConvertBuffer(const base::SharedMemoryHandle& buffer, | 121 void ConvertBuffer(const base::SharedMemoryHandle& buffer, |
| 117 ScopedHandle* shared_section, | 122 ScopedHandle* shared_section, |
| 118 ScopedBitmap* bitmap, | 123 ScopedBitmap* bitmap, |
| 119 ScopedHDC* hdc); | 124 ScopedHDC* hdc); |
| 120 | 125 |
| 121 // Handler for sending over the paint event to the plugin. | |
| 122 void OnPaint(const gfx::Rect& damaged_rect); | |
| 123 | |
| 124 // Called when a plugin's origin moves, so that we can update the world | 126 // Called when a plugin's origin moves, so that we can update the world |
| 125 // transform of the local HDC. | 127 // transform of the local HDC. |
| 126 void UpdateTransform(); | 128 void UpdateTransform(); |
| 129 #endif |
| 127 | 130 |
| 128 typedef base::hash_map<int, WebPluginResourceClient*> ResourceClientMap; | 131 typedef base::hash_map<int, WebPluginResourceClient*> ResourceClientMap; |
| 129 ResourceClientMap resource_clients_; | 132 ResourceClientMap resource_clients_; |
| 130 | 133 |
| 131 scoped_refptr<PluginChannel> channel_; | 134 scoped_refptr<PluginChannel> channel_; |
| 132 int route_id_; | 135 int route_id_; |
| 136 uint32 cp_browsing_context_; |
| 133 NPObject* window_npobject_; | 137 NPObject* window_npobject_; |
| 134 NPObject* plugin_element_; | 138 NPObject* plugin_element_; |
| 135 WebPluginDelegate* delegate_; | 139 WebPluginDelegate* delegate_; |
| 136 gfx::Rect damaged_rect_; | 140 gfx::Rect damaged_rect_; |
| 137 bool waiting_for_paint_; | 141 bool waiting_for_paint_; |
| 138 uint32 cp_browsing_context_; | |
| 139 scoped_ptr<base::WaitableEvent> modal_dialog_event_; | 142 scoped_ptr<base::WaitableEvent> modal_dialog_event_; |
| 140 | 143 |
| 144 #if defined(OS_WIN) |
| 141 // Variables used for desynchronized windowless plugin painting. See note in | 145 // Variables used for desynchronized windowless plugin painting. See note in |
| 142 // webplugin_delegate_proxy.h for how this works. | 146 // webplugin_delegate_proxy.h for how this works. |
| 143 | 147 |
| 144 // These hold the bitmap where the plugin draws. | 148 // These hold the bitmap where the plugin draws. |
| 145 ScopedHandle windowless_shared_section_; | 149 ScopedHandle windowless_shared_section_; |
| 146 ScopedBitmap windowless_bitmap_; | 150 ScopedBitmap windowless_bitmap_; |
| 147 ScopedHDC windowless_hdc_; | 151 ScopedHDC windowless_hdc_; |
| 148 | 152 |
| 149 // These hold the bitmap of the background image. | 153 // These hold the bitmap of the background image. |
| 150 ScopedHandle background_shared_section_; | 154 ScopedHandle background_shared_section_; |
| 151 ScopedBitmap background_bitmap_; | 155 ScopedBitmap background_bitmap_; |
| 152 ScopedHDC background_hdc_; | 156 ScopedHDC background_hdc_; |
| 157 #endif |
| 153 | 158 |
| 154 ScopedRunnableMethodFactory<WebPluginProxy> runnable_method_factory_; | 159 ScopedRunnableMethodFactory<WebPluginProxy> runnable_method_factory_; |
| 155 }; | 160 }; |
| 156 | 161 |
| 157 #endif // CHROME_PLUGIN_PLUGIN_WEBPLUGIN_PROXY_H__ | 162 #endif // CHROME_PLUGIN_PLUGIN_WEBPLUGIN_PROXY_H__ |
| OLD | NEW |