| 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_frame_common_win.h" |
| 13 #include "chrome/browser/ui/views/frame/browser_view.h" | 13 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 14 #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" |
| 15 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 15 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 16 #include "chrome/browser/ui/views/theme_image_mapper.h" | 16 #include "chrome/browser/ui/views/theme_image_mapper.h" |
| 17 #include "grit/theme_resources.h" | 17 #include "grit/theme_resources.h" |
| 18 #include "ui/base/theme_provider.h" | 18 #include "ui/base/theme_provider.h" |
| 19 #include "ui/base/win/dpi.h" |
| 19 #include "ui/views/controls/menu/native_menu_win.h" | 20 #include "ui/views/controls/menu/native_menu_win.h" |
| 20 | 21 |
| 21 #pragma comment(lib, "dwmapi.lib") | 22 #pragma comment(lib, "dwmapi.lib") |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 const int kClientEdgeThickness = 3; | 26 const int kClientEdgeThickness = 3; |
| 26 // We need to offset the DWMFrame into the toolbar so that the blackness | 27 // We need to offset the DWMFrame into the toolbar so that the blackness |
| 27 // doesn't show up on our rounded corners. | 28 // doesn't show up on our rounded corners. |
| 28 const int kDWMFrameTopOffset = 3; | 29 const int kDWMFrameTopOffset = 3; |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 margins.cxLeftWidth = kClientEdgeThickness + 1; | 264 margins.cxLeftWidth = kClientEdgeThickness + 1; |
| 264 margins.cxRightWidth = kClientEdgeThickness + 1; | 265 margins.cxRightWidth = kClientEdgeThickness + 1; |
| 265 margins.cyBottomHeight = kClientEdgeThickness + 1; | 266 margins.cyBottomHeight = kClientEdgeThickness + 1; |
| 266 margins.cyTopHeight = kClientEdgeThickness + 1; | 267 margins.cyTopHeight = kClientEdgeThickness + 1; |
| 267 } | 268 } |
| 268 // In maximized mode, we only have a titlebar strip of glass, no side/bottom | 269 // In maximized mode, we only have a titlebar strip of glass, no side/bottom |
| 269 // borders. | 270 // borders. |
| 270 if (!browser_view_->IsFullscreen()) { | 271 if (!browser_view_->IsFullscreen()) { |
| 271 gfx::Rect tabstrip_bounds( | 272 gfx::Rect tabstrip_bounds( |
| 272 browser_frame_->GetBoundsForTabStrip(browser_view_->tabstrip())); | 273 browser_frame_->GetBoundsForTabStrip(browser_view_->tabstrip())); |
| 274 tabstrip_bounds = ui::win::DIPToScreenRect(tabstrip_bounds); |
| 273 margins.cyTopHeight = tabstrip_bounds.bottom() + kDWMFrameTopOffset; | 275 margins.cyTopHeight = tabstrip_bounds.bottom() + kDWMFrameTopOffset; |
| 274 } | 276 } |
| 275 } | 277 } |
| 276 | 278 |
| 277 DwmExtendFrameIntoClientArea(GetHWND(), &margins); | 279 DwmExtendFrameIntoClientArea(GetHWND(), &margins); |
| 278 } | 280 } |
| 279 | 281 |
| 280 //////////////////////////////////////////////////////////////////////////////// | 282 //////////////////////////////////////////////////////////////////////////////// |
| 281 // BrowserDesktopRootWindowHost, public: | 283 // BrowserDesktopRootWindowHost, public: |
| 282 | 284 |
| 283 // static | 285 // static |
| 284 BrowserDesktopRootWindowHost* | 286 BrowserDesktopRootWindowHost* |
| 285 BrowserDesktopRootWindowHost::CreateBrowserDesktopRootWindowHost( | 287 BrowserDesktopRootWindowHost::CreateBrowserDesktopRootWindowHost( |
| 286 views::internal::NativeWidgetDelegate* native_widget_delegate, | 288 views::internal::NativeWidgetDelegate* native_widget_delegate, |
| 287 views::DesktopNativeWidgetAura* desktop_native_widget_aura, | 289 views::DesktopNativeWidgetAura* desktop_native_widget_aura, |
| 288 const gfx::Rect& initial_bounds, | 290 const gfx::Rect& initial_bounds, |
| 289 BrowserView* browser_view, | 291 BrowserView* browser_view, |
| 290 BrowserFrame* browser_frame) { | 292 BrowserFrame* browser_frame) { |
| 291 return new BrowserDesktopRootWindowHostWin(native_widget_delegate, | 293 return new BrowserDesktopRootWindowHostWin(native_widget_delegate, |
| 292 desktop_native_widget_aura, | 294 desktop_native_widget_aura, |
| 293 initial_bounds, | 295 initial_bounds, |
| 294 browser_view, | 296 browser_view, |
| 295 browser_frame); | 297 browser_frame); |
| 296 } | 298 } |
| OLD | NEW |