Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: views/widget/widget_win.cc

Issue 6975037: Revert 85666 - Consolidate ShouldUseNativeFrame/AlwaysUseNativeFrame/UseNativeFrame spaghetti. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | views/window/native_window_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 Window* window = GetWidget()->GetContainingWindow(); 567 if (GetWidget()->GetThemeProvider()->ShouldUseNativeFrame()) {
568 if (window && window->ShouldUseNativeFrame()) {
569 tooltip_manager_.reset(new AeroTooltipManager(GetWidget())); 568 tooltip_manager_.reset(new AeroTooltipManager(GetWidget()));
570 } else { 569 } else {
571 tooltip_manager_.reset(new TooltipManagerWin(GetWidget())); 570 tooltip_manager_.reset(new TooltipManagerWin(GetWidget()));
572 } 571 }
573 572
574 // This message initializes the window so that focus border are shown for 573 // This message initializes the window so that focus border are shown for
575 // windows. 574 // windows.
576 SendMessage( 575 SendMessage(
577 hwnd(), WM_CHANGEUISTATE, MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0); 576 hwnd(), WM_CHANGEUISTATE, MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0);
578 577
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 POINT zero = {0, 0}; 1099 POINT zero = {0, 0};
1101 BLENDFUNCTION blend = {AC_SRC_OVER, 0, layered_alpha_, AC_SRC_ALPHA}; 1100 BLENDFUNCTION blend = {AC_SRC_OVER, 0, layered_alpha_, AC_SRC_ALPHA};
1102 UpdateLayeredWindow(hwnd(), NULL, &position, &size, dib_dc, &zero, 1101 UpdateLayeredWindow(hwnd(), NULL, &position, &size, dib_dc, &zero,
1103 RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA); 1102 RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA);
1104 layered_window_invalid_rect_.SetRect(0, 0, 0, 0); 1103 layered_window_invalid_rect_.SetRect(0, 0, 0, 0);
1105 layered_window_contents_->endPlatformPaint(); 1104 layered_window_contents_->endPlatformPaint();
1106 } 1105 }
1107 1106
1108 void WidgetWin::ClientAreaSizeChanged() { 1107 void WidgetWin::ClientAreaSizeChanged() {
1109 RECT r; 1108 RECT r;
1110 Window* window = GetWidget()->GetContainingWindow(); 1109 if (GetWidget()->GetThemeProvider()->ShouldUseNativeFrame() || IsZoomed())
1111 if (IsZoomed() || (window && window->ShouldUseNativeFrame()))
1112 GetClientRect(&r); 1110 GetClientRect(&r);
1113 else 1111 else
1114 GetWindowRect(&r); 1112 GetWindowRect(&r);
1115 gfx::Size s(std::max(0, static_cast<int>(r.right - r.left)), 1113 gfx::Size s(std::max(0, static_cast<int>(r.right - r.left)),
1116 std::max(0, static_cast<int>(r.bottom - r.top))); 1114 std::max(0, static_cast<int>(r.bottom - r.top)));
1117 delegate_->OnSizeChanged(s); 1115 delegate_->OnSizeChanged(s);
1118 if (use_layered_buffer_) { 1116 if (use_layered_buffer_) {
1119 layered_window_contents_.reset( 1117 layered_window_contents_.reset(
1120 new gfx::CanvasSkia(s.width(), s.height(), false)); 1118 new gfx::CanvasSkia(s.width(), s.height(), false));
1121 } 1119 }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 1267
1270 // And now, notify them that they have a brand new parent. 1268 // And now, notify them that they have a brand new parent.
1271 for (NativeWidgets::iterator it = widgets.begin(); 1269 for (NativeWidgets::iterator it = widgets.begin();
1272 it != widgets.end(); ++it) { 1270 it != widgets.end(); ++it) {
1273 (*it)->GetWidget()->NotifyNativeViewHierarchyChanged(true, 1271 (*it)->GetWidget()->NotifyNativeViewHierarchyChanged(true,
1274 new_parent); 1272 new_parent);
1275 } 1273 }
1276 } 1274 }
1277 1275
1278 } // namespace views 1276 } // namespace views
OLDNEW
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | views/window/native_window_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698