OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/views/frame/browser_desktop_window_tree_host_win.h" | 5 #include "chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 LPARAM l_param) { | 153 LPARAM l_param) { |
154 HWND hwnd = GetHWND(); | 154 HWND hwnd = GetHWND(); |
155 switch (message) { | 155 switch (message) { |
156 case WM_CREATE: | 156 case WM_CREATE: |
157 minimize_button_metrics_.Init(hwnd); | 157 minimize_button_metrics_.Init(hwnd); |
158 break; | 158 break; |
159 case WM_WINDOWPOSCHANGED: { | 159 case WM_WINDOWPOSCHANGED: { |
160 UpdateDWMFrame(); | 160 UpdateDWMFrame(); |
161 | 161 |
162 // Windows lies to us about the position of the minimize button before a | 162 // Windows lies to us about the position of the minimize button before a |
163 // window is visible. We use this position to place the OTR avatar in RTL | 163 // window is visible. We use this position to place the incognito avatar |
164 // mode, so when the window is shown, we need to re-layout and schedule a | 164 // in RTL mode, so when the window is shown, we need to re-layout and |
165 // paint for the non-client frame view so that the icon top has the | 165 // schedule a paint for the non-client frame view so that the icon top has |
166 // correct | 166 // the correct position when the window becomes visible. This fixes bugs |
167 // position when the window becomes visible. This fixes bugs where the | 167 // where the icon appears to overlay the minimize button. Note that we |
168 // icon | 168 // will call Layout every time SetWindowPos is called with SWP_SHOWWINDOW, |
169 // appears to overlay the minimize button. | 169 // however callers typically are careful about not specifying this flag |
170 // Note that we will call Layout every time SetWindowPos is called with | 170 // unless necessary to avoid flicker. This may be invoked during creation |
171 // SWP_SHOWWINDOW, however callers typically are careful about not | 171 // on XP and before the non_client_view has been created. |
172 // specifying this flag unless necessary to avoid flicker. | |
173 // This may be invoked during creation on XP and before the | |
174 // non_client_view | |
175 // has been created. | |
176 WINDOWPOS* window_pos = reinterpret_cast<WINDOWPOS*>(l_param); | 172 WINDOWPOS* window_pos = reinterpret_cast<WINDOWPOS*>(l_param); |
177 if (window_pos->flags & SWP_SHOWWINDOW && | 173 if (window_pos->flags & SWP_SHOWWINDOW && |
178 GetWidget()->non_client_view()) { | 174 GetWidget()->non_client_view()) { |
179 GetWidget()->non_client_view()->Layout(); | 175 GetWidget()->non_client_view()->Layout(); |
180 GetWidget()->non_client_view()->SchedulePaint(); | 176 GetWidget()->non_client_view()->SchedulePaint(); |
181 } | 177 } |
182 break; | 178 break; |
183 } | 179 } |
184 case WM_ERASEBKGND: { | 180 case WM_ERASEBKGND: { |
185 gfx::Insets insets; | 181 gfx::Insets insets; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 BrowserDesktopWindowTreeHost::CreateBrowserDesktopWindowTreeHost( | 316 BrowserDesktopWindowTreeHost::CreateBrowserDesktopWindowTreeHost( |
321 views::internal::NativeWidgetDelegate* native_widget_delegate, | 317 views::internal::NativeWidgetDelegate* native_widget_delegate, |
322 views::DesktopNativeWidgetAura* desktop_native_widget_aura, | 318 views::DesktopNativeWidgetAura* desktop_native_widget_aura, |
323 BrowserView* browser_view, | 319 BrowserView* browser_view, |
324 BrowserFrame* browser_frame) { | 320 BrowserFrame* browser_frame) { |
325 return new BrowserDesktopWindowTreeHostWin(native_widget_delegate, | 321 return new BrowserDesktopWindowTreeHostWin(native_widget_delegate, |
326 desktop_native_widget_aura, | 322 desktop_native_widget_aura, |
327 browser_view, | 323 browser_view, |
328 browser_frame); | 324 browser_frame); |
329 } | 325 } |
OLD | NEW |