OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 | 439 |
440 void BrowserPlugin::updateGeometry( | 440 void BrowserPlugin::updateGeometry( |
441 const WebRect& window_rect, | 441 const WebRect& window_rect, |
442 const WebRect& clip_rect, | 442 const WebRect& clip_rect, |
443 const WebVector<WebRect>& cut_outs_rects, | 443 const WebVector<WebRect>& cut_outs_rects, |
444 bool is_visible) { | 444 bool is_visible) { |
445 int old_width = width(); | 445 int old_width = width(); |
446 int old_height = height(); | 446 int old_height = height(); |
447 plugin_rect_ = window_rect; | 447 plugin_rect_ = window_rect; |
448 if (!ready_) { | 448 if (!ready_) { |
449 if (delegate_) | 449 if (delegate_) { |
| 450 delegate_->DidResizeElement(gfx::Size(), plugin_size()); |
450 delegate_->Ready(); | 451 delegate_->Ready(); |
| 452 } |
451 ready_ = true; | 453 ready_ = true; |
452 } | 454 } |
453 if (!attached()) | 455 if (!attached()) |
454 return; | 456 return; |
455 | 457 |
456 if (old_width == window_rect.width && old_height == window_rect.height) { | 458 if (old_width == window_rect.width && old_height == window_rect.height) { |
457 // Let the browser know about the updated view rect. | 459 // Let the browser know about the updated view rect. |
458 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_UpdateGeometry( | 460 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_UpdateGeometry( |
459 render_view_routing_id_, browser_plugin_instance_id_, plugin_rect_)); | 461 render_view_routing_id_, browser_plugin_instance_id_, plugin_rect_)); |
460 return; | 462 return; |
461 } | 463 } |
462 | 464 |
463 BrowserPluginHostMsg_ResizeGuest_Params params; | 465 BrowserPluginHostMsg_ResizeGuest_Params params; |
464 PopulateResizeGuestParameters(plugin_size(), ¶ms); | 466 PopulateResizeGuestParameters(plugin_size(), ¶ms); |
465 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_ResizeGuest( | 467 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_ResizeGuest( |
466 render_view_routing_id_, | 468 render_view_routing_id_, |
467 browser_plugin_instance_id_, | 469 browser_plugin_instance_id_, |
468 params)); | 470 params)); |
| 471 |
| 472 if (delegate_) { |
| 473 delegate_->DidResizeElement( |
| 474 gfx::Size(old_width, old_height), plugin_size()); |
| 475 } |
469 } | 476 } |
470 | 477 |
471 void BrowserPlugin::PopulateResizeGuestParameters( | 478 void BrowserPlugin::PopulateResizeGuestParameters( |
472 const gfx::Size& view_size, | 479 const gfx::Size& view_size, |
473 BrowserPluginHostMsg_ResizeGuest_Params* params) { | 480 BrowserPluginHostMsg_ResizeGuest_Params* params) { |
474 params->view_size = view_size; | 481 params->view_size = view_size; |
475 params->scale_factor = GetDeviceScaleFactor(); | 482 params->scale_factor = GetDeviceScaleFactor(); |
476 if (last_device_scale_factor_ != params->scale_factor) { | 483 if (last_device_scale_factor_ != params->scale_factor) { |
477 last_device_scale_factor_ = params->scale_factor; | 484 last_device_scale_factor_ = params->scale_factor; |
478 params->repaint = true; | 485 params->repaint = true; |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 const blink::WebMouseEvent& event) { | 669 const blink::WebMouseEvent& event) { |
663 BrowserPluginManager::Get()->Send( | 670 BrowserPluginManager::Get()->Send( |
664 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, | 671 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, |
665 browser_plugin_instance_id_, | 672 browser_plugin_instance_id_, |
666 plugin_rect_, | 673 plugin_rect_, |
667 &event)); | 674 &event)); |
668 return true; | 675 return true; |
669 } | 676 } |
670 | 677 |
671 } // namespace content | 678 } // namespace content |
OLD | NEW |