| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/renderer_host/render_widget_host.h" | 5 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 6 | 6 |
| 7 #include "app/keyboard_codes.h" | 7 #include "app/keyboard_codes.h" |
| 8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 // only place we use this is for the case of dropdown menus and other | 600 // only place we use this is for the case of dropdown menus and other |
| 601 // edge cases for which edit commands don't make sense. | 601 // edge cases for which edit commands don't make sense. |
| 602 } | 602 } |
| 603 | 603 |
| 604 void RenderWidgetHost::ForwardEditCommandsForNextKeyEvent( | 604 void RenderWidgetHost::ForwardEditCommandsForNextKeyEvent( |
| 605 const EditCommands& edit_commands) { | 605 const EditCommands& edit_commands) { |
| 606 // We don't need an implementation of this function here since this message is | 606 // We don't need an implementation of this function here since this message is |
| 607 // only handled by RenderView. | 607 // only handled by RenderView. |
| 608 } | 608 } |
| 609 | 609 |
| 610 void RenderWidgetHost::RendererExited() { | 610 void RenderWidgetHost::RendererExited(base::TerminationStatus status, |
| 611 int exit_code) { |
| 611 // Clearing this flag causes us to re-create the renderer when recovering | 612 // Clearing this flag causes us to re-create the renderer when recovering |
| 612 // from a crashed renderer. | 613 // from a crashed renderer. |
| 613 renderer_initialized_ = false; | 614 renderer_initialized_ = false; |
| 614 | 615 |
| 615 // Must reset these to ensure that mouse move/wheel events work with a new | 616 // Must reset these to ensure that mouse move/wheel events work with a new |
| 616 // renderer. | 617 // renderer. |
| 617 mouse_move_pending_ = false; | 618 mouse_move_pending_ = false; |
| 618 next_mouse_move_.reset(); | 619 next_mouse_move_.reset(); |
| 619 mouse_wheel_pending_ = false; | 620 mouse_wheel_pending_ = false; |
| 620 coalesced_mouse_wheel_events_.clear(); | 621 coalesced_mouse_wheel_events_.clear(); |
| 621 | 622 |
| 622 // Must reset these to ensure that keyboard events work with a new renderer. | 623 // Must reset these to ensure that keyboard events work with a new renderer. |
| 623 key_queue_.clear(); | 624 key_queue_.clear(); |
| 624 suppress_next_char_events_ = false; | 625 suppress_next_char_events_ = false; |
| 625 | 626 |
| 626 // Reset some fields in preparation for recovering from a crash. | 627 // Reset some fields in preparation for recovering from a crash. |
| 627 resize_ack_pending_ = false; | 628 resize_ack_pending_ = false; |
| 628 repaint_ack_pending_ = false; | 629 repaint_ack_pending_ = false; |
| 629 | 630 |
| 630 in_flight_size_.SetSize(0, 0); | 631 in_flight_size_.SetSize(0, 0); |
| 631 in_flight_reserved_rect_.SetRect(0, 0, 0, 0); | 632 in_flight_reserved_rect_.SetRect(0, 0, 0, 0); |
| 632 current_size_.SetSize(0, 0); | 633 current_size_.SetSize(0, 0); |
| 633 current_reserved_rect_.SetRect(0, 0, 0, 0); | 634 current_reserved_rect_.SetRect(0, 0, 0, 0); |
| 634 is_hidden_ = false; | 635 is_hidden_ = false; |
| 635 is_gpu_rendering_active_ = false; | 636 is_gpu_rendering_active_ = false; |
| 636 | 637 |
| 637 if (view_) { | 638 if (view_) { |
| 638 view_->RenderViewGone(); | 639 view_->RenderViewGone(status, exit_code); |
| 639 view_ = NULL; // The View should be deleted by RenderViewGone. | 640 view_ = NULL; // The View should be deleted by RenderViewGone. |
| 640 } | 641 } |
| 641 | 642 |
| 642 BackingStoreManager::RemoveBackingStore(this); | 643 BackingStoreManager::RemoveBackingStore(this); |
| 643 } | 644 } |
| 644 | 645 |
| 645 void RenderWidgetHost::UpdateTextDirection(WebTextDirection direction) { | 646 void RenderWidgetHost::UpdateTextDirection(WebTextDirection direction) { |
| 646 text_direction_updated_ = true; | 647 text_direction_updated_ = true; |
| 647 text_direction_ = direction; | 648 text_direction_ = direction; |
| 648 } | 649 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 if (is_unresponsive_) { | 735 if (is_unresponsive_) { |
| 735 is_unresponsive_ = false; | 736 is_unresponsive_ = false; |
| 736 NotifyRendererResponsive(); | 737 NotifyRendererResponsive(); |
| 737 } | 738 } |
| 738 } | 739 } |
| 739 | 740 |
| 740 void RenderWidgetHost::OnMsgRenderViewReady() { | 741 void RenderWidgetHost::OnMsgRenderViewReady() { |
| 741 WasResized(); | 742 WasResized(); |
| 742 } | 743 } |
| 743 | 744 |
| 744 void RenderWidgetHost::OnMsgRenderViewGone() { | 745 void RenderWidgetHost::OnMsgRenderViewGone(int status, int exit_code) { |
| 745 // TODO(evanm): This synchronously ends up calling "delete this". | 746 // TODO(evanm): This synchronously ends up calling "delete this". |
| 746 // Is that really what we want in response to this message? I'm matching | 747 // Is that really what we want in response to this message? I'm matching |
| 747 // previous behavior of the code here. | 748 // previous behavior of the code here. |
| 748 Destroy(); | 749 Destroy(); |
| 749 } | 750 } |
| 750 | 751 |
| 751 void RenderWidgetHost::OnMsgClose() { | 752 void RenderWidgetHost::OnMsgClose() { |
| 752 Shutdown(); | 753 Shutdown(); |
| 753 } | 754 } |
| 754 | 755 |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 // of this key event. | 1170 // of this key event. |
| 1170 if (!processed && !is_hidden_ && !front_item.skip_in_browser) { | 1171 if (!processed && !is_hidden_ && !front_item.skip_in_browser) { |
| 1171 UnhandledKeyboardEvent(front_item); | 1172 UnhandledKeyboardEvent(front_item); |
| 1172 | 1173 |
| 1173 // WARNING: This RenderWidgetHost can be deallocated at this point | 1174 // WARNING: This RenderWidgetHost can be deallocated at this point |
| 1174 // (i.e. in the case of Ctrl+W, where the call to | 1175 // (i.e. in the case of Ctrl+W, where the call to |
| 1175 // UnhandledKeyboardEvent destroys this RenderWidgetHost). | 1176 // UnhandledKeyboardEvent destroys this RenderWidgetHost). |
| 1176 } | 1177 } |
| 1177 } | 1178 } |
| 1178 } | 1179 } |
| OLD | NEW |