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_root_window_host_win.h" | 5 #include "chrome/browser/ui/views/frame/browser_desktop_root_window_host_win.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 | 8 |
9 #include "chrome/browser/themes/theme_service.h" | 9 #include "chrome/browser/themes/theme_service.h" |
10 #include "chrome/browser/themes/theme_service_factory.h" | 10 #include "chrome/browser/themes/theme_service_factory.h" |
11 #include "chrome/browser/ui/views/frame/browser_frame.h" | 11 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| 12 #include "chrome/browser/ui/views/frame/browser_frame_common_win.h" |
12 #include "chrome/browser/ui/views/frame/browser_view.h" | 13 #include "chrome/browser/ui/views/frame/browser_view.h" |
13 #include "chrome/browser/ui/views/frame/system_menu_insertion_delegate_win.h" | 14 #include "chrome/browser/ui/views/frame/system_menu_insertion_delegate_win.h" |
14 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 15 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
15 #include "chrome/browser/ui/views/theme_image_mapper.h" | 16 #include "chrome/browser/ui/views/theme_image_mapper.h" |
16 #include "grit/theme_resources.h" | 17 #include "grit/theme_resources.h" |
17 #include "ui/base/theme_provider.h" | 18 #include "ui/base/theme_provider.h" |
18 #include "ui/views/controls/menu/native_menu_win.h" | 19 #include "ui/views/controls/menu/native_menu_win.h" |
19 | 20 |
20 #pragma comment(lib, "dwmapi.lib") | 21 #pragma comment(lib, "dwmapi.lib") |
21 | 22 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 if (!browser_view_->IsBrowserTypeNormal() && | 217 if (!browser_view_->IsBrowserTypeNormal() && |
217 !DesktopRootWindowHostWin::IsUsingCustomFrame()) { | 218 !DesktopRootWindowHostWin::IsUsingCustomFrame()) { |
218 return false; | 219 return false; |
219 } | 220 } |
220 | 221 |
221 // Otherwise, we use the native frame when we're told we should by the theme | 222 // Otherwise, we use the native frame when we're told we should by the theme |
222 // provider (e.g. no custom theme is active). | 223 // provider (e.g. no custom theme is active). |
223 return !GetWidget()->GetThemeProvider()->ShouldUseNativeFrame(); | 224 return !GetWidget()->GetThemeProvider()->ShouldUseNativeFrame(); |
224 } | 225 } |
225 | 226 |
| 227 bool BrowserDesktopRootWindowHostWin::ShouldUseNativeFrame() { |
| 228 if (!views::DesktopRootWindowHostWin::ShouldUseNativeFrame()) |
| 229 return false; |
| 230 return chrome::ShouldUseNativeFrame(browser_view_, |
| 231 GetWidget()->GetThemeProvider()); |
| 232 } |
| 233 |
226 //////////////////////////////////////////////////////////////////////////////// | 234 //////////////////////////////////////////////////////////////////////////////// |
227 // BrowserDesktopRootWindowHostWin, private: | 235 // BrowserDesktopRootWindowHostWin, private: |
228 | 236 |
229 void BrowserDesktopRootWindowHostWin::UpdateDWMFrame() { | 237 void BrowserDesktopRootWindowHostWin::UpdateDWMFrame() { |
230 // For "normal" windows on Aero, we always need to reset the glass area | 238 // For "normal" windows on Aero, we always need to reset the glass area |
231 // correctly, even if we're not currently showing the native frame (e.g. | 239 // correctly, even if we're not currently showing the native frame (e.g. |
232 // because a theme is showing), so we explicitly check for that case rather | 240 // because a theme is showing), so we explicitly check for that case rather |
233 // than checking browser_frame_->ShouldUseNativeFrame() here. Using that here | 241 // than checking browser_frame_->ShouldUseNativeFrame() here. Using that here |
234 // would mean we wouldn't reset the glass area to zero when moving from the | 242 // would mean we wouldn't reset the glass area to zero when moving from the |
235 // native frame to an opaque frame, leading to graphical glitches behind the | 243 // native frame to an opaque frame, leading to graphical glitches behind the |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 views::DesktopNativeWidgetAura* desktop_native_widget_aura, | 283 views::DesktopNativeWidgetAura* desktop_native_widget_aura, |
276 const gfx::Rect& initial_bounds, | 284 const gfx::Rect& initial_bounds, |
277 BrowserView* browser_view, | 285 BrowserView* browser_view, |
278 BrowserFrame* browser_frame) { | 286 BrowserFrame* browser_frame) { |
279 return new BrowserDesktopRootWindowHostWin(native_widget_delegate, | 287 return new BrowserDesktopRootWindowHostWin(native_widget_delegate, |
280 desktop_native_widget_aura, | 288 desktop_native_widget_aura, |
281 initial_bounds, | 289 initial_bounds, |
282 browser_view, | 290 browser_view, |
283 browser_frame); | 291 browser_frame); |
284 } | 292 } |
OLD | NEW |