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/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 BrowserPlugin::BrowserPlugin( | 69 BrowserPlugin::BrowserPlugin( |
70 RenderViewImpl* render_view, | 70 RenderViewImpl* render_view, |
71 WebKit::WebFrame* frame, | 71 WebKit::WebFrame* frame, |
72 const WebPluginParams& params) | 72 const WebPluginParams& params) |
73 : guest_instance_id_(browser_plugin::kInstanceIDNone), | 73 : guest_instance_id_(browser_plugin::kInstanceIDNone), |
74 attached_(false), | 74 attached_(false), |
75 render_view_(render_view->AsWeakPtr()), | 75 render_view_(render_view->AsWeakPtr()), |
76 render_view_routing_id_(render_view->GetRoutingID()), | 76 render_view_routing_id_(render_view->GetRoutingID()), |
77 container_(NULL), | 77 container_(NULL), |
78 damage_buffer_sequence_id_(0), | 78 damage_buffer_sequence_id_(0), |
79 paint_ack_received_(true), | 79 resize_ack_received_(true), |
80 last_device_scale_factor_(1.0f), | 80 last_device_scale_factor_(1.0f), |
81 sad_guest_(NULL), | 81 sad_guest_(NULL), |
82 guest_crashed_(false), | 82 guest_crashed_(false), |
83 is_auto_size_state_dirty_(false), | 83 auto_size_ack_pending_(false), |
84 persist_storage_(false), | 84 persist_storage_(false), |
85 valid_partition_id_(true), | 85 valid_partition_id_(true), |
86 content_window_routing_id_(MSG_ROUTING_NONE), | 86 content_window_routing_id_(MSG_ROUTING_NONE), |
87 plugin_focused_(false), | 87 plugin_focused_(false), |
88 visible_(true), | 88 visible_(true), |
89 before_first_navigation_(true), | 89 before_first_navigation_(true), |
90 mouse_locked_(false), | 90 mouse_locked_(false), |
91 browser_plugin_manager_(render_view->GetBrowserPluginManager()), | 91 browser_plugin_manager_(render_view->GetBrowserPluginManager()), |
92 compositing_enabled_(false), | 92 compositing_enabled_(false), |
93 weak_ptr_factory_(this) { | 93 weak_ptr_factory_(this) { |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 } | 288 } |
289 | 289 |
290 browser_plugin_manager()->Send( | 290 browser_plugin_manager()->Send( |
291 new BrowserPluginHostMsg_NavigateGuest(render_view_routing_id_, | 291 new BrowserPluginHostMsg_NavigateGuest(render_view_routing_id_, |
292 guest_instance_id_, | 292 guest_instance_id_, |
293 src)); | 293 src)); |
294 return true; | 294 return true; |
295 } | 295 } |
296 | 296 |
297 void BrowserPlugin::ParseAutoSizeAttribute() { | 297 void BrowserPlugin::ParseAutoSizeAttribute() { |
| 298 auto_size_ack_pending_ = true; |
298 last_view_size_ = plugin_rect_.size(); | 299 last_view_size_ = plugin_rect_.size(); |
299 UpdateGuestAutoSizeState(GetAutoSizeAttribute()); | 300 UpdateGuestAutoSizeState(GetAutoSizeAttribute()); |
300 } | 301 } |
301 | 302 |
302 void BrowserPlugin::PopulateAutoSizeParameters( | 303 void BrowserPlugin::PopulateAutoSizeParameters( |
303 BrowserPluginHostMsg_AutoSize_Params* params, bool auto_size_enabled) { | 304 BrowserPluginHostMsg_AutoSize_Params* params, bool current_auto_size) { |
304 params->enable = auto_size_enabled; | 305 params->enable = current_auto_size; |
305 // No need to populate the params if autosize is off. | 306 // No need to populate the params if autosize is off. |
306 if (auto_size_enabled) { | 307 if (current_auto_size) { |
307 params->max_size = gfx::Size(GetAdjustedMaxWidth(), GetAdjustedMaxHeight()); | 308 params->max_size = gfx::Size(GetAdjustedMaxWidth(), GetAdjustedMaxHeight()); |
308 params->min_size = gfx::Size(GetAdjustedMinWidth(), GetAdjustedMinHeight()); | 309 params->min_size = gfx::Size(GetAdjustedMinWidth(), GetAdjustedMinHeight()); |
309 | |
310 if (max_auto_size_ != params->max_size) | |
311 is_auto_size_state_dirty_ = true; | |
312 | |
313 max_auto_size_ = params->max_size; | |
314 } else { | |
315 max_auto_size_ = gfx::Size(); | |
316 } | 310 } |
317 } | 311 } |
318 | 312 |
319 void BrowserPlugin::UpdateGuestAutoSizeState(bool auto_size_enabled) { | 313 void BrowserPlugin::UpdateGuestAutoSizeState(bool current_auto_size) { |
320 // If we haven't yet heard back from the guest about the last resize request, | 314 // If we haven't yet heard back from the guest about the last resize request, |
321 // then we don't issue another request until we do in | 315 // then we don't issue another request until we do in |
322 // BrowserPlugin::UpdateRect. | 316 // BrowserPlugin::UpdateRect. |
323 if (!HasGuestInstanceID()) | 317 if (!HasGuestInstanceID() || !resize_ack_received_) |
324 return; | 318 return; |
325 | |
326 is_auto_size_state_dirty_ = true; | |
327 | |
328 if (!paint_ack_received_) | |
329 return; | |
330 | |
331 BrowserPluginHostMsg_AutoSize_Params auto_size_params; | 319 BrowserPluginHostMsg_AutoSize_Params auto_size_params; |
332 BrowserPluginHostMsg_ResizeGuest_Params resize_guest_params; | 320 BrowserPluginHostMsg_ResizeGuest_Params resize_guest_params; |
333 if (auto_size_enabled) { | 321 if (current_auto_size) { |
334 GetDamageBufferWithSizeParams(&auto_size_params, | 322 GetDamageBufferWithSizeParams(&auto_size_params, &resize_guest_params); |
335 &resize_guest_params, | |
336 true); | |
337 } else { | 323 } else { |
338 GetDamageBufferWithSizeParams(NULL, &resize_guest_params, true); | 324 GetDamageBufferWithSizeParams(NULL, &resize_guest_params); |
339 } | 325 } |
340 paint_ack_received_ = false; | 326 resize_ack_received_ = false; |
341 browser_plugin_manager()->Send( | 327 browser_plugin_manager()->Send( |
342 new BrowserPluginHostMsg_SetAutoSize(render_view_routing_id_, | 328 new BrowserPluginHostMsg_SetAutoSize(render_view_routing_id_, |
343 guest_instance_id_, | 329 guest_instance_id_, |
344 auto_size_params, | 330 auto_size_params, |
345 resize_guest_params)); | 331 resize_guest_params)); |
346 } | 332 } |
347 | 333 |
348 // static | 334 // static |
349 bool BrowserPlugin::UsesDamageBuffer( | 335 bool BrowserPlugin::UsesDamageBuffer( |
350 const BrowserPluginMsg_UpdateRect_Params& params) { | 336 const BrowserPluginMsg_UpdateRect_Params& params) { |
(...skipping 21 matching lines...) Expand all Loading... |
372 | 358 |
373 void BrowserPlugin::Attach(scoped_ptr<base::DictionaryValue> extra_params) { | 359 void BrowserPlugin::Attach(scoped_ptr<base::DictionaryValue> extra_params) { |
374 BrowserPluginHostMsg_Attach_Params attach_params; | 360 BrowserPluginHostMsg_Attach_Params attach_params; |
375 attach_params.focused = ShouldGuestBeFocused(); | 361 attach_params.focused = ShouldGuestBeFocused(); |
376 attach_params.visible = visible_; | 362 attach_params.visible = visible_; |
377 attach_params.name = GetNameAttribute(); | 363 attach_params.name = GetNameAttribute(); |
378 attach_params.storage_partition_id = storage_partition_id_; | 364 attach_params.storage_partition_id = storage_partition_id_; |
379 attach_params.persist_storage = persist_storage_; | 365 attach_params.persist_storage = persist_storage_; |
380 attach_params.src = GetSrcAttribute(); | 366 attach_params.src = GetSrcAttribute(); |
381 GetDamageBufferWithSizeParams(&attach_params.auto_size_params, | 367 GetDamageBufferWithSizeParams(&attach_params.auto_size_params, |
382 &attach_params.resize_guest_params, | 368 &attach_params.resize_guest_params); |
383 false); | |
384 | 369 |
385 browser_plugin_manager()->Send( | 370 browser_plugin_manager()->Send( |
386 new BrowserPluginHostMsg_Attach(render_view_routing_id_, | 371 new BrowserPluginHostMsg_Attach(render_view_routing_id_, |
387 guest_instance_id_, attach_params, | 372 guest_instance_id_, attach_params, |
388 *extra_params)); | 373 *extra_params)); |
389 } | 374 } |
390 | 375 |
391 void BrowserPlugin::DidCommitCompositorFrame() { | 376 void BrowserPlugin::DidCommitCompositorFrame() { |
392 if (compositing_helper_.get()) | 377 if (compositing_helper_.get()) |
393 compositing_helper_->DidCommitCompositorFrame(); | 378 compositing_helper_->DidCommitCompositorFrame(); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 // damage buffer then we know the guest will no longer use the current | 491 // damage buffer then we know the guest will no longer use the current |
507 // damage buffer. At this point, we drop the current damage buffer, and | 492 // damage buffer. At this point, we drop the current damage buffer, and |
508 // mark the pending damage buffer as the current damage buffer. | 493 // mark the pending damage buffer as the current damage buffer. |
509 if (UsesPendingDamageBuffer(params)) { | 494 if (UsesPendingDamageBuffer(params)) { |
510 SwapDamageBuffers(); | 495 SwapDamageBuffers(); |
511 use_new_damage_buffer = true; | 496 use_new_damage_buffer = true; |
512 } | 497 } |
513 | 498 |
514 bool auto_size = GetAutoSizeAttribute(); | 499 bool auto_size = GetAutoSizeAttribute(); |
515 // We receive a resize ACK in regular mode, but not in autosize. | 500 // We receive a resize ACK in regular mode, but not in autosize. |
516 // In SW, |paint_ack_received_| is reset in SwapDamageBuffers(). | 501 // In SW, |resize_ack_received_| is reset in SwapDamageBuffers(). |
517 // In HW mode, we need to do it here so we can continue sending | 502 // In HW mode, we need to do it here so we can continue sending |
518 // resize messages when needed. | 503 // resize messages when needed. |
519 if (params.is_resize_ack || | 504 if (params.is_resize_ack || |
520 (!params.needs_ack && (auto_size || is_auto_size_state_dirty_))) { | 505 (!params.needs_ack && (auto_size || auto_size_ack_pending_))) { |
521 paint_ack_received_ = true; | 506 resize_ack_received_ = true; |
522 } | 507 } |
523 | 508 |
524 bool was_auto_size_state_dirty = auto_size && is_auto_size_state_dirty_; | 509 auto_size_ack_pending_ = false; |
525 is_auto_size_state_dirty_ = false; | |
526 | 510 |
527 if ((!auto_size && (width() != params.view_size.width() || | 511 if ((!auto_size && (width() != params.view_size.width() || |
528 height() != params.view_size.height())) || | 512 height() != params.view_size.height())) || |
529 (auto_size && was_auto_size_state_dirty) || | 513 (auto_size && (!InAutoSizeBounds(params.view_size))) || |
530 GetDeviceScaleFactor() != params.scale_factor) { | 514 GetDeviceScaleFactor() != params.scale_factor) { |
531 // We are HW accelerated, render widget does not expect an ack, | 515 // We are HW accelerated, render widget does not expect an ack, |
532 // but we still need to update the size. | 516 // but we still need to update the size. |
533 if (!params.needs_ack) { | 517 if (!params.needs_ack) { |
534 UpdateGuestAutoSizeState(auto_size); | 518 UpdateGuestAutoSizeState(auto_size); |
535 return; | 519 return; |
536 } | 520 } |
537 | 521 |
538 if (!paint_ack_received_) { | 522 if (!resize_ack_received_) { |
539 // The guest has not yet responded to the last resize request, and | 523 // The guest has not yet responded to the last resize request, and |
540 // so we don't want to do anything at this point other than ACK the guest. | 524 // so we don't want to do anything at this point other than ACK the guest. |
541 if (auto_size) | 525 if (auto_size) |
542 PopulateAutoSizeParameters(&auto_size_params, auto_size); | 526 PopulateAutoSizeParameters(&auto_size_params, auto_size); |
543 } else { | 527 } else { |
544 // If we have no pending damage buffer, then the guest has not caught up | 528 // If we have no pending damage buffer, then the guest has not caught up |
545 // with the BrowserPlugin container. We now tell the guest about the new | 529 // with the BrowserPlugin container. We now tell the guest about the new |
546 // container size. | 530 // container size. |
547 if (auto_size) { | 531 if (auto_size) { |
548 GetDamageBufferWithSizeParams(&auto_size_params, | 532 GetDamageBufferWithSizeParams(&auto_size_params, |
549 &resize_guest_params, | 533 &resize_guest_params); |
550 was_auto_size_state_dirty); | |
551 } else { | 534 } else { |
552 GetDamageBufferWithSizeParams(NULL, | 535 GetDamageBufferWithSizeParams(NULL, &resize_guest_params); |
553 &resize_guest_params, | |
554 was_auto_size_state_dirty); | |
555 } | 536 } |
556 } | 537 } |
557 browser_plugin_manager()->Send(new BrowserPluginHostMsg_UpdateRect_ACK( | 538 browser_plugin_manager()->Send(new BrowserPluginHostMsg_UpdateRect_ACK( |
558 render_view_routing_id_, | 539 render_view_routing_id_, |
559 guest_instance_id_, | 540 guest_instance_id_, |
560 true, | 541 true, |
561 auto_size_params, | 542 auto_size_params, |
562 resize_guest_params)); | 543 resize_guest_params)); |
563 return; | 544 return; |
564 } | 545 } |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 ParseSrcAttribute(&error); | 740 ParseSrcAttribute(&error); |
760 } | 741 } |
761 | 742 |
762 float BrowserPlugin::GetDeviceScaleFactor() const { | 743 float BrowserPlugin::GetDeviceScaleFactor() const { |
763 if (!render_view_.get()) | 744 if (!render_view_.get()) |
764 return 1.0f; | 745 return 1.0f; |
765 return render_view_->GetWebView()->deviceScaleFactor(); | 746 return render_view_->GetWebView()->deviceScaleFactor(); |
766 } | 747 } |
767 | 748 |
768 void BrowserPlugin::UpdateDeviceScaleFactor(float device_scale_factor) { | 749 void BrowserPlugin::UpdateDeviceScaleFactor(float device_scale_factor) { |
769 if (last_device_scale_factor_ == device_scale_factor || !paint_ack_received_) | 750 if (last_device_scale_factor_ == device_scale_factor || !resize_ack_received_) |
770 return; | 751 return; |
771 | 752 |
772 BrowserPluginHostMsg_ResizeGuest_Params params; | 753 BrowserPluginHostMsg_ResizeGuest_Params params; |
773 PopulateResizeGuestParameters(¶ms, plugin_rect(), false); | 754 PopulateResizeGuestParameters(¶ms, plugin_rect()); |
774 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ResizeGuest( | 755 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ResizeGuest( |
775 render_view_routing_id_, | 756 render_view_routing_id_, |
776 guest_instance_id_, | 757 guest_instance_id_, |
777 params)); | 758 params)); |
778 } | 759 } |
779 | 760 |
780 void BrowserPlugin::TriggerEvent(const std::string& event_name, | 761 void BrowserPlugin::TriggerEvent(const std::string& event_name, |
781 std::map<std::string, base::Value*>* props) { | 762 std::map<std::string, base::Value*>* props) { |
782 if (!container()) | 763 if (!container()) |
783 return; | 764 return; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 compositing_helper_ = | 853 compositing_helper_ = |
873 new BrowserPluginCompositingHelper(container_, | 854 new BrowserPluginCompositingHelper(container_, |
874 browser_plugin_manager(), | 855 browser_plugin_manager(), |
875 guest_instance_id_, | 856 guest_instance_id_, |
876 render_view_routing_id_); | 857 render_view_routing_id_); |
877 } | 858 } |
878 } else { | 859 } else { |
879 // We're switching back to the software path. We create a new damage | 860 // We're switching back to the software path. We create a new damage |
880 // buffer that can accommodate the current size of the container. | 861 // buffer that can accommodate the current size of the container. |
881 BrowserPluginHostMsg_ResizeGuest_Params params; | 862 BrowserPluginHostMsg_ResizeGuest_Params params; |
| 863 PopulateResizeGuestParameters(¶ms, plugin_rect()); |
882 // Request a full repaint from the guest even if its size is not actually | 864 // Request a full repaint from the guest even if its size is not actually |
883 // changing. | 865 // changing. |
884 PopulateResizeGuestParameters(¶ms, | 866 params.repaint = true; |
885 plugin_rect(), | 867 resize_ack_received_ = false; |
886 true /* needs_repaint */); | |
887 paint_ack_received_ = false; | |
888 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ResizeGuest( | 868 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ResizeGuest( |
889 render_view_routing_id_, | 869 render_view_routing_id_, |
890 guest_instance_id_, | 870 guest_instance_id_, |
891 params)); | 871 params)); |
892 } | 872 } |
893 compositing_helper_->EnableCompositing(enable); | 873 compositing_helper_->EnableCompositing(enable); |
894 } | 874 } |
895 | 875 |
896 void BrowserPlugin::destroy() { | 876 void BrowserPlugin::destroy() { |
897 // If the plugin was initialized then it has a valid |npp_| identifier, and | 877 // If the plugin was initialized then it has a valid |npp_| identifier, and |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 const WebRect& clip_rect, | 1001 const WebRect& clip_rect, |
1022 const WebVector<WebRect>& cut_outs_rects, | 1002 const WebVector<WebRect>& cut_outs_rects, |
1023 bool is_visible) { | 1003 bool is_visible) { |
1024 int old_width = width(); | 1004 int old_width = width(); |
1025 int old_height = height(); | 1005 int old_height = height(); |
1026 plugin_rect_ = window_rect; | 1006 plugin_rect_ = window_rect; |
1027 if (!attached()) | 1007 if (!attached()) |
1028 return; | 1008 return; |
1029 | 1009 |
1030 // In AutoSize mode, guests don't care when the BrowserPlugin container is | 1010 // In AutoSize mode, guests don't care when the BrowserPlugin container is |
1031 // resized. If |!paint_ack_received_|, then we are still waiting on a | 1011 // resized. If |!resize_ack_received_|, then we are still waiting on a |
1032 // previous resize to be ACK'ed and so we don't issue additional resizes | 1012 // previous resize to be ACK'ed and so we don't issue additional resizes |
1033 // until the previous one is ACK'ed. | 1013 // until the previous one is ACK'ed. |
1034 // TODO(mthiesse): Assess the performance of calling GetAutoSizeAttribute() on | 1014 // TODO(mthiesse): Assess the performance of calling GetAutoSizeAttribute() on |
1035 // resize. | 1015 // resize. |
1036 if (!paint_ack_received_ || | 1016 if (!resize_ack_received_ || |
1037 (old_width == window_rect.width && old_height == window_rect.height) || | 1017 (old_width == window_rect.width && old_height == window_rect.height) || |
1038 GetAutoSizeAttribute()) { | 1018 GetAutoSizeAttribute()) { |
1039 // Let the browser know about the updated view rect. | 1019 // Let the browser know about the updated view rect. |
1040 browser_plugin_manager()->Send(new BrowserPluginHostMsg_UpdateGeometry( | 1020 browser_plugin_manager()->Send(new BrowserPluginHostMsg_UpdateGeometry( |
1041 render_view_routing_id_, guest_instance_id_, plugin_rect_)); | 1021 render_view_routing_id_, guest_instance_id_, plugin_rect_)); |
1042 return; | 1022 return; |
1043 } | 1023 } |
1044 | 1024 |
1045 BrowserPluginHostMsg_ResizeGuest_Params params; | 1025 BrowserPluginHostMsg_ResizeGuest_Params params; |
1046 PopulateResizeGuestParameters(¶ms, plugin_rect(), false); | 1026 PopulateResizeGuestParameters(¶ms, plugin_rect()); |
1047 paint_ack_received_ = false; | 1027 resize_ack_received_ = false; |
1048 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ResizeGuest( | 1028 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ResizeGuest( |
1049 render_view_routing_id_, | 1029 render_view_routing_id_, |
1050 guest_instance_id_, | 1030 guest_instance_id_, |
1051 params)); | 1031 params)); |
1052 } | 1032 } |
1053 | 1033 |
1054 void BrowserPlugin::SwapDamageBuffers() { | 1034 void BrowserPlugin::SwapDamageBuffers() { |
1055 current_damage_buffer_.reset(pending_damage_buffer_.release()); | 1035 current_damage_buffer_.reset(pending_damage_buffer_.release()); |
1056 paint_ack_received_ = true; | 1036 resize_ack_received_ = true; |
1057 } | 1037 } |
1058 | 1038 |
1059 void BrowserPlugin::PopulateResizeGuestParameters( | 1039 void BrowserPlugin::PopulateResizeGuestParameters( |
1060 BrowserPluginHostMsg_ResizeGuest_Params* params, | 1040 BrowserPluginHostMsg_ResizeGuest_Params* params, |
1061 const gfx::Rect& view_rect, | 1041 const gfx::Rect& view_rect) { |
1062 bool needs_repaint) { | |
1063 params->size_changed = true; | 1042 params->size_changed = true; |
1064 params->view_rect = view_rect; | 1043 params->view_rect = view_rect; |
1065 params->repaint = needs_repaint; | |
1066 params->scale_factor = GetDeviceScaleFactor(); | 1044 params->scale_factor = GetDeviceScaleFactor(); |
1067 if (last_device_scale_factor_ != params->scale_factor){ | 1045 if (last_device_scale_factor_ != params->scale_factor){ |
1068 params->repaint = true; | 1046 params->repaint = true; |
1069 last_device_scale_factor_ = params->scale_factor; | 1047 last_device_scale_factor_ = params->scale_factor; |
1070 } | 1048 } |
1071 | 1049 |
1072 // In HW compositing mode, we do not need a damage buffer. | 1050 // In HW compositing mode, we do not need a damage buffer. |
1073 if (compositing_enabled_) | 1051 if (compositing_enabled_) |
1074 return; | 1052 return; |
1075 | 1053 |
(...skipping 10 matching lines...) Expand all Loading... |
1086 params->damage_buffer_size = size; | 1064 params->damage_buffer_size = size; |
1087 pending_damage_buffer_.reset( | 1065 pending_damage_buffer_.reset( |
1088 CreateDamageBuffer(size, ¶ms->damage_buffer_handle)); | 1066 CreateDamageBuffer(size, ¶ms->damage_buffer_handle)); |
1089 if (!pending_damage_buffer_) | 1067 if (!pending_damage_buffer_) |
1090 NOTREACHED(); | 1068 NOTREACHED(); |
1091 params->damage_buffer_sequence_id = ++damage_buffer_sequence_id_; | 1069 params->damage_buffer_sequence_id = ++damage_buffer_sequence_id_; |
1092 } | 1070 } |
1093 | 1071 |
1094 void BrowserPlugin::GetDamageBufferWithSizeParams( | 1072 void BrowserPlugin::GetDamageBufferWithSizeParams( |
1095 BrowserPluginHostMsg_AutoSize_Params* auto_size_params, | 1073 BrowserPluginHostMsg_AutoSize_Params* auto_size_params, |
1096 BrowserPluginHostMsg_ResizeGuest_Params* resize_guest_params, | 1074 BrowserPluginHostMsg_ResizeGuest_Params* resize_guest_params) { |
1097 bool needs_repaint) { | 1075 if (auto_size_params) |
1098 if (auto_size_params) { | |
1099 PopulateAutoSizeParameters(auto_size_params, GetAutoSizeAttribute()); | 1076 PopulateAutoSizeParameters(auto_size_params, GetAutoSizeAttribute()); |
1100 } else { | |
1101 max_auto_size_ = gfx::Size(); | |
1102 } | |
1103 gfx::Size view_size = (auto_size_params && auto_size_params->enable) ? | 1077 gfx::Size view_size = (auto_size_params && auto_size_params->enable) ? |
1104 auto_size_params->max_size : gfx::Size(width(), height()); | 1078 auto_size_params->max_size : gfx::Size(width(), height()); |
1105 if (view_size.IsEmpty()) | 1079 if (view_size.IsEmpty()) |
1106 return; | 1080 return; |
1107 paint_ack_received_ = false; | 1081 resize_ack_received_ = false; |
1108 gfx::Rect view_rect = gfx::Rect(plugin_rect_.origin(), view_size); | 1082 gfx::Rect view_rect = gfx::Rect(plugin_rect_.origin(), view_size); |
1109 PopulateResizeGuestParameters(resize_guest_params, view_rect, needs_repaint); | 1083 PopulateResizeGuestParameters(resize_guest_params, view_rect); |
1110 } | 1084 } |
1111 | 1085 |
1112 #if defined(OS_POSIX) | 1086 #if defined(OS_POSIX) |
1113 base::SharedMemory* BrowserPlugin::CreateDamageBuffer( | 1087 base::SharedMemory* BrowserPlugin::CreateDamageBuffer( |
1114 const size_t size, | 1088 const size_t size, |
1115 base::SharedMemoryHandle* damage_buffer_handle) { | 1089 base::SharedMemoryHandle* damage_buffer_handle) { |
1116 scoped_ptr<base::SharedMemory> shared_buf( | 1090 scoped_ptr<base::SharedMemory> shared_buf( |
1117 content::RenderThread::Get()->HostAllocateSharedMemoryBuffer( | 1091 content::RenderThread::Get()->HostAllocateSharedMemoryBuffer( |
1118 size).release()); | 1092 size).release()); |
1119 | 1093 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 const WebKit::WebMouseEvent& event) { | 1279 const WebKit::WebMouseEvent& event) { |
1306 browser_plugin_manager()->Send( | 1280 browser_plugin_manager()->Send( |
1307 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, | 1281 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, |
1308 guest_instance_id_, | 1282 guest_instance_id_, |
1309 plugin_rect_, | 1283 plugin_rect_, |
1310 &event)); | 1284 &event)); |
1311 return true; | 1285 return true; |
1312 } | 1286 } |
1313 | 1287 |
1314 } // namespace content | 1288 } // namespace content |
OLD | NEW |