OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 set_focus_on_creation(false); | 62 set_focus_on_creation(false); |
63 } | 63 } |
64 | 64 |
65 void BrowserFrameWin::Init() { | 65 void BrowserFrameWin::Init() { |
66 WindowWin::Init(NULL, gfx::Rect()); | 66 WindowWin::Init(NULL, gfx::Rect()); |
67 } | 67 } |
68 | 68 |
69 BrowserFrameWin::~BrowserFrameWin() { | 69 BrowserFrameWin::~BrowserFrameWin() { |
70 } | 70 } |
71 | 71 |
72 int BrowserFrameWin::GetTitleBarHeight() { | |
73 RECT caption = { 0 }; | |
74 if (DwmGetWindowAttribute(GetNativeView(), DWMWA_CAPTION_BUTTON_BOUNDS, | |
75 &caption, sizeof(RECT)) == S_OK) { | |
76 return caption.bottom; | |
77 } | |
78 return GetSystemMetrics(SM_CYCAPTION); | |
79 } | |
80 | |
81 views::Window* BrowserFrameWin::GetWindow() { | 72 views::Window* BrowserFrameWin::GetWindow() { |
82 return this; | 73 return this; |
83 } | 74 } |
84 | 75 |
85 int BrowserFrameWin::GetMinimizeButtonOffset() const { | 76 int BrowserFrameWin::GetMinimizeButtonOffset() const { |
86 TITLEBARINFOEX titlebar_info; | 77 TITLEBARINFOEX titlebar_info; |
87 titlebar_info.cbSize = sizeof(TITLEBARINFOEX); | 78 titlebar_info.cbSize = sizeof(TITLEBARINFOEX); |
88 SendMessage(GetNativeView(), WM_GETTITLEBARINFOEX, 0, (WPARAM)&titlebar_info); | 79 SendMessage(GetNativeView(), WM_GETTITLEBARINFOEX, 0, (WPARAM)&titlebar_info); |
89 | 80 |
90 CPoint minimize_button_corner(titlebar_info.rgrect[2].left, | 81 CPoint minimize_button_corner(titlebar_info.rgrect[2].left, |
91 titlebar_info.rgrect[2].top); | 82 titlebar_info.rgrect[2].top); |
92 MapWindowPoints(HWND_DESKTOP, GetNativeView(), &minimize_button_corner, 1); | 83 MapWindowPoints(HWND_DESKTOP, GetNativeView(), &minimize_button_corner, 1); |
93 | 84 |
94 return minimize_button_corner.x; | 85 return minimize_button_corner.x; |
95 } | 86 } |
96 | 87 |
97 gfx::Rect BrowserFrameWin::GetBoundsForTabStrip(BaseTabStrip* tabstrip) const { | 88 gfx::Rect BrowserFrameWin::GetBoundsForTabStrip(BaseTabStrip* tabstrip) const { |
98 return browser_frame_view_->GetBoundsForTabStrip(tabstrip); | 89 return browser_frame_view_->GetBoundsForTabStrip(tabstrip); |
99 } | 90 } |
100 | 91 |
| 92 int BrowserFrameWin::GetHorizontalTabStripVerticalOffset(bool restored) const { |
| 93 return browser_frame_view_->GetHorizontalTabStripVerticalOffset(restored); |
| 94 } |
| 95 |
101 void BrowserFrameWin::UpdateThrobber(bool running) { | 96 void BrowserFrameWin::UpdateThrobber(bool running) { |
102 browser_frame_view_->UpdateThrobber(running); | 97 browser_frame_view_->UpdateThrobber(running); |
103 } | 98 } |
104 | 99 |
105 void BrowserFrameWin::ContinueDraggingDetachedTab() { | 100 void BrowserFrameWin::ContinueDraggingDetachedTab() { |
106 // Send the message directly, so that the window is positioned appropriately. | 101 // Send the message directly, so that the window is positioned appropriately. |
107 SendMessage(GetNativeWindow(), WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(0, 0)); | 102 SendMessage(GetNativeWindow(), WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(0, 0)); |
108 } | 103 } |
109 | 104 |
110 ThemeProvider* BrowserFrameWin::GetThemeProviderForFrame() const { | 105 ThemeProvider* BrowserFrameWin::GetThemeProviderForFrame() const { |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 // become semi-transparent over any glass area. | 314 // become semi-transparent over any glass area. |
320 if (!IsMaximized() && !IsFullscreen()) { | 315 if (!IsMaximized() && !IsFullscreen()) { |
321 margins.cxLeftWidth = kClientEdgeThickness + 1; | 316 margins.cxLeftWidth = kClientEdgeThickness + 1; |
322 margins.cxRightWidth = kClientEdgeThickness + 1; | 317 margins.cxRightWidth = kClientEdgeThickness + 1; |
323 margins.cyBottomHeight = kClientEdgeThickness + 1; | 318 margins.cyBottomHeight = kClientEdgeThickness + 1; |
324 margins.cyTopHeight = kClientEdgeThickness + 1; | 319 margins.cyTopHeight = kClientEdgeThickness + 1; |
325 } | 320 } |
326 // In maximized mode, we only have a titlebar strip of glass, no side/bottom | 321 // In maximized mode, we only have a titlebar strip of glass, no side/bottom |
327 // borders. | 322 // borders. |
328 if (!browser_view_->IsFullscreen()) { | 323 if (!browser_view_->IsFullscreen()) { |
329 if (browser_view_->UseVerticalTabs()) { | 324 gfx::Rect tabstrip_bounds( |
330 margins.cyTopHeight = GetTitleBarHeight(); | 325 GetBoundsForTabStrip(browser_view_->tabstrip())); |
331 } else { | 326 margins.cyTopHeight = (browser_view_->UseVerticalTabs() ? |
332 margins.cyTopHeight = | 327 tabstrip_bounds.y() : tabstrip_bounds.bottom()) + kDWMFrameTopOffset; |
333 GetBoundsForTabStrip(browser_view_->tabstrip()).bottom() + | |
334 kDWMFrameTopOffset; | |
335 } | |
336 } | 328 } |
337 } else { | 329 } else { |
338 // For popup and app windows we want to use the default margins. | 330 // For popup and app windows we want to use the default margins. |
339 } | 331 } |
340 DwmExtendFrameIntoClientArea(GetNativeView(), &margins); | 332 DwmExtendFrameIntoClientArea(GetNativeView(), &margins); |
341 } | 333 } |
OLD | NEW |