OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_view_gtk.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" |
6 | 6 |
7 // If this gets included after the gtk headers, then a bunch of compiler | 7 // If this gets included after the gtk headers, then a bunch of compiler |
8 // errors happen because of a "#define Status int" in Xlib.h, which interacts | 8 // errors happen because of a "#define Status int" in Xlib.h, which interacts |
9 // badly with URLRequestStatus::Status. | 9 // badly with URLRequestStatus::Status. |
10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 } | 512 } |
513 | 513 |
514 // Remove |view_| from all containers now, so nothing else can hold a | 514 // Remove |view_| from all containers now, so nothing else can hold a |
515 // reference to |view_|'s widget except possibly a gtk signal handler if | 515 // reference to |view_|'s widget except possibly a gtk signal handler if |
516 // this code is currently executing within the context of a gtk signal | 516 // this code is currently executing within the context of a gtk signal |
517 // handler. Note that |view_| is still alive after this call. It will be | 517 // handler. Note that |view_| is still alive after this call. It will be |
518 // deallocated in the destructor. | 518 // deallocated in the destructor. |
519 // See http://www.crbug.com/11847 for details. | 519 // See http://www.crbug.com/11847 for details. |
520 gtk_widget_destroy(view_.get()); | 520 gtk_widget_destroy(view_.get()); |
521 | 521 |
| 522 // The RenderWidgetHost's destruction led here, so don't call it. |
| 523 host_ = NULL; |
| 524 |
522 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 525 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
523 } | 526 } |
524 | 527 |
525 void RenderWidgetHostViewGtk::SetTooltipText(const std::wstring& tooltip_text) { | 528 void RenderWidgetHostViewGtk::SetTooltipText(const std::wstring& tooltip_text) { |
526 if (tooltip_text.empty()) { | 529 if (tooltip_text.empty()) { |
527 gtk_widget_set_has_tooltip(view_.get(), FALSE); | 530 gtk_widget_set_has_tooltip(view_.get(), FALSE); |
528 } else { | 531 } else { |
529 gtk_widget_set_tooltip_text(view_.get(), WideToUTF8(tooltip_text).c_str()); | 532 gtk_widget_set_tooltip_text(view_.get(), WideToUTF8(tooltip_text).c_str()); |
530 } | 533 } |
531 } | 534 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 plugin_container_manager_.CreatePluginContainer(id); | 639 plugin_container_manager_.CreatePluginContainer(id); |
637 } | 640 } |
638 | 641 |
639 void RenderWidgetHostViewGtk::DestroyPluginContainer( | 642 void RenderWidgetHostViewGtk::DestroyPluginContainer( |
640 gfx::PluginWindowHandle id) { | 643 gfx::PluginWindowHandle id) { |
641 plugin_container_manager_.DestroyPluginContainer(id); | 644 plugin_container_manager_.DestroyPluginContainer(id); |
642 } | 645 } |
643 | 646 |
644 void RenderWidgetHostViewGtk::ForwardKeyboardEvent( | 647 void RenderWidgetHostViewGtk::ForwardKeyboardEvent( |
645 const NativeWebKeyboardEvent& event) { | 648 const NativeWebKeyboardEvent& event) { |
| 649 if (!host_) |
| 650 return; |
| 651 |
646 EditCommands edit_commands; | 652 EditCommands edit_commands; |
647 if (key_bindings_handler_->Match(event, &edit_commands)) { | 653 if (key_bindings_handler_->Match(event, &edit_commands)) { |
648 host_->ForwardEditCommandsForNextKeyEvent(edit_commands); | 654 host_->ForwardEditCommandsForNextKeyEvent(edit_commands); |
649 } | 655 } |
650 host_->ForwardKeyboardEvent(event); | 656 host_->ForwardKeyboardEvent(event); |
651 } | 657 } |
OLD | NEW |