Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest.h

Issue 11088043: browser-plugin: Allow accepting drag-n-drop events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // A BrowserPluginGuest represents the browser side of browser <--> renderer 5 // A BrowserPluginGuest represents the browser side of browser <--> renderer
6 // communication. A BrowserPlugin (a WebPlugin) is on the renderer side of 6 // communication. A BrowserPlugin (a WebPlugin) is on the renderer side of
7 // browser <--> guest renderer communication. The 'guest' renderer is a 7 // browser <--> guest renderer communication. The 'guest' renderer is a
8 // <browser> tag. 8 // <browser> tag.
9 // 9 //
10 // BrowserPluginGuest lives on the UI thread of the browser process. It has a 10 // BrowserPluginGuest lives on the UI thread of the browser process. It has a
(...skipping 20 matching lines...) Expand all
31 31
32 #include <map> 32 #include <map>
33 33
34 #include "base/compiler_specific.h" 34 #include "base/compiler_specific.h"
35 #include "base/id_map.h" 35 #include "base/id_map.h"
36 #include "base/time.h" 36 #include "base/time.h"
37 #include "content/public/browser/notification_observer.h" 37 #include "content/public/browser/notification_observer.h"
38 #include "content/public/browser/notification_registrar.h" 38 #include "content/public/browser/notification_registrar.h"
39 #include "content/public/browser/web_contents_delegate.h" 39 #include "content/public/browser/web_contents_delegate.h"
40 #include "content/public/browser/web_contents_observer.h" 40 #include "content/public/browser/web_contents_observer.h"
41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragStatus.h"
42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
41 #include "ui/gfx/rect.h" 43 #include "ui/gfx/rect.h"
42 #include "webkit/glue/webcursor.h" 44 #include "webkit/glue/webcursor.h"
43 45
44 class TransportDIB; 46 class TransportDIB;
45 struct ViewHostMsg_UpdateRect_Params; 47 struct ViewHostMsg_UpdateRect_Params;
48 struct WebDropData;
46 49
47 namespace WebKit { 50 namespace WebKit {
48 class WebInputEvent; 51 class WebInputEvent;
49 } 52 }
50 53
51 namespace content { 54 namespace content {
52 55
53 class BrowserPluginHostFactory; 56 class BrowserPluginHostFactory;
54 class BrowserPluginEmbedder; 57 class BrowserPluginEmbedder;
55 class RenderProcessHost; 58 class RenderProcessHost;
(...skipping 20 matching lines...) Expand all
76 } 79 }
77 80
78 void set_guest_hang_timeout_for_testing(const base::TimeDelta& timeout) { 81 void set_guest_hang_timeout_for_testing(const base::TimeDelta& timeout) {
79 guest_hang_timeout_ = timeout; 82 guest_hang_timeout_ = timeout;
80 } 83 }
81 84
82 void set_embedder_render_process_host( 85 void set_embedder_render_process_host(
83 RenderProcessHost* render_process_host) { 86 RenderProcessHost* render_process_host) {
84 embedder_render_process_host_ = render_process_host; 87 embedder_render_process_host_ = render_process_host;
85 } 88 }
89 void set_embedder_render_view_host(RenderViewHost* render_view_host) {
90 embedder_render_view_host_ = render_view_host;
91 }
86 92
87 bool visible() const { return visible_; } 93 bool visible() const { return visible_; }
88 94
89 // NotificationObserver implementation. 95 // NotificationObserver implementation.
90 virtual void Observe(int type, 96 virtual void Observe(int type,
91 const NotificationSource& source, 97 const NotificationSource& source,
92 const NotificationDetails& details) OVERRIDE; 98 const NotificationDetails& details) OVERRIDE;
93 99
94 // WebContentsObserver implementation. 100 // WebContentsObserver implementation.
95 virtual void DidStartProvisionalLoadForFrame( 101 virtual void DidStartProvisionalLoadForFrame(
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // 159 //
154 // It will also send a message to the guest renderer process to cleanup 160 // It will also send a message to the guest renderer process to cleanup
155 // resources such as dropping back buffers and adjusting memory limits (if in 161 // resources such as dropping back buffers and adjusting memory limits (if in
156 // compositing mode, see CCLayerTreeHost::setVisible). 162 // compositing mode, see CCLayerTreeHost::setVisible).
157 // 163 //
158 // Additionally it will slow down Javascript execution and garbage collection. 164 // Additionally it will slow down Javascript execution and garbage collection.
159 // See RenderThreadImpl::IdleHandler (executed when hidden) and 165 // See RenderThreadImpl::IdleHandler (executed when hidden) and
160 // RenderThreadImpl::IdleHandlerInForegroundTab (executed when visible). 166 // RenderThreadImpl::IdleHandlerInForegroundTab (executed when visible).
161 void SetVisibility(bool embedder_visible, bool visible); 167 void SetVisibility(bool embedder_visible, bool visible);
162 168
169 // Handles drag events from the embedder.
170 // When dragging, the drag events go to the embedder first, and if the drag
171 // happens on the browser plugin, then the plugin sends a corresponding
172 // drag-message to the guest. This routes the drag-message to the guest
173 // renderer.
174 void DragStatusUpdate(WebKit::WebDragStatus drag_status,
175 const WebDropData& drop_data,
176 WebKit::WebDragOperationsMask drag_mask,
177 const gfx::Point& location);
178
179 // Updates the cursor during dragging.
180 // During dragging, if the guest notifies to update the cursor for a drag,
181 // then it is necessary to route the cursor update to the embedder correctly
182 // so that the cursor updates properly.
183 void UpdateDragCursor(WebKit::WebDragOperation operation);
184
163 // Exposes the protected web_contents() from WebContentsObserver. 185 // Exposes the protected web_contents() from WebContentsObserver.
164 WebContents* GetWebContents(); 186 WebContents* GetWebContents();
165 187
166 // Kill the guest process. 188 // Kill the guest process.
167 void Terminate(); 189 void Terminate();
168 190
169 // Overridden in tests. 191 // Overridden in tests.
170 virtual bool ViewTakeFocus(bool reverse); 192 virtual bool ViewTakeFocus(bool reverse);
171 // If possible, navigate the guest to |relative_index| entries away from the 193 // If possible, navigate the guest to |relative_index| entries away from the
172 // current navigation entry. 194 // current navigation entry.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // Called when a redirect notification occurs. 233 // Called when a redirect notification occurs.
212 void LoadRedirect(const GURL& old_url, 234 void LoadRedirect(const GURL& old_url,
213 const GURL& new_url, 235 const GURL& new_url,
214 bool is_top_level); 236 bool is_top_level);
215 237
216 // Static factory instance (always NULL for non-test). 238 // Static factory instance (always NULL for non-test).
217 static content::BrowserPluginHostFactory* factory_; 239 static content::BrowserPluginHostFactory* factory_;
218 240
219 NotificationRegistrar notification_registrar_; 241 NotificationRegistrar notification_registrar_;
220 RenderProcessHost* embedder_render_process_host_; 242 RenderProcessHost* embedder_render_process_host_;
243 RenderViewHost* embedder_render_view_host_;
221 // An identifier that uniquely identifies a browser plugin guest within an 244 // An identifier that uniquely identifies a browser plugin guest within an
222 // embedder. 245 // embedder.
223 int instance_id_; 246 int instance_id_;
224 scoped_ptr<TransportDIB> damage_buffer_; 247 scoped_ptr<TransportDIB> damage_buffer_;
225 #if defined(OS_WIN) 248 #if defined(OS_WIN)
226 size_t damage_buffer_size_; 249 size_t damage_buffer_size_;
227 #endif 250 #endif
228 gfx::Size damage_view_size_; 251 gfx::Size damage_view_size_;
229 float damage_buffer_scale_factor_; 252 float damage_buffer_scale_factor_;
230 scoped_ptr<IPC::Message> pending_input_event_reply_; 253 scoped_ptr<IPC::Message> pending_input_event_reply_;
231 gfx::Rect guest_rect_; 254 gfx::Rect guest_rect_;
232 WebCursor cursor_; 255 WebCursor cursor_;
233 IDMap<RenderViewHost> pending_updates_; 256 IDMap<RenderViewHost> pending_updates_;
234 int pending_update_counter_; 257 int pending_update_counter_;
235 base::TimeDelta guest_hang_timeout_; 258 base::TimeDelta guest_hang_timeout_;
236 bool visible_; 259 bool visible_;
237 260
238 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); 261 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest);
239 }; 262 };
240 263
241 } // namespace content 264 } // namespace content
242 265
243 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ 266 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698