| 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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 // only handled by RenderView. | 627 // only handled by RenderView. |
| 628 } | 628 } |
| 629 | 629 |
| 630 #if defined(TOUCH_UI) | 630 #if defined(TOUCH_UI) |
| 631 void RenderWidgetHost::ForwardTouchEvent( | 631 void RenderWidgetHost::ForwardTouchEvent( |
| 632 const WebKit::WebTouchEvent& touch_event) { | 632 const WebKit::WebTouchEvent& touch_event) { |
| 633 ForwardInputEvent(touch_event, sizeof(WebKit::WebTouchEvent), false); | 633 ForwardInputEvent(touch_event, sizeof(WebKit::WebTouchEvent), false); |
| 634 } | 634 } |
| 635 #endif | 635 #endif |
| 636 | 636 |
| 637 void RenderWidgetHost::RendererExited() { | 637 void RenderWidgetHost::RendererExited(base::TerminationStatus status, |
| 638 int exit_code) { |
| 638 // Clearing this flag causes us to re-create the renderer when recovering | 639 // Clearing this flag causes us to re-create the renderer when recovering |
| 639 // from a crashed renderer. | 640 // from a crashed renderer. |
| 640 renderer_initialized_ = false; | 641 renderer_initialized_ = false; |
| 641 | 642 |
| 642 // Must reset these to ensure that mouse move/wheel events work with a new | 643 // Must reset these to ensure that mouse move/wheel events work with a new |
| 643 // renderer. | 644 // renderer. |
| 644 mouse_move_pending_ = false; | 645 mouse_move_pending_ = false; |
| 645 next_mouse_move_.reset(); | 646 next_mouse_move_.reset(); |
| 646 mouse_wheel_pending_ = false; | 647 mouse_wheel_pending_ = false; |
| 647 coalesced_mouse_wheel_events_.clear(); | 648 coalesced_mouse_wheel_events_.clear(); |
| 648 | 649 |
| 649 // Must reset these to ensure that keyboard events work with a new renderer. | 650 // Must reset these to ensure that keyboard events work with a new renderer. |
| 650 key_queue_.clear(); | 651 key_queue_.clear(); |
| 651 suppress_next_char_events_ = false; | 652 suppress_next_char_events_ = false; |
| 652 | 653 |
| 653 // Reset some fields in preparation for recovering from a crash. | 654 // Reset some fields in preparation for recovering from a crash. |
| 654 resize_ack_pending_ = false; | 655 resize_ack_pending_ = false; |
| 655 repaint_ack_pending_ = false; | 656 repaint_ack_pending_ = false; |
| 656 | 657 |
| 657 in_flight_size_.SetSize(0, 0); | 658 in_flight_size_.SetSize(0, 0); |
| 658 in_flight_reserved_rect_.SetRect(0, 0, 0, 0); | 659 in_flight_reserved_rect_.SetRect(0, 0, 0, 0); |
| 659 current_size_.SetSize(0, 0); | 660 current_size_.SetSize(0, 0); |
| 660 current_reserved_rect_.SetRect(0, 0, 0, 0); | 661 current_reserved_rect_.SetRect(0, 0, 0, 0); |
| 661 is_hidden_ = false; | 662 is_hidden_ = false; |
| 662 is_accelerated_compositing_active_ = false; | 663 is_accelerated_compositing_active_ = false; |
| 663 | 664 |
| 664 if (view_) { | 665 if (view_) { |
| 665 view_->RenderViewGone(); | 666 view_->RenderViewGone(status, exit_code); |
| 666 view_ = NULL; // The View should be deleted by RenderViewGone. | 667 view_ = NULL; // The View should be deleted by RenderViewGone. |
| 667 } | 668 } |
| 668 | 669 |
| 669 BackingStoreManager::RemoveBackingStore(this); | 670 BackingStoreManager::RemoveBackingStore(this); |
| 670 } | 671 } |
| 671 | 672 |
| 672 void RenderWidgetHost::UpdateTextDirection(WebTextDirection direction) { | 673 void RenderWidgetHost::UpdateTextDirection(WebTextDirection direction) { |
| 673 text_direction_updated_ = true; | 674 text_direction_updated_ = true; |
| 674 text_direction_ = direction; | 675 text_direction_ = direction; |
| 675 } | 676 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 if (is_unresponsive_) { | 762 if (is_unresponsive_) { |
| 762 is_unresponsive_ = false; | 763 is_unresponsive_ = false; |
| 763 NotifyRendererResponsive(); | 764 NotifyRendererResponsive(); |
| 764 } | 765 } |
| 765 } | 766 } |
| 766 | 767 |
| 767 void RenderWidgetHost::OnMsgRenderViewReady() { | 768 void RenderWidgetHost::OnMsgRenderViewReady() { |
| 768 WasResized(); | 769 WasResized(); |
| 769 } | 770 } |
| 770 | 771 |
| 771 void RenderWidgetHost::OnMsgRenderViewGone() { | 772 void RenderWidgetHost::OnMsgRenderViewGone(int status, int exit_code) { |
| 772 // TODO(evanm): This synchronously ends up calling "delete this". | 773 // TODO(evanm): This synchronously ends up calling "delete this". |
| 773 // Is that really what we want in response to this message? I'm matching | 774 // Is that really what we want in response to this message? I'm matching |
| 774 // previous behavior of the code here. | 775 // previous behavior of the code here. |
| 775 Destroy(); | 776 Destroy(); |
| 776 } | 777 } |
| 777 | 778 |
| 778 void RenderWidgetHost::OnMsgClose() { | 779 void RenderWidgetHost::OnMsgClose() { |
| 779 Shutdown(); | 780 Shutdown(); |
| 780 } | 781 } |
| 781 | 782 |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 // of this key event. | 1212 // of this key event. |
| 1212 if (!processed && !is_hidden_ && !front_item.skip_in_browser) { | 1213 if (!processed && !is_hidden_ && !front_item.skip_in_browser) { |
| 1213 UnhandledKeyboardEvent(front_item); | 1214 UnhandledKeyboardEvent(front_item); |
| 1214 | 1215 |
| 1215 // WARNING: This RenderWidgetHost can be deallocated at this point | 1216 // WARNING: This RenderWidgetHost can be deallocated at this point |
| 1216 // (i.e. in the case of Ctrl+W, where the call to | 1217 // (i.e. in the case of Ctrl+W, where the call to |
| 1217 // UnhandledKeyboardEvent destroys this RenderWidgetHost). | 1218 // UnhandledKeyboardEvent destroys this RenderWidgetHost). |
| 1218 } | 1219 } |
| 1219 } | 1220 } |
| 1220 } | 1221 } |
| OLD | NEW |