| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/views/tab_contents/tab_contents_view_gtk.h" | 5 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 gfx::Size new_size(allocation->width, allocation->height); | 391 gfx::Size new_size(allocation->width, allocation->height); |
| 392 | 392 |
| 393 // Always call WasSized() to allow checking to make sure the | 393 // Always call WasSized() to allow checking to make sure the |
| 394 // RenderWidgetHostView is the right size. | 394 // RenderWidgetHostView is the right size. |
| 395 WasSized(new_size); | 395 WasSized(new_size); |
| 396 } | 396 } |
| 397 | 397 |
| 398 gboolean TabContentsViewGtk::OnPaint(GtkWidget* widget, GdkEventExpose* event) { | 398 gboolean TabContentsViewGtk::OnPaint(GtkWidget* widget, GdkEventExpose* event) { |
| 399 if (tab_contents()->render_view_host() && | 399 if (tab_contents()->render_view_host() && |
| 400 !tab_contents()->render_view_host()->IsRenderViewLive()) { | 400 !tab_contents()->render_view_host()->IsRenderViewLive()) { |
| 401 if (sad_tab_ == NULL) { | 401 base::TerminationStatus status = |
| 402 base::TerminationStatus status = | 402 tab_contents()->render_view_host()->render_view_termination_status(); |
| 403 tab_contents()->render_view_host()->render_view_termination_status(); | 403 SadTabView::Kind kind = |
| 404 SadTabView::Kind kind = | 404 status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ? |
| 405 status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ? | 405 SadTabView::KILLED : SadTabView::CRASHED; |
| 406 SadTabView::KILLED : SadTabView::CRASHED; | 406 sad_tab_ = new SadTabView(tab_contents(), kind); |
| 407 sad_tab_ = new SadTabView(tab_contents(), kind); | 407 SetContentsView(sad_tab_); |
| 408 SetContentsView(sad_tab_); | |
| 409 } | |
| 410 gfx::Rect bounds; | 408 gfx::Rect bounds; |
| 411 GetBounds(&bounds, true); | 409 GetBounds(&bounds, true); |
| 412 sad_tab_->SetBounds(gfx::Rect(0, 0, bounds.width(), bounds.height())); | 410 sad_tab_->SetBounds(gfx::Rect(0, 0, bounds.width(), bounds.height())); |
| 413 gfx::CanvasSkiaPaint canvas(event); | 411 gfx::CanvasSkiaPaint canvas(event); |
| 414 sad_tab_->ProcessPaint(&canvas); | 412 sad_tab_->ProcessPaint(&canvas); |
| 415 } | 413 } |
| 416 return false; // False indicates other widgets should get the event as well. | 414 return false; // False indicates other widgets should get the event as well. |
| 417 } | 415 } |
| 418 | 416 |
| 419 void TabContentsViewGtk::OnShow(GtkWidget* widget) { | 417 void TabContentsViewGtk::OnShow(GtkWidget* widget) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 // not NULL, else our delegate. | 472 // not NULL, else our delegate. |
| 475 gboolean TabContentsViewGtk::OnMouseMove(GtkWidget* widget, | 473 gboolean TabContentsViewGtk::OnMouseMove(GtkWidget* widget, |
| 476 GdkEventMotion* event) { | 474 GdkEventMotion* event) { |
| 477 if (sad_tab_ != NULL) | 475 if (sad_tab_ != NULL) |
| 478 WidgetGtk::OnMotionNotify(widget, event); | 476 WidgetGtk::OnMotionNotify(widget, event); |
| 479 else if (tab_contents()->delegate()) | 477 else if (tab_contents()->delegate()) |
| 480 tab_contents()->delegate()->ContentsMouseEvent( | 478 tab_contents()->delegate()->ContentsMouseEvent( |
| 481 tab_contents(), views::Screen::GetCursorScreenPoint(), true); | 479 tab_contents(), views::Screen::GetCursorScreenPoint(), true); |
| 482 return FALSE; | 480 return FALSE; |
| 483 } | 481 } |
| OLD | NEW |