OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/tab_contents/tab_contents_view_win.h" | 5 #include "chrome/browser/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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 break; | 395 break; |
395 } | 396 } |
396 | 397 |
397 return 0; | 398 return 0; |
398 } | 399 } |
399 | 400 |
400 void TabContentsViewWin::OnPaint(HDC junk_dc) { | 401 void TabContentsViewWin::OnPaint(HDC junk_dc) { |
401 if (tab_contents()->render_view_host() && | 402 if (tab_contents()->render_view_host() && |
402 !tab_contents()->render_view_host()->IsRenderViewLive()) { | 403 !tab_contents()->render_view_host()->IsRenderViewLive()) { |
403 if (sad_tab_ == NULL) { | 404 if (sad_tab_ == NULL) { |
404 sad_tab_ = new SadTabView(tab_contents()); | 405 base::TerminationStatus status = |
| 406 tab_contents()->render_view_host()->render_view_termination_status(); |
| 407 SadTabView::Kind kind = |
| 408 status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ? |
| 409 SadTabView::KILLED : SadTabView::CRASHED; |
| 410 sad_tab_ = new SadTabView(tab_contents(), kind); |
405 SetContentsView(sad_tab_); | 411 SetContentsView(sad_tab_); |
406 } | 412 } |
407 CRect cr; | 413 CRect cr; |
408 GetClientRect(&cr); | 414 GetClientRect(&cr); |
409 sad_tab_->SetBounds(gfx::Rect(cr)); | 415 sad_tab_->SetBounds(gfx::Rect(cr)); |
410 gfx::CanvasSkiaPaint canvas(GetNativeView(), true); | 416 gfx::CanvasSkiaPaint canvas(GetNativeView(), true); |
411 sad_tab_->ProcessPaint(&canvas); | 417 sad_tab_->ProcessPaint(&canvas); |
412 return; | 418 return; |
413 } | 419 } |
414 | 420 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 } | 573 } |
568 return false; | 574 return false; |
569 } | 575 } |
570 | 576 |
571 void TabContentsViewWin::WheelZoom(int distance) { | 577 void TabContentsViewWin::WheelZoom(int distance) { |
572 if (tab_contents()->delegate()) { | 578 if (tab_contents()->delegate()) { |
573 bool zoom_in = distance > 0; | 579 bool zoom_in = distance > 0; |
574 tab_contents()->delegate()->ContentsZoomChange(zoom_in); | 580 tab_contents()->delegate()->ContentsZoomChange(zoom_in); |
575 } | 581 } |
576 } | 582 } |
OLD | NEW |