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