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 "base/time.h" | 9 #include "base/time.h" |
10 #include "chrome/browser/download/download_request_limiter.h" | 10 #include "chrome/browser/download/download_request_limiter.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 WidgetWin::OnDestroy(); | 148 WidgetWin::OnDestroy(); |
149 } | 149 } |
150 | 150 |
151 void TabContentsViewWin::SetPageTitle(const std::wstring& title) { | 151 void TabContentsViewWin::SetPageTitle(const std::wstring& title) { |
152 if (GetNativeView()) { | 152 if (GetNativeView()) { |
153 // It's possible to get this after the hwnd has been destroyed. | 153 // It's possible to get this after the hwnd has been destroyed. |
154 ::SetWindowText(GetNativeView(), title.c_str()); | 154 ::SetWindowText(GetNativeView(), title.c_str()); |
155 } | 155 } |
156 } | 156 } |
157 | 157 |
158 void TabContentsViewWin::OnTabCrashed() { | 158 void TabContentsViewWin::OnTabCrashed(base::TerminationStatus /* status */, |
| 159 int /* error_code */) { |
159 // Force an invalidation to render sad tab. We will notice we crashed when we | 160 // Force an invalidation to render sad tab. We will notice we crashed when we |
160 // paint. | 161 // paint. |
161 // Note that it's possible to get this message after the window was destroyed. | 162 // Note that it's possible to get this message after the window was destroyed. |
162 if (::IsWindow(GetNativeView())) | 163 if (::IsWindow(GetNativeView())) |
163 InvalidateRect(GetNativeView(), NULL, FALSE); | 164 InvalidateRect(GetNativeView(), NULL, FALSE); |
164 } | 165 } |
165 | 166 |
166 void TabContentsViewWin::SizeContents(const gfx::Size& size) { | 167 void TabContentsViewWin::SizeContents(const gfx::Size& size) { |
167 // TODO(brettw) this is a hack and should be removed. See tab_contents_view.h. | 168 // TODO(brettw) this is a hack and should be removed. See tab_contents_view.h. |
168 | 169 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 break; | 392 break; |
392 } | 393 } |
393 | 394 |
394 return 0; | 395 return 0; |
395 } | 396 } |
396 | 397 |
397 void TabContentsViewWin::OnPaint(HDC junk_dc) { | 398 void TabContentsViewWin::OnPaint(HDC junk_dc) { |
398 if (tab_contents()->render_view_host() && | 399 if (tab_contents()->render_view_host() && |
399 !tab_contents()->render_view_host()->IsRenderViewLive()) { | 400 !tab_contents()->render_view_host()->IsRenderViewLive()) { |
400 if (sad_tab_ == NULL) { | 401 if (sad_tab_ == NULL) { |
401 sad_tab_ = new SadTabView(tab_contents()); | 402 base::TerminationStatus status = |
| 403 tab_contents()->render_view_host()->render_view_termination_status(); |
| 404 SadTabView::Kind kind = |
| 405 status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ? |
| 406 SadTabView::KILLED : SadTabView::CRASHED; |
| 407 sad_tab_ = new SadTabView(tab_contents(), kind); |
402 SetContentsView(sad_tab_); | 408 SetContentsView(sad_tab_); |
403 } | 409 } |
404 CRect cr; | 410 CRect cr; |
405 GetClientRect(&cr); | 411 GetClientRect(&cr); |
406 sad_tab_->SetBounds(gfx::Rect(cr)); | 412 sad_tab_->SetBounds(gfx::Rect(cr)); |
407 gfx::CanvasSkiaPaint canvas(GetNativeView(), true); | 413 gfx::CanvasSkiaPaint canvas(GetNativeView(), true); |
408 sad_tab_->ProcessPaint(&canvas); | 414 sad_tab_->ProcessPaint(&canvas); |
409 return; | 415 return; |
410 } | 416 } |
411 | 417 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 } | 570 } |
565 return false; | 571 return false; |
566 } | 572 } |
567 | 573 |
568 void TabContentsViewWin::WheelZoom(int distance) { | 574 void TabContentsViewWin::WheelZoom(int distance) { |
569 if (tab_contents()->delegate()) { | 575 if (tab_contents()->delegate()) { |
570 bool zoom_in = distance > 0; | 576 bool zoom_in = distance > 0; |
571 tab_contents()->delegate()->ContentsZoomChange(zoom_in); | 577 tab_contents()->delegate()->ContentsZoomChange(zoom_in); |
572 } | 578 } |
573 } | 579 } |
OLD | NEW |