Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: chrome/browser/views/frame/browser_frame_win.cc

Issue 1001003: Allow dynamic switching in and out of sidetabs mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
75 int BrowserFrameWin::GetMinimizeButtonOffset() const { 72 int BrowserFrameWin::GetMinimizeButtonOffset() const {
76 TITLEBARINFOEX titlebar_info; 73 TITLEBARINFOEX titlebar_info;
77 titlebar_info.cbSize = sizeof(TITLEBARINFOEX); 74 titlebar_info.cbSize = sizeof(TITLEBARINFOEX);
78 SendMessage(GetNativeView(), WM_GETTITLEBARINFOEX, 0, (WPARAM)&titlebar_info); 75 SendMessage(GetNativeView(), WM_GETTITLEBARINFOEX, 0, (WPARAM)&titlebar_info);
79 76
80 CPoint minimize_button_corner(titlebar_info.rgrect[2].left, 77 CPoint minimize_button_corner(titlebar_info.rgrect[2].left,
81 titlebar_info.rgrect[2].top); 78 titlebar_info.rgrect[2].top);
82 MapWindowPoints(HWND_DESKTOP, GetNativeView(), &minimize_button_corner, 1); 79 MapWindowPoints(HWND_DESKTOP, GetNativeView(), &minimize_button_corner, 1);
83 80
84 return minimize_button_corner.x; 81 return minimize_button_corner.x;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 117 }
121 118
122 views::View* BrowserFrameWin::GetFrameView() const { 119 views::View* BrowserFrameWin::GetFrameView() const {
123 return browser_frame_view_; 120 return browser_frame_view_;
124 } 121 }
125 122
126 void BrowserFrameWin::PaintTabStripShadow(gfx::Canvas* canvas) { 123 void BrowserFrameWin::PaintTabStripShadow(gfx::Canvas* canvas) {
127 browser_frame_view_->PaintTabStripShadow(canvas); 124 browser_frame_view_->PaintTabStripShadow(canvas);
128 } 125 }
129 126
127 void BrowserFrameWin::TabStripDisplayModeChanged() {
128 GetRootView()->Layout();
sky 2010/03/19 16:14:02 Why do you need to layout twice? If you really do,
129 UpdateDWMFrame();
130 GetRootView()->Layout();
131 }
132
130 /////////////////////////////////////////////////////////////////////////////// 133 ///////////////////////////////////////////////////////////////////////////////
131 // BrowserFrame, views::WindowWin overrides: 134 // BrowserFrame, views::WindowWin overrides:
132 135
133 gfx::Insets BrowserFrameWin::GetClientAreaInsets() const { 136 gfx::Insets BrowserFrameWin::GetClientAreaInsets() const {
134 // Use the default client insets for an opaque frame or a glass popup/app 137 // Use the default client insets for an opaque frame or a glass popup/app
135 // frame. 138 // frame.
136 if (!GetNonClientView()->UseNativeFrame() || 139 if (!GetNonClientView()->UseNativeFrame() ||
137 !browser_view_->IsBrowserTypeNormal()) { 140 !browser_view_->IsBrowserTypeNormal()) {
138 return WindowWin::GetClientAreaInsets(); 141 return WindowWin::GetClientAreaInsets();
139 } 142 }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // become semi-transparent over any glass area. 290 // become semi-transparent over any glass area.
288 if (!IsMaximized() && !IsFullscreen()) { 291 if (!IsMaximized() && !IsFullscreen()) {
289 margins.cxLeftWidth = kClientEdgeThickness + 1; 292 margins.cxLeftWidth = kClientEdgeThickness + 1;
290 margins.cxRightWidth = kClientEdgeThickness + 1; 293 margins.cxRightWidth = kClientEdgeThickness + 1;
291 margins.cyBottomHeight = kClientEdgeThickness + 1; 294 margins.cyBottomHeight = kClientEdgeThickness + 1;
292 margins.cyTopHeight = kClientEdgeThickness + 1; 295 margins.cyTopHeight = kClientEdgeThickness + 1;
293 } 296 }
294 // In maximized mode, we only have a titlebar strip of glass, no side/bottom 297 // In maximized mode, we only have a titlebar strip of glass, no side/bottom
295 // borders. 298 // borders.
296 if (!browser_view_->IsFullscreen()) { 299 if (!browser_view_->IsFullscreen()) {
297 if (browser_view_->UsingSideTabs()) { 300 if (browser_view_->UseVerticalTabs()) {
298 margins.cxLeftWidth += 301 margins.cxLeftWidth +=
299 GetBoundsForTabStrip(browser_view_->tabstrip()).right(); 302 GetBoundsForTabStrip(browser_view_->tabstrip()).right();
300 margins.cyTopHeight += GetSystemMetrics(SM_CYSIZEFRAME); 303 margins.cyTopHeight += GetSystemMetrics(SM_CYSIZEFRAME);
301 } else { 304 } else {
302 margins.cyTopHeight = 305 margins.cyTopHeight =
303 GetBoundsForTabStrip(browser_view_->tabstrip()).bottom(); 306 GetBoundsForTabStrip(browser_view_->tabstrip()).bottom();
304 } 307 }
305 } 308 }
306 } else { 309 } else {
307 // For popup and app windows we want to use the default margins. 310 // For popup and app windows we want to use the default margins.
308 } 311 }
309 DwmExtendFrameIntoClientArea(GetNativeView(), &margins); 312 DwmExtendFrameIntoClientArea(GetNativeView(), &margins);
310 313
311 DWORD window_style = GetWindowLong(GWL_STYLE); 314 DWORD window_style = GetWindowLong(GWL_STYLE);
312 if (browser_view_->UsingSideTabs()) { 315 if (browser_view_->UseVerticalTabs()) {
313 if (window_style & WS_CAPTION) 316 if (window_style & WS_CAPTION)
314 SetWindowLong(GWL_STYLE, window_style & ~WS_CAPTION); 317 SetWindowLong(GWL_STYLE, window_style & ~WS_CAPTION);
315 } else { 318 } else {
316 if (!(window_style & WS_CAPTION)) 319 if (!(window_style & WS_CAPTION))
317 SetWindowLong(GWL_STYLE, window_style | WS_CAPTION); 320 SetWindowLong(GWL_STYLE, window_style | WS_CAPTION);
318 } 321 }
319 } 322 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698