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_win.h" | 5 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 default: | 396 default: |
397 break; | 397 break; |
398 } | 398 } |
399 | 399 |
400 return 0; | 400 return 0; |
401 } | 401 } |
402 | 402 |
403 void TabContentsViewWin::OnPaint(HDC junk_dc) { | 403 void TabContentsViewWin::OnPaint(HDC junk_dc) { |
404 if (tab_contents()->render_view_host() && | 404 if (tab_contents()->render_view_host() && |
405 !tab_contents()->render_view_host()->IsRenderViewLive()) { | 405 !tab_contents()->render_view_host()->IsRenderViewLive()) { |
406 if (sad_tab_ == NULL) { | 406 base::TerminationStatus status = |
407 base::TerminationStatus status = | 407 tab_contents()->render_view_host()->render_view_termination_status(); |
408 tab_contents()->render_view_host()->render_view_termination_status(); | 408 SadTabView::Kind kind = |
409 SadTabView::Kind kind = | 409 status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ? |
410 status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ? | 410 SadTabView::KILLED : SadTabView::CRASHED; |
411 SadTabView::KILLED : SadTabView::CRASHED; | 411 sad_tab_ = new SadTabView(tab_contents(), kind); |
412 sad_tab_ = new SadTabView(tab_contents(), kind); | 412 SetContentsView(sad_tab_); |
413 SetContentsView(sad_tab_); | |
414 } | |
415 CRect cr; | 413 CRect cr; |
416 GetClientRect(&cr); | 414 GetClientRect(&cr); |
417 sad_tab_->SetBounds(gfx::Rect(cr)); | 415 sad_tab_->SetBounds(gfx::Rect(cr)); |
418 gfx::CanvasSkiaPaint canvas(GetNativeView(), true); | 416 gfx::CanvasSkiaPaint canvas(GetNativeView(), true); |
419 sad_tab_->ProcessPaint(&canvas); | 417 sad_tab_->ProcessPaint(&canvas); |
420 return; | 418 return; |
421 } | 419 } |
422 | 420 |
423 // We need to do this to validate the dirty area so we don't end up in a | 421 // We need to do this to validate the dirty area so we don't end up in a |
424 // WM_PAINTstorm that causes other mysterious bugs (such as WM_TIMERs not | 422 // WM_PAINTstorm that causes other mysterious bugs (such as WM_TIMERs not |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 } | 573 } |
576 return false; | 574 return false; |
577 } | 575 } |
578 | 576 |
579 void TabContentsViewWin::WheelZoom(int distance) { | 577 void TabContentsViewWin::WheelZoom(int distance) { |
580 if (tab_contents()->delegate()) { | 578 if (tab_contents()->delegate()) { |
581 bool zoom_in = distance > 0; | 579 bool zoom_in = distance > 0; |
582 tab_contents()->delegate()->ContentsZoomChange(zoom_in); | 580 tab_contents()->delegate()->ContentsZoomChange(zoom_in); |
583 } | 581 } |
584 } | 582 } |
OLD | NEW |