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 "views/widget/widget_win.h" | 5 #include "views/widget/widget_win.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 | 8 |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 | 557 |
558 // We need to add ourselves as a message loop observer so that we can repaint | 558 // We need to add ourselves as a message loop observer so that we can repaint |
559 // aggressively if the contents of our window become invalid. Unfortunately | 559 // aggressively if the contents of our window become invalid. Unfortunately |
560 // WM_PAINT messages are starved and we get flickery redrawing when resizing | 560 // WM_PAINT messages are starved and we get flickery redrawing when resizing |
561 // if we do not do this. | 561 // if we do not do this. |
562 MessageLoopForUI::current()->AddObserver(this); | 562 MessageLoopForUI::current()->AddObserver(this); |
563 | 563 |
564 // Windows special DWM window frame requires a special tooltip manager so | 564 // Windows special DWM window frame requires a special tooltip manager so |
565 // that window controls in Chrome windows don't flicker when you move your | 565 // that window controls in Chrome windows don't flicker when you move your |
566 // mouse over them. See comment in aero_tooltip_manager.h. | 566 // mouse over them. See comment in aero_tooltip_manager.h. |
567 if (GetWidget()->GetThemeProvider()->ShouldUseNativeFrame()) { | 567 Window* window = GetWidget()->GetContainingWindow(); |
| 568 if (window && window->ShouldUseNativeFrame()) { |
568 tooltip_manager_.reset(new AeroTooltipManager(GetWidget())); | 569 tooltip_manager_.reset(new AeroTooltipManager(GetWidget())); |
569 } else { | 570 } else { |
570 tooltip_manager_.reset(new TooltipManagerWin(GetWidget())); | 571 tooltip_manager_.reset(new TooltipManagerWin(GetWidget())); |
571 } | 572 } |
572 | 573 |
573 // This message initializes the window so that focus border are shown for | 574 // This message initializes the window so that focus border are shown for |
574 // windows. | 575 // windows. |
575 SendMessage( | 576 SendMessage( |
576 hwnd(), WM_CHANGEUISTATE, MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0); | 577 hwnd(), WM_CHANGEUISTATE, MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0); |
577 | 578 |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 POINT zero = {0, 0}; | 1100 POINT zero = {0, 0}; |
1100 BLENDFUNCTION blend = {AC_SRC_OVER, 0, layered_alpha_, AC_SRC_ALPHA}; | 1101 BLENDFUNCTION blend = {AC_SRC_OVER, 0, layered_alpha_, AC_SRC_ALPHA}; |
1101 UpdateLayeredWindow(hwnd(), NULL, &position, &size, dib_dc, &zero, | 1102 UpdateLayeredWindow(hwnd(), NULL, &position, &size, dib_dc, &zero, |
1102 RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA); | 1103 RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA); |
1103 layered_window_invalid_rect_.SetRect(0, 0, 0, 0); | 1104 layered_window_invalid_rect_.SetRect(0, 0, 0, 0); |
1104 layered_window_contents_->endPlatformPaint(); | 1105 layered_window_contents_->endPlatformPaint(); |
1105 } | 1106 } |
1106 | 1107 |
1107 void WidgetWin::ClientAreaSizeChanged() { | 1108 void WidgetWin::ClientAreaSizeChanged() { |
1108 RECT r; | 1109 RECT r; |
1109 if (GetWidget()->GetThemeProvider()->ShouldUseNativeFrame() || IsZoomed()) | 1110 Window* window = GetWidget()->GetContainingWindow(); |
| 1111 if (IsZoomed() || (window && window->ShouldUseNativeFrame())) |
1110 GetClientRect(&r); | 1112 GetClientRect(&r); |
1111 else | 1113 else |
1112 GetWindowRect(&r); | 1114 GetWindowRect(&r); |
1113 gfx::Size s(std::max(0, static_cast<int>(r.right - r.left)), | 1115 gfx::Size s(std::max(0, static_cast<int>(r.right - r.left)), |
1114 std::max(0, static_cast<int>(r.bottom - r.top))); | 1116 std::max(0, static_cast<int>(r.bottom - r.top))); |
1115 delegate_->OnSizeChanged(s); | 1117 delegate_->OnSizeChanged(s); |
1116 if (use_layered_buffer_) { | 1118 if (use_layered_buffer_) { |
1117 layered_window_contents_.reset( | 1119 layered_window_contents_.reset( |
1118 new gfx::CanvasSkia(s.width(), s.height(), false)); | 1120 new gfx::CanvasSkia(s.width(), s.height(), false)); |
1119 } | 1121 } |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 | 1269 |
1268 // And now, notify them that they have a brand new parent. | 1270 // And now, notify them that they have a brand new parent. |
1269 for (NativeWidgets::iterator it = widgets.begin(); | 1271 for (NativeWidgets::iterator it = widgets.begin(); |
1270 it != widgets.end(); ++it) { | 1272 it != widgets.end(); ++it) { |
1271 (*it)->GetWidget()->NotifyNativeViewHierarchyChanged(true, | 1273 (*it)->GetWidget()->NotifyNativeViewHierarchyChanged(true, |
1272 new_parent); | 1274 new_parent); |
1273 } | 1275 } |
1274 } | 1276 } |
1275 | 1277 |
1276 } // namespace views | 1278 } // namespace views |
OLD | NEW |