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

Side by Side Diff: content/renderer/browser_plugin/browser_plugin.cc

Issue 10868012: Browser Plugin: New Implementation (Browser Side) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master-trial-obrowser
Patch Set: Fixed tests. Also fixed a case where UpdateRect was being sent from bp renderer before NavigateGues… Created 8 years, 4 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
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 #include "content/renderer/browser_plugin/browser_plugin.h" 5 #include "content/renderer/browser_plugin/browser_plugin.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "content/common/browser_plugin_messages.h" 9 #include "content/common/browser_plugin_messages.h"
10 #include "content/public/common/content_client.h" 10 #include "content/public/common/content_client.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 std::string BrowserPlugin::GetSrcAttribute() const { 86 std::string BrowserPlugin::GetSrcAttribute() const {
87 return src_; 87 return src_;
88 } 88 }
89 89
90 void BrowserPlugin::SetSrcAttribute(const std::string& src) { 90 void BrowserPlugin::SetSrcAttribute(const std::string& src) {
91 if (src == src_ && !guest_crashed_) 91 if (src == src_ && !guest_crashed_)
92 return; 92 return;
93 if (!src.empty()) { 93 if (!src.empty()) {
94 BrowserPluginManager::Get()->Send( 94 BrowserPluginManager::Get()->Send(
95 new BrowserPluginHostMsg_NavigateOrCreateGuest( 95 new BrowserPluginHostMsg_NavigateGuest(
96 render_view_->GetRoutingID(), 96 render_view_->GetRoutingID(),
97 instance_id_, 97 instance_id_,
98 parent_frame_, 98 parent_frame_,
99 src)); 99 src,
100 gfx::Size(width(), height())));
100 } 101 }
101 src_ = src; 102 src_ = src;
102 guest_crashed_ = false; 103 guest_crashed_ = false;
103 } 104 }
104 105
105 bool BrowserPlugin::ParseSrcAttribute( 106 bool BrowserPlugin::ParseSrcAttribute(
106 const WebKit::WebPluginParams& params, 107 const WebKit::WebPluginParams& params,
107 std::string* src) { 108 std::string* src) {
108 // Get the src attribute from the attributes vector 109 // Get the src attribute from the attributes vector
109 for (unsigned i = 0; i < params.attributeNames.size(); ++i) { 110 for (unsigned i = 0; i < params.attributeNames.size(); ++i) {
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 const WebRect& window_rect, 323 const WebRect& window_rect,
323 const WebRect& clip_rect, 324 const WebRect& clip_rect,
324 const WebVector<WebRect>& cut_outs_rects, 325 const WebVector<WebRect>& cut_outs_rects,
325 bool is_visible) { 326 bool is_visible) {
326 int old_width = width(); 327 int old_width = width();
327 int old_height = height(); 328 int old_height = height();
328 plugin_rect_ = window_rect; 329 plugin_rect_ = window_rect;
329 if (old_width == window_rect.width && 330 if (old_width == window_rect.width &&
330 old_height == window_rect.height) 331 old_height == window_rect.height)
331 return; 332 return;
333 // TODO(fsamuel): Check if this is correct: When src is not set, we shouldn't
334 // send UpdateRect messages to the host.
335 if (src_.empty())
336 return;
332 337
333 const size_t stride = skia::PlatformCanvas::StrideForWidth(window_rect.width); 338 const size_t stride = skia::PlatformCanvas::StrideForWidth(window_rect.width);
334 const size_t size = window_rect.height * 339 const size_t size = window_rect.height *
335 stride * 340 stride *
336 GetDeviceScaleFactor() * 341 GetDeviceScaleFactor() *
337 GetDeviceScaleFactor(); 342 GetDeviceScaleFactor();
338 343
339 // Don't drop the old damage buffer until after we've made sure that the 344 // Don't drop the old damage buffer until after we've made sure that the
340 // browser process has dropped it. 345 // browser process has dropped it.
341 TransportDIB* new_damage_buffer = 346 TransportDIB* new_damage_buffer =
342 RenderProcess::current()->CreateTransportDIB(size); 347 RenderProcess::current()->CreateTransportDIB(size);
343 DCHECK(new_damage_buffer); 348 DCHECK(new_damage_buffer);
344 349
345 BrowserPluginHostMsg_ResizeGuest_Params params; 350 BrowserPluginHostMsg_ResizeGuest_Params params;
346 params.damage_buffer_id = new_damage_buffer->id(); 351 params.damage_buffer_id = new_damage_buffer->id();
347 params.width = window_rect.width; 352 params.width = window_rect.width;
348 params.height = window_rect.height; 353 params.height = window_rect.height;
349 params.resize_pending = resize_pending_; 354 params.resize_pending = resize_pending_;
350 params.scale_factor = GetDeviceScaleFactor(); 355 params.scale_factor = GetDeviceScaleFactor();
351 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_ResizeGuest( 356 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_ResizeGuest(
352 render_view_->GetRoutingID(), 357 render_view_->GetRoutingID(),
353 instance_id_, 358 instance_id_,
354 params)); 359 params));
355 resize_pending_ = true; 360 resize_pending_ = true;
356
rjkroege 2012/08/22 21:57:38 superfluous?
lazyboy 2012/08/23 00:45:22 Reverted. Done.
357 if (damage_buffer_) { 361 if (damage_buffer_) {
358 RenderProcess::current()->FreeTransportDIB(damage_buffer_); 362 RenderProcess::current()->FreeTransportDIB(damage_buffer_);
359 damage_buffer_ = NULL; 363 damage_buffer_ = NULL;
360 } 364 }
361 damage_buffer_ = new_damage_buffer; 365 damage_buffer_ = new_damage_buffer;
362 } 366 }
363 367
364 void BrowserPlugin::updateFocus(bool focused) { 368 void BrowserPlugin::updateFocus(bool focused) {
365 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_SetFocus( 369 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_SetFocus(
366 render_view_->GetRoutingID(), 370 render_view_->GetRoutingID(),
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 void* notify_data) { 416 void* notify_data) {
413 } 417 }
414 418
415 void BrowserPlugin::didFailLoadingFrameRequest( 419 void BrowserPlugin::didFailLoadingFrameRequest(
416 const WebKit::WebURL& url, 420 const WebKit::WebURL& url,
417 void* notify_data, 421 void* notify_data,
418 const WebKit::WebURLError& error) { 422 const WebKit::WebURLError& error) {
419 } 423 }
420 424
421 } // namespace content 425 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698