| 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 "views/controls/hwnd_view.h" | 5 #include "views/controls/hwnd_view.h" |
| 6 | 6 |
| 7 #include "app/gfx/chrome_canvas.h" | 7 #include "app/gfx/canvas.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "views/focus/focus_manager.h" | 9 #include "views/focus/focus_manager.h" |
| 10 #include "views/widget/widget.h" | 10 #include "views/widget/widget.h" |
| 11 | 11 |
| 12 namespace views { | 12 namespace views { |
| 13 | 13 |
| 14 static const char kViewClassName[] = "views/HWNDView"; | 14 static const char kViewClassName[] = "views/HWNDView"; |
| 15 | 15 |
| 16 HWNDView::HWNDView() { | 16 HWNDView::HWNDView() { |
| 17 } | 17 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 39 hwnd, associated_focus_view() ? associated_focus_view() : this); | 39 hwnd, associated_focus_view() ? associated_focus_view() : this); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void HWNDView::Detach() { | 42 void HWNDView::Detach() { |
| 43 DCHECK(native_view()); | 43 DCHECK(native_view()); |
| 44 FocusManager::UninstallFocusSubclass(native_view()); | 44 FocusManager::UninstallFocusSubclass(native_view()); |
| 45 set_native_view(NULL); | 45 set_native_view(NULL); |
| 46 set_installed_clip(false); | 46 set_installed_clip(false); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void HWNDView::Paint(ChromeCanvas* canvas) { | 49 void HWNDView::Paint(gfx::Canvas* canvas) { |
| 50 // The area behind our window is black, so during a fast resize (where our | 50 // The area behind our window is black, so during a fast resize (where our |
| 51 // content doesn't draw over the full size of our HWND, and the HWND | 51 // content doesn't draw over the full size of our HWND, and the HWND |
| 52 // background color doesn't show up), we need to cover that blackness with | 52 // background color doesn't show up), we need to cover that blackness with |
| 53 // something so that fast resizes don't result in black flash. | 53 // something so that fast resizes don't result in black flash. |
| 54 // | 54 // |
| 55 // It would be nice if this used some approximation of the page's | 55 // It would be nice if this used some approximation of the page's |
| 56 // current background color. | 56 // current background color. |
| 57 if (installed_clip()) | 57 if (installed_clip()) |
| 58 canvas->FillRectInt(SkColorSetRGB(255, 255, 255), 0, 0, width(), height()); | 58 canvas->FillRectInt(SkColorSetRGB(255, 255, 255), 0, 0, width(), height()); |
| 59 } | 59 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 return; // Currently not visible, nothing to do. | 129 return; // Currently not visible, nothing to do. |
| 130 | 130 |
| 131 // The window is currently visible, but its clipped by another view. Hide | 131 // The window is currently visible, but its clipped by another view. Hide |
| 132 // it. | 132 // it. |
| 133 ::SetWindowPos(native_view(), 0, 0, 0, 0, 0, | 133 ::SetWindowPos(native_view(), 0, 0, 0, 0, 0, |
| 134 SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | | 134 SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | |
| 135 SWP_NOREDRAW | SWP_NOOWNERZORDER); | 135 SWP_NOREDRAW | SWP_NOOWNERZORDER); |
| 136 } | 136 } |
| 137 | 137 |
| 138 } // namespace views | 138 } // namespace views |
| OLD | NEW |