| 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" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 CPBrowsingContext GetCPBrowsingContext(); | 55 CPBrowsingContext GetCPBrowsingContext(); |
| 56 | 56 |
| 57 // Retrieves the WebPluginProxy for the given context that was returned by | 57 // Retrieves the WebPluginProxy for the given context that was returned by |
| 58 // GetCPBrowsingContext, or NULL if not found. | 58 // GetCPBrowsingContext, or NULL if not found. |
| 59 static WebPluginProxy* FromCPBrowsingContext(CPBrowsingContext context); | 59 static WebPluginProxy* FromCPBrowsingContext(CPBrowsingContext context); |
| 60 | 60 |
| 61 // Returns a WebPluginResourceClient object given its id, or NULL if no | 61 // Returns a WebPluginResourceClient object given its id, or NULL if no |
| 62 // object with that id exists. | 62 // object with that id exists. |
| 63 WebPluginResourceClient* GetResourceClient(int id); | 63 WebPluginResourceClient* GetResourceClient(int id); |
| 64 | 64 |
| 65 // For windowless plugins, paints the given rectangle into the local buffer. |
| 66 void Paint(const gfx::Rect& rect); |
| 67 |
| 68 // Callback from the renderer to let us know that a paint occurred. |
| 69 void DidPaint(); |
| 70 |
| 65 // Notification received on a plugin issued resource request | 71 // Notification received on a plugin issued resource request |
| 66 // creation. | 72 // creation. |
| 67 void OnResourceCreated(int resource_id, HANDLE cookie); | 73 void OnResourceCreated(int resource_id, HANDLE cookie); |
| 68 | 74 |
| 69 void HandleURLRequest(const char *method, | 75 void HandleURLRequest(const char *method, |
| 70 bool is_javascript_url, | 76 bool is_javascript_url, |
| 71 const char* target, unsigned int len, | 77 const char* target, unsigned int len, |
| 72 const char* buf, bool is_file_data, | 78 const char* buf, bool is_file_data, |
| 73 bool notify, const char* url, | 79 bool notify, const char* url, |
| 74 void* notify_data, bool popups_allowed); | 80 void* notify_data, bool popups_allowed); |
| 75 | 81 |
| 76 void UpdateGeometry(const gfx::Rect& window_rect, | 82 void UpdateGeometry(const gfx::Rect& window_rect, |
| 77 const gfx::Rect& clip_rect, | 83 const gfx::Rect& clip_rect, |
| 78 bool visible, | 84 bool visible, |
| 79 const SharedMemoryHandle& windowless_buffer, | 85 const SharedMemoryHandle& windowless_buffer, |
| 80 const SharedMemoryLock& lock); | 86 const SharedMemoryHandle& background_buffer); |
| 81 | 87 |
| 82 void CancelDocumentLoad(); | 88 void CancelDocumentLoad(); |
| 83 | 89 |
| 84 void InitiateHTTPRangeRequest(const char* url, | 90 void InitiateHTTPRangeRequest(const char* url, |
| 85 const char* range_info, | 91 const char* range_info, |
| 86 void* existing_stream, | 92 void* existing_stream, |
| 87 bool notify_needed, | 93 bool notify_needed, |
| 88 HANDLE notify_data); | 94 HANDLE notify_data); |
| 89 | 95 |
| 90 private: | 96 private: |
| 91 bool Send(IPC::Message* msg); | 97 bool Send(IPC::Message* msg); |
| 92 | 98 |
| 93 // Called periodically so that we can paint windowless plugins. | 99 // Updates the shared memory section where windowless plugins paint. |
| 94 void OnPaintTimerFired(); | 100 void SetWindowlessBuffer(const SharedMemoryHandle& windowless_buffer, |
| 101 const SharedMemoryHandle& background_buffer); |
| 95 | 102 |
| 96 // Updates the shared memory section where windowless plugins paint. | 103 // Converts a shared memory section handle from the renderer process into a |
| 97 void SetWindowlessBuffer(const SharedMemoryHandle& handle, | 104 // bitmap and hdc that are mapped to this process. |
| 98 const SharedMemoryLock& lock); | 105 void ConvertBuffer(const SharedMemoryHandle& buffer, |
| 106 ScopedHandle* shared_section, |
| 107 ScopedBitmap* bitmap, |
| 108 ScopedHDC* hdc); |
| 99 | 109 |
| 100 // Called when a plugin's origin moves, so that we can update the world | 110 // Called when a plugin's origin moves, so that we can update the world |
| 101 // transform of the local HDC. | 111 // transform of the local HDC. |
| 102 void UpdateTransform(); | 112 void UpdateTransform(); |
| 103 | 113 |
| 104 typedef base::hash_map<int, WebPluginResourceClient*> ResourceClientMap; | 114 typedef base::hash_map<int, WebPluginResourceClient*> ResourceClientMap; |
| 105 ResourceClientMap resource_clients_; | 115 ResourceClientMap resource_clients_; |
| 106 | 116 |
| 107 scoped_refptr<PluginChannel> channel_; | 117 scoped_refptr<PluginChannel> channel_; |
| 108 int route_id_; | 118 int route_id_; |
| 109 NPObject* window_npobject_; | 119 NPObject* window_npobject_; |
| 110 NPObject* plugin_element_; | 120 NPObject* plugin_element_; |
| 111 WebPluginDelegateImpl* delegate_; | 121 WebPluginDelegateImpl* delegate_; |
| 122 gfx::Rect damaged_rect_; |
| 123 bool waiting_for_paint_; |
| 112 uint32 cp_browsing_context_; | 124 uint32 cp_browsing_context_; |
| 113 ScopedHandle modal_dialog_event_; | 125 ScopedHandle modal_dialog_event_; |
| 114 | 126 |
| 115 // Used to desynchronize windowless painting. We accumulate invalidates and | 127 // Variables used for desynchronized windowless plugin painting. See note in |
| 116 // paint into a shared buffer when our repeating timer fires. After painting | 128 // webplugin_delegate_proxy.h for how this works. |
| 117 // we tell the renderer asynchronously and it paints from the buffer. This | 129 |
| 118 // allows the renderer to paint without a blocking call, which improves | 130 // These hold the bitmap where the plugin draws. |
| 119 // performance, and lets us control the frame rate at which we paint. | |
| 120 gfx::Rect damaged_rect_; | |
| 121 base::RepeatingTimer<WebPluginProxy> paint_timer_; | |
| 122 ScopedHandle windowless_shared_section_; | 131 ScopedHandle windowless_shared_section_; |
| 123 ScopedBitmap windowless_bitmap_; | 132 ScopedBitmap windowless_bitmap_; |
| 124 ScopedHDC windowless_hdc_; | 133 ScopedHDC windowless_hdc_; |
| 125 ScopedHandle windowless_buffer_lock_; | 134 |
| 135 // These hold the bitmap of the background image. |
| 136 ScopedHandle background_shared_section_; |
| 137 ScopedBitmap background_bitmap_; |
| 138 ScopedHDC background_hdc_; |
| 126 }; | 139 }; |
| 127 | 140 |
| 128 #endif // CHROME_PLUGIN_PLUGIN_WEBPLUGIN_PROXY_H__ | 141 #endif // CHROME_PLUGIN_PLUGIN_WEBPLUGIN_PROXY_H__ |
| OLD | NEW |