| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/renderer_host/render_widget_host_view_win.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" |
| 6 | 6 |
| 7 #include "app/gfx/chrome_canvas.h" | 7 #include "app/gfx/canvas.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "app/l10n_util_win.h" | 9 #include "app/l10n_util_win.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/gfx/gdi_util.h" | 12 #include "base/gfx/gdi_util.h" |
| 13 #include "base/gfx/rect.h" | 13 #include "base/gfx/rect.h" |
| 14 #include "base/histogram.h" | 14 #include "base/histogram.h" |
| 15 #include "base/win_util.h" | 15 #include "base/win_util.h" |
| 16 #include "chrome/browser/browser_accessibility.h" | 16 #include "chrome/browser/browser_accessibility.h" |
| 17 #include "chrome/browser/browser_accessibility_manager.h" | 17 #include "chrome/browser/browser_accessibility_manager.h" |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 EnumChildWindows(m_hWnd, EnumChildProc, lparam); | 542 EnumChildWindows(m_hWnd, EnumChildProc, lparam); |
| 543 } | 543 } |
| 544 | 544 |
| 545 void RenderWidgetHostViewWin::DrawResizeCorner(const gfx::Rect& paint_rect, | 545 void RenderWidgetHostViewWin::DrawResizeCorner(const gfx::Rect& paint_rect, |
| 546 HDC dc) { | 546 HDC dc) { |
| 547 gfx::Rect resize_corner_rect = | 547 gfx::Rect resize_corner_rect = |
| 548 render_widget_host_->GetRootWindowResizerRect(); | 548 render_widget_host_->GetRootWindowResizerRect(); |
| 549 if (!paint_rect.Intersect(resize_corner_rect).IsEmpty()) { | 549 if (!paint_rect.Intersect(resize_corner_rect).IsEmpty()) { |
| 550 SkBitmap* bitmap = ResourceBundle::GetSharedInstance(). | 550 SkBitmap* bitmap = ResourceBundle::GetSharedInstance(). |
| 551 GetBitmapNamed(IDR_TEXTAREA_RESIZER); | 551 GetBitmapNamed(IDR_TEXTAREA_RESIZER); |
| 552 ChromeCanvas canvas(bitmap->width(), bitmap->height(), false); | 552 gfx::Canvas canvas(bitmap->width(), bitmap->height(), false); |
| 553 // TODO(jcampan): This const_cast should not be necessary once the | 553 // TODO(jcampan): This const_cast should not be necessary once the |
| 554 // SKIA API has been changed to return a non-const bitmap. | 554 // SKIA API has been changed to return a non-const bitmap. |
| 555 const_cast<SkBitmap&>(canvas.getDevice()->accessBitmap(true)). | 555 const_cast<SkBitmap&>(canvas.getDevice()->accessBitmap(true)). |
| 556 eraseARGB(0, 0, 0, 0); | 556 eraseARGB(0, 0, 0, 0); |
| 557 int x = resize_corner_rect.x() + resize_corner_rect.width() - | 557 int x = resize_corner_rect.x() + resize_corner_rect.width() - |
| 558 bitmap->width(); | 558 bitmap->width(); |
| 559 bool rtl_dir = (l10n_util::GetTextDirection() == | 559 bool rtl_dir = (l10n_util::GetTextDirection() == |
| 560 l10n_util::RIGHT_TO_LEFT); | 560 l10n_util::RIGHT_TO_LEFT); |
| 561 if (rtl_dir) { | 561 if (rtl_dir) { |
| 562 canvas.TranslateInt(bitmap->width(), 0); | 562 canvas.TranslateInt(bitmap->width(), 0); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 } else { | 750 } else { |
| 751 DrawBackground(paint_dc.m_ps.rcPaint, &paint_dc); | 751 DrawBackground(paint_dc.m_ps.rcPaint, &paint_dc); |
| 752 if (whiteout_start_time_.is_null()) | 752 if (whiteout_start_time_.is_null()) |
| 753 whiteout_start_time_ = TimeTicks::Now(); | 753 whiteout_start_time_ = TimeTicks::Now(); |
| 754 } | 754 } |
| 755 } | 755 } |
| 756 | 756 |
| 757 void RenderWidgetHostViewWin::DrawBackground(const RECT& dirty_rect, | 757 void RenderWidgetHostViewWin::DrawBackground(const RECT& dirty_rect, |
| 758 CPaintDC* dc) { | 758 CPaintDC* dc) { |
| 759 if (!background_.empty()) { | 759 if (!background_.empty()) { |
| 760 ChromeCanvas canvas(dirty_rect.right - dirty_rect.left, | 760 gfx::Canvas canvas(dirty_rect.right - dirty_rect.left, |
| 761 dirty_rect.bottom - dirty_rect.top, | 761 dirty_rect.bottom - dirty_rect.top, |
| 762 true); // opaque | 762 true); // opaque |
| 763 canvas.TranslateInt(-dirty_rect.left, -dirty_rect.top); | 763 canvas.TranslateInt(-dirty_rect.left, -dirty_rect.top); |
| 764 | 764 |
| 765 const RECT& dc_rect = dc->m_ps.rcPaint; | 765 const RECT& dc_rect = dc->m_ps.rcPaint; |
| 766 canvas.TileImageInt(background_, 0, 0, | 766 canvas.TileImageInt(background_, 0, 0, |
| 767 dc_rect.right - dc_rect.left, | 767 dc_rect.right - dc_rect.left, |
| 768 dc_rect.bottom - dc_rect.top); | 768 dc_rect.bottom - dc_rect.top); |
| 769 | 769 |
| 770 canvas.getTopPlatformDevice().drawToHDC(*dc, dirty_rect.left, | 770 canvas.getTopPlatformDevice().drawToHDC(*dc, dirty_rect.left, |
| 771 dirty_rect.top, NULL); | 771 dirty_rect.top, NULL); |
| 772 } else { | 772 } else { |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 // WM_LBUTTONDOWN. | 1319 // WM_LBUTTONDOWN. |
| 1320 SetFocus(); | 1320 SetFocus(); |
| 1321 } | 1321 } |
| 1322 } | 1322 } |
| 1323 | 1323 |
| 1324 void RenderWidgetHostViewWin::ShutdownHost() { | 1324 void RenderWidgetHostViewWin::ShutdownHost() { |
| 1325 shutdown_factory_.RevokeAll(); | 1325 shutdown_factory_.RevokeAll(); |
| 1326 render_widget_host_->Shutdown(); | 1326 render_widget_host_->Shutdown(); |
| 1327 // Do not touch any members at this point, |this| has been deleted. | 1327 // Do not touch any members at this point, |this| has been deleted. |
| 1328 } | 1328 } |
| OLD | NEW |