| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/frame/browser_frame_win.h" | 5 #include "chrome/browser/views/frame/browser_frame_win.h" |
| 6 | 6 |
| 7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 WindowWin::Init(NULL, gfx::Rect()); | 62 WindowWin::Init(NULL, gfx::Rect()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 BrowserFrameWin::~BrowserFrameWin() { | 65 BrowserFrameWin::~BrowserFrameWin() { |
| 66 } | 66 } |
| 67 | 67 |
| 68 views::Window* BrowserFrameWin::GetWindow() { | 68 views::Window* BrowserFrameWin::GetWindow() { |
| 69 return this; | 69 return this; |
| 70 } | 70 } |
| 71 | 71 |
| 72 void BrowserFrameWin::TabStripCreated(BaseTabStrip* tabstrip) { |
| 73 } |
| 74 |
| 72 int BrowserFrameWin::GetMinimizeButtonOffset() const { | 75 int BrowserFrameWin::GetMinimizeButtonOffset() const { |
| 73 TITLEBARINFOEX titlebar_info; | 76 TITLEBARINFOEX titlebar_info; |
| 74 titlebar_info.cbSize = sizeof(TITLEBARINFOEX); | 77 titlebar_info.cbSize = sizeof(TITLEBARINFOEX); |
| 75 SendMessage(GetNativeView(), WM_GETTITLEBARINFOEX, 0, (WPARAM)&titlebar_info); | 78 SendMessage(GetNativeView(), WM_GETTITLEBARINFOEX, 0, (WPARAM)&titlebar_info); |
| 76 | 79 |
| 77 CPoint minimize_button_corner(titlebar_info.rgrect[2].left, | 80 CPoint minimize_button_corner(titlebar_info.rgrect[2].left, |
| 78 titlebar_info.rgrect[2].top); | 81 titlebar_info.rgrect[2].top); |
| 79 MapWindowPoints(HWND_DESKTOP, GetNativeView(), &minimize_button_corner, 1); | 82 MapWindowPoints(HWND_DESKTOP, GetNativeView(), &minimize_button_corner, 1); |
| 80 | 83 |
| 81 return minimize_button_corner.x; | 84 return minimize_button_corner.x; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 120 } |
| 118 | 121 |
| 119 views::View* BrowserFrameWin::GetFrameView() const { | 122 views::View* BrowserFrameWin::GetFrameView() const { |
| 120 return browser_frame_view_; | 123 return browser_frame_view_; |
| 121 } | 124 } |
| 122 | 125 |
| 123 void BrowserFrameWin::PaintTabStripShadow(gfx::Canvas* canvas) { | 126 void BrowserFrameWin::PaintTabStripShadow(gfx::Canvas* canvas) { |
| 124 browser_frame_view_->PaintTabStripShadow(canvas); | 127 browser_frame_view_->PaintTabStripShadow(canvas); |
| 125 } | 128 } |
| 126 | 129 |
| 127 void BrowserFrameWin::TabStripDisplayModeChanged() { | |
| 128 UpdateDWMFrame(); | |
| 129 // We need to relayout only after the window frame has had a chance to update | |
| 130 // the size/position of its controls (e.g. minimize/maximize/close) so that | |
| 131 // the tabstrip can layout at its correct bounds. | |
| 132 GetRootView()->Layout(); | |
| 133 } | |
| 134 | |
| 135 /////////////////////////////////////////////////////////////////////////////// | 130 /////////////////////////////////////////////////////////////////////////////// |
| 136 // BrowserFrame, views::WindowWin overrides: | 131 // BrowserFrame, views::WindowWin overrides: |
| 137 | 132 |
| 138 gfx::Insets BrowserFrameWin::GetClientAreaInsets() const { | 133 gfx::Insets BrowserFrameWin::GetClientAreaInsets() const { |
| 139 // Use the default client insets for an opaque frame or a glass popup/app | 134 // Use the default client insets for an opaque frame or a glass popup/app |
| 140 // frame. | 135 // frame. |
| 141 if (!GetNonClientView()->UseNativeFrame() || | 136 if (!GetNonClientView()->UseNativeFrame() || |
| 142 !browser_view_->IsBrowserTypeNormal()) { | 137 !browser_view_->IsBrowserTypeNormal()) { |
| 143 return WindowWin::GetClientAreaInsets(); | 138 return WindowWin::GetClientAreaInsets(); |
| 144 } | 139 } |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 // become semi-transparent over any glass area. | 287 // become semi-transparent over any glass area. |
| 293 if (!IsMaximized() && !IsFullscreen()) { | 288 if (!IsMaximized() && !IsFullscreen()) { |
| 294 margins.cxLeftWidth = kClientEdgeThickness + 1; | 289 margins.cxLeftWidth = kClientEdgeThickness + 1; |
| 295 margins.cxRightWidth = kClientEdgeThickness + 1; | 290 margins.cxRightWidth = kClientEdgeThickness + 1; |
| 296 margins.cyBottomHeight = kClientEdgeThickness + 1; | 291 margins.cyBottomHeight = kClientEdgeThickness + 1; |
| 297 margins.cyTopHeight = kClientEdgeThickness + 1; | 292 margins.cyTopHeight = kClientEdgeThickness + 1; |
| 298 } | 293 } |
| 299 // In maximized mode, we only have a titlebar strip of glass, no side/bottom | 294 // In maximized mode, we only have a titlebar strip of glass, no side/bottom |
| 300 // borders. | 295 // borders. |
| 301 if (!browser_view_->IsFullscreen()) { | 296 if (!browser_view_->IsFullscreen()) { |
| 302 if (browser_view_->UseVerticalTabs()) { | 297 if (browser_view_->UsingSideTabs()) { |
| 303 margins.cxLeftWidth += | 298 margins.cxLeftWidth += |
| 304 GetBoundsForTabStrip(browser_view_->tabstrip()).right(); | 299 GetBoundsForTabStrip(browser_view_->tabstrip()).right(); |
| 305 margins.cyTopHeight += GetSystemMetrics(SM_CYSIZEFRAME); | 300 margins.cyTopHeight += GetSystemMetrics(SM_CYSIZEFRAME); |
| 306 } else { | 301 } else { |
| 307 margins.cyTopHeight = | 302 margins.cyTopHeight = |
| 308 GetBoundsForTabStrip(browser_view_->tabstrip()).bottom(); | 303 GetBoundsForTabStrip(browser_view_->tabstrip()).bottom(); |
| 309 } | 304 } |
| 310 } | 305 } |
| 311 } else { | 306 } else { |
| 312 // For popup and app windows we want to use the default margins. | 307 // For popup and app windows we want to use the default margins. |
| 313 } | 308 } |
| 314 DwmExtendFrameIntoClientArea(GetNativeView(), &margins); | 309 DwmExtendFrameIntoClientArea(GetNativeView(), &margins); |
| 315 | 310 |
| 316 DWORD window_style = GetWindowLong(GWL_STYLE); | 311 DWORD window_style = GetWindowLong(GWL_STYLE); |
| 317 if (browser_view_->UseVerticalTabs()) { | 312 if (browser_view_->UsingSideTabs()) { |
| 318 if (window_style & WS_CAPTION) | 313 if (window_style & WS_CAPTION) |
| 319 SetWindowLong(GWL_STYLE, window_style & ~WS_CAPTION); | 314 SetWindowLong(GWL_STYLE, window_style & ~WS_CAPTION); |
| 320 } else { | 315 } else { |
| 321 if (!(window_style & WS_CAPTION)) | 316 if (!(window_style & WS_CAPTION)) |
| 322 SetWindowLong(GWL_STYLE, window_style | WS_CAPTION); | 317 SetWindowLong(GWL_STYLE, window_style | WS_CAPTION); |
| 323 } | 318 } |
| 324 } | 319 } |
| OLD | NEW |