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

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

Issue 11098056: Browser Plugin: Enable File Chooser (<input type="file">) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // Overrides factory for testing. Default (NULL) value indicates regular 75 // Overrides factory for testing. Default (NULL) value indicates regular
76 // (non-test) environment. 76 // (non-test) environment.
77 static void set_factory_for_testing(BrowserPluginHostFactory* factory) { 77 static void set_factory_for_testing(BrowserPluginHostFactory* factory) {
78 content::BrowserPluginGuest::factory_ = factory; 78 content::BrowserPluginGuest::factory_ = factory;
79 } 79 }
80 80
81 void set_guest_hang_timeout_for_testing(const base::TimeDelta& timeout) { 81 void set_guest_hang_timeout_for_testing(const base::TimeDelta& timeout) {
82 guest_hang_timeout_ = timeout; 82 guest_hang_timeout_ = timeout;
83 } 83 }
84 84
85 void set_embedder_render_process_host( 85 void set_embedder_web_contents(WebContents* web_contents) {
86 RenderProcessHost* render_process_host) { 86 embedder_web_contents_ = web_contents;
87 embedder_render_process_host_ = render_process_host;
88 }
89 void set_embedder_render_view_host(RenderViewHost* render_view_host) {
90 embedder_render_view_host_ = render_view_host;
91 } 87 }
92 88
93 bool visible() const { return visible_; } 89 bool visible() const { return visible_; }
94 90
95 // NotificationObserver implementation. 91 // NotificationObserver implementation.
96 virtual void Observe(int type, 92 virtual void Observe(int type,
97 const NotificationSource& source, 93 const NotificationSource& source,
98 const NotificationDetails& details) OVERRIDE; 94 const NotificationDetails& details) OVERRIDE;
99 95
100 // WebContentsObserver implementation. 96 // WebContentsObserver implementation.
(...skipping 18 matching lines...) Expand all
119 PageTransition transition_type, 115 PageTransition transition_type,
120 RenderViewHost* render_view_host) OVERRIDE; 116 RenderViewHost* render_view_host) OVERRIDE;
121 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; 117 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
122 118
123 // WebContentsDelegate implementation. 119 // WebContentsDelegate implementation.
124 virtual bool CanDownload(RenderViewHost* render_view_host, 120 virtual bool CanDownload(RenderViewHost* render_view_host,
125 int request_id, 121 int request_id,
126 const std::string& request_method) OVERRIDE; 122 const std::string& request_method) OVERRIDE;
127 virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; 123 virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE;
128 virtual void RendererUnresponsive(WebContents* source) OVERRIDE; 124 virtual void RendererUnresponsive(WebContents* source) OVERRIDE;
125 virtual void RunFileChooser(WebContents* web_contents,
126 const FileChooserParams& params) OVERRIDE;
129 127
130 void UpdateRect(RenderViewHost* render_view_host, 128 void UpdateRect(RenderViewHost* render_view_host,
131 const ViewHostMsg_UpdateRect_Params& params); 129 const ViewHostMsg_UpdateRect_Params& params);
132 void UpdateRectACK(int message_id, const gfx::Size& size); 130 void UpdateRectACK(int message_id, const gfx::Size& size);
133 // Overrides default ShowWidget message so we show them on the correct 131 // Overrides default ShowWidget message so we show them on the correct
134 // coordinates. 132 // coordinates.
135 void ShowWidget(RenderViewHost* render_view_host, 133 void ShowWidget(RenderViewHost* render_view_host,
136 int route_id, 134 int route_id,
137 const gfx::Rect& initial_pos); 135 const gfx::Rect& initial_pos);
138 void SetCursor(const WebCursor& cursor); 136 void SetCursor(const WebCursor& cursor);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 const gfx::Size& damage_view_size, 206 const gfx::Size& damage_view_size,
209 float scale_factor); 207 float scale_factor);
210 208
211 private: 209 private:
212 friend class TestBrowserPluginGuest; 210 friend class TestBrowserPluginGuest;
213 211
214 BrowserPluginGuest(int instance_id, 212 BrowserPluginGuest(int instance_id,
215 WebContentsImpl* web_contents, 213 WebContentsImpl* web_contents,
216 RenderViewHost* render_view_host); 214 RenderViewHost* render_view_host);
217 215
218 RenderProcessHost* embedder_render_process_host() {
219 return embedder_render_process_host_;
220 }
221 // Returns the identifier that uniquely identifies a browser plugin guest 216 // Returns the identifier that uniquely identifies a browser plugin guest
222 // within an embedder. 217 // within an embedder.
223 int instance_id() const { return instance_id_; } 218 int instance_id() const { return instance_id_; }
224 TransportDIB* damage_buffer() const { return damage_buffer_.get(); } 219 TransportDIB* damage_buffer() const { return damage_buffer_.get(); }
225 const gfx::Size& damage_view_size() const { return damage_view_size_; } 220 const gfx::Size& damage_view_size() const { return damage_view_size_; }
226 float damage_buffer_scale_factor() const { 221 float damage_buffer_scale_factor() const {
227 return damage_buffer_scale_factor_; 222 return damage_buffer_scale_factor_;
228 } 223 }
229 224
230 // Helper to send messages to embedder. Overridden in test implementation 225 // Helper to send messages to embedder. Overridden in test implementation
231 // since we want to intercept certain messages for testing. 226 // since we want to intercept certain messages for testing.
232 virtual void SendMessageToEmbedder(IPC::Message* msg); 227 virtual void SendMessageToEmbedder(IPC::Message* msg);
233 228
234 // Called when a redirect notification occurs. 229 // Called when a redirect notification occurs.
235 void LoadRedirect(const GURL& old_url, 230 void LoadRedirect(const GURL& old_url,
236 const GURL& new_url, 231 const GURL& new_url,
237 bool is_top_level); 232 bool is_top_level);
238 233
239 // Static factory instance (always NULL for non-test). 234 // Static factory instance (always NULL for non-test).
240 static content::BrowserPluginHostFactory* factory_; 235 static content::BrowserPluginHostFactory* factory_;
241 236
242 NotificationRegistrar notification_registrar_; 237 NotificationRegistrar notification_registrar_;
243 RenderProcessHost* embedder_render_process_host_; 238 WebContents* embedder_web_contents_;
244 RenderViewHost* embedder_render_view_host_;
245 // An identifier that uniquely identifies a browser plugin guest within an 239 // An identifier that uniquely identifies a browser plugin guest within an
246 // embedder. 240 // embedder.
247 int instance_id_; 241 int instance_id_;
248 scoped_ptr<TransportDIB> damage_buffer_; 242 scoped_ptr<TransportDIB> damage_buffer_;
249 #if defined(OS_WIN) 243 #if defined(OS_WIN)
250 size_t damage_buffer_size_; 244 size_t damage_buffer_size_;
251 #endif 245 #endif
252 gfx::Size damage_view_size_; 246 gfx::Size damage_view_size_;
253 float damage_buffer_scale_factor_; 247 float damage_buffer_scale_factor_;
254 scoped_ptr<IPC::Message> pending_input_event_reply_; 248 scoped_ptr<IPC::Message> pending_input_event_reply_;
255 gfx::Rect guest_rect_; 249 gfx::Rect guest_rect_;
256 WebCursor cursor_; 250 WebCursor cursor_;
257 IDMap<RenderViewHost> pending_updates_; 251 IDMap<RenderViewHost> pending_updates_;
258 int pending_update_counter_; 252 int pending_update_counter_;
259 base::TimeDelta guest_hang_timeout_; 253 base::TimeDelta guest_hang_timeout_;
260 bool visible_; 254 bool visible_;
261 255
262 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); 256 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest);
263 }; 257 };
264 258
265 } // namespace content 259 } // namespace content
266 260
267 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ 261 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_embedder.cc ('k') | content/browser/browser_plugin/browser_plugin_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698