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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 232 } |
233 | 233 |
234 void TabContentsViewGtk::SetPageTitle(const std::wstring& title) { | 234 void TabContentsViewGtk::SetPageTitle(const std::wstring& title) { |
235 // Set the window name to include the page title so it's easier to spot | 235 // Set the window name to include the page title so it's easier to spot |
236 // when debugging (e.g. via xwininfo -tree). | 236 // when debugging (e.g. via xwininfo -tree). |
237 gfx::NativeView content_view = GetContentNativeView(); | 237 gfx::NativeView content_view = GetContentNativeView(); |
238 if (content_view && content_view->window) | 238 if (content_view && content_view->window) |
239 gdk_window_set_title(content_view->window, WideToUTF8(title).c_str()); | 239 gdk_window_set_title(content_view->window, WideToUTF8(title).c_str()); |
240 } | 240 } |
241 | 241 |
242 void TabContentsViewGtk::OnTabCrashed() { | 242 void TabContentsViewGtk::OnTabCrashed(base::TerminationStatus /* status */, |
| 243 int /* error_code */) { |
243 } | 244 } |
244 | 245 |
245 void TabContentsViewGtk::SizeContents(const gfx::Size& size) { | 246 void TabContentsViewGtk::SizeContents(const gfx::Size& size) { |
246 // TODO(brettw) this is a hack and should be removed. See tab_contents_view.h. | 247 // TODO(brettw) this is a hack and should be removed. See tab_contents_view.h. |
247 | 248 |
248 // We're contained in a fixed. To have the fixed relay us out to |size|, set | 249 // We're contained in a fixed. To have the fixed relay us out to |size|, set |
249 // the size request, which triggers OnSizeAllocate. | 250 // the size request, which triggers OnSizeAllocate. |
250 gtk_widget_set_size_request(GetNativeView(), size.width(), size.height()); | 251 gtk_widget_set_size_request(GetNativeView(), size.width(), size.height()); |
251 | 252 |
252 // We need to send this immediately. | 253 // We need to send this immediately. |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 | 388 |
388 // Always call WasSized() to allow checking to make sure the | 389 // Always call WasSized() to allow checking to make sure the |
389 // RenderWidgetHostView is the right size. | 390 // RenderWidgetHostView is the right size. |
390 WasSized(new_size); | 391 WasSized(new_size); |
391 } | 392 } |
392 | 393 |
393 gboolean TabContentsViewGtk::OnPaint(GtkWidget* widget, GdkEventExpose* event) { | 394 gboolean TabContentsViewGtk::OnPaint(GtkWidget* widget, GdkEventExpose* event) { |
394 if (tab_contents()->render_view_host() && | 395 if (tab_contents()->render_view_host() && |
395 !tab_contents()->render_view_host()->IsRenderViewLive()) { | 396 !tab_contents()->render_view_host()->IsRenderViewLive()) { |
396 if (sad_tab_ == NULL) { | 397 if (sad_tab_ == NULL) { |
397 sad_tab_ = new SadTabView(tab_contents()); | 398 base::TerminationStatus status = |
| 399 tab_contents()->render_view_host()->render_view_termination_status(); |
| 400 SadTabView::Kind kind = |
| 401 status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ? |
| 402 SadTabView::KILLED : SadTabView::CRASHED; |
| 403 sad_tab_ = new SadTabView(tab_contents(), kind); |
398 SetContentsView(sad_tab_); | 404 SetContentsView(sad_tab_); |
399 } | 405 } |
400 gfx::Rect bounds; | 406 gfx::Rect bounds; |
401 GetBounds(&bounds, true); | 407 GetBounds(&bounds, true); |
402 sad_tab_->SetBounds(gfx::Rect(0, 0, bounds.width(), bounds.height())); | 408 sad_tab_->SetBounds(gfx::Rect(0, 0, bounds.width(), bounds.height())); |
403 gfx::CanvasSkiaPaint canvas(event); | 409 gfx::CanvasSkiaPaint canvas(event); |
404 sad_tab_->ProcessPaint(&canvas); | 410 sad_tab_->ProcessPaint(&canvas); |
405 } | 411 } |
406 return false; // False indicates other widgets should get the event as well. | 412 return false; // False indicates other widgets should get the event as well. |
407 } | 413 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 // not NULL, else our delegate. | 470 // not NULL, else our delegate. |
465 gboolean TabContentsViewGtk::OnMouseMove(GtkWidget* widget, | 471 gboolean TabContentsViewGtk::OnMouseMove(GtkWidget* widget, |
466 GdkEventMotion* event) { | 472 GdkEventMotion* event) { |
467 if (sad_tab_ != NULL) | 473 if (sad_tab_ != NULL) |
468 WidgetGtk::OnMotionNotify(widget, event); | 474 WidgetGtk::OnMotionNotify(widget, event); |
469 else if (tab_contents()->delegate()) | 475 else if (tab_contents()->delegate()) |
470 tab_contents()->delegate()->ContentsMouseEvent( | 476 tab_contents()->delegate()->ContentsMouseEvent( |
471 tab_contents(), views::Screen::GetCursorScreenPoint(), true); | 477 tab_contents(), views::Screen::GetCursorScreenPoint(), true); |
472 return FALSE; | 478 return FALSE; |
473 } | 479 } |
OLD | NEW |