| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/opaque_browser_frame_view_layout.h" | 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" |
| 7 #include "chrome/browser/profiles/profiles_state.h" | 8 #include "chrome/browser/profiles/profiles_state.h" |
| 8 #include "chrome/browser/ui/views/avatar_label.h" | 9 #include "chrome/browser/ui/views/avatar_label.h" |
| 9 #include "chrome/browser/ui/views/avatar_menu_button.h" | 10 #include "chrome/browser/ui/views/avatar_menu_button.h" |
| 11 #include "chrome/common/chrome_switches.h" |
| 10 #include "chrome/common/profile_management_switches.h" | 12 #include "chrome/common/profile_management_switches.h" |
| 11 #include "ui/gfx/font.h" | 13 #include "ui/gfx/font.h" |
| 12 #include "ui/views/controls/button/image_button.h" | 14 #include "ui/views/controls/button/image_button.h" |
| 13 #include "ui/views/controls/label.h" | 15 #include "ui/views/controls/label.h" |
| 14 | 16 |
| 15 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 16 #include "win8/util/win8_util.h" | 18 #include "win8/util/win8_util.h" |
| 17 #endif // OS_WIN | 19 #endif // OS_WIN |
| 18 | 20 |
| 19 namespace { | 21 namespace { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 54 |
| 53 // Space between the edge of the avatar and the tabstrip. | 55 // Space between the edge of the avatar and the tabstrip. |
| 54 const int kAvatarInnerSpacing = 4; | 56 const int kAvatarInnerSpacing = 4; |
| 55 | 57 |
| 56 // Space between the trailing edge of the avatar label and the tabstrip. | 58 // Space between the trailing edge of the avatar label and the tabstrip. |
| 57 const int kAvatarLabelInnerSpacing = 10; | 59 const int kAvatarLabelInnerSpacing = 10; |
| 58 | 60 |
| 59 // How far the new avatar button is from the closest caption button. | 61 // How far the new avatar button is from the closest caption button. |
| 60 const int kNewAvatarButtonOffset = 5; | 62 const int kNewAvatarButtonOffset = 5; |
| 61 | 63 |
| 62 // In restored mode, the New Tab button isn't at the same height as the caption | 64 // When the title bar is in its normal two row mode (usually the case for |
| 65 // restored windows), the New Tab button isn't at the same height as the caption |
| 63 // buttons, but the space will look cluttered if it actually slides under them, | 66 // buttons, but the space will look cluttered if it actually slides under them, |
| 64 // so we stop it when the gap between the two is down to 5 px. | 67 // so we stop it when the gap between the two is down to 5 px. |
| 65 const int kNewTabCaptionRestoredSpacing = 5; | 68 const int kNewTabCaptionNormalSpacing = 5; |
| 66 | 69 |
| 67 // In maximized mode, where the New Tab button and the caption buttons are at | 70 // When the title bar is condensed to one row (as when maximized), the New Tab |
| 68 // similar vertical coordinates, we need to reserve a larger, 16 px gap to avoid | 71 // button and the caption buttons are at similar vertical coordinates, so we |
| 69 // looking too cluttered. | 72 // need to reserve a larger, 16 px gap to avoid looking too cluttered. |
| 70 const int kNewTabCaptionMaximizedSpacing = 16; | 73 const int kNewTabCaptionCondensedSpacing = 16; |
| 71 | 74 |
| 72 // If there are no caption buttons to the right of the New Tab button, we | 75 // If there are no caption buttons to the right of the New Tab button, we |
| 73 // reserve a small 5px gap, regardless of whether the window is maximized. This | 76 // reserve a small 5px gap, regardless of whether the window is maximized. This |
| 74 // overrides the two previous constants. | 77 // overrides the two previous constants. |
| 75 const int kNewTabNoCaptionButtonsSpacing = 5; | 78 const int kNewTabNoCaptionButtonsSpacing = 5; |
| 76 | 79 |
| 77 // The top 3 px of the tabstrip is shadow; in maximized mode we push this off | 80 // The top 3 px of the tabstrip is shadow; in maximized mode we push this off |
| 78 // the top of the screen so the tabs appear flush against the screen edge. | 81 // the top of the screen so the tabs appear flush against the screen edge. |
| 79 const int kTabstripTopShadowThickness = 3; | 82 const int kTabstripTopShadowThickness = 3; |
| 80 | 83 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 const gfx::Rect& client_bounds) const { | 195 const gfx::Rect& client_bounds) const { |
| 193 int top_height = NonClientTopBorderHeight(false); | 196 int top_height = NonClientTopBorderHeight(false); |
| 194 int border_thickness = NonClientBorderThickness(); | 197 int border_thickness = NonClientBorderThickness(); |
| 195 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness), | 198 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness), |
| 196 std::max(0, client_bounds.y() - top_height), | 199 std::max(0, client_bounds.y() - top_height), |
| 197 client_bounds.width() + (2 * border_thickness), | 200 client_bounds.width() + (2 * border_thickness), |
| 198 client_bounds.height() + top_height + border_thickness); | 201 client_bounds.height() + top_height + border_thickness); |
| 199 } | 202 } |
| 200 | 203 |
| 201 int OpaqueBrowserFrameViewLayout::FrameBorderThickness(bool restored) const { | 204 int OpaqueBrowserFrameViewLayout::FrameBorderThickness(bool restored) const { |
| 202 return (!restored && (delegate_->IsMaximized() || | 205 return (!restored && (IsTitleBarCondensed() || |
| 203 delegate_->IsFullscreen())) ? | 206 delegate_->IsFullscreen())) ? |
| 204 0 : kFrameBorderThickness; | 207 0 : kFrameBorderThickness; |
| 205 } | 208 } |
| 206 | 209 |
| 207 int OpaqueBrowserFrameViewLayout::NonClientBorderThickness() const { | 210 int OpaqueBrowserFrameViewLayout::NonClientBorderThickness() const { |
| 208 // When we fill the screen, we don't show a client edge. | 211 // When we fill the screen, we don't show a client edge. |
| 209 return FrameBorderThickness(false) + | 212 return FrameBorderThickness(false) + |
| 210 ((delegate_->IsMaximized() || delegate_->IsFullscreen()) ? | 213 ((IsTitleBarCondensed() || delegate_->IsFullscreen()) ? |
| 211 0 : views::NonClientFrameView::kClientEdgeThickness); | 214 0 : views::NonClientFrameView::kClientEdgeThickness); |
| 212 } | 215 } |
| 213 | 216 |
| 214 int OpaqueBrowserFrameViewLayout::NonClientTopBorderHeight( | 217 int OpaqueBrowserFrameViewLayout::NonClientTopBorderHeight( |
| 215 bool restored) const { | 218 bool restored) const { |
| 216 if (delegate_->ShouldShowWindowTitle()) { | 219 if (delegate_->ShouldShowWindowTitle()) { |
| 217 return std::max(FrameBorderThickness(restored) + delegate_->GetIconSize(), | 220 return std::max(FrameBorderThickness(restored) + delegate_->GetIconSize(), |
| 218 CaptionButtonY(restored) + kCaptionButtonHeightWithPadding) + | 221 CaptionButtonY(restored) + kCaptionButtonHeightWithPadding) + |
| 219 TitlebarBottomThickness(restored); | 222 TitlebarBottomThickness(restored); |
| 220 } | 223 } |
| 221 | 224 |
| 222 return FrameBorderThickness(restored) - | 225 int thickness = FrameBorderThickness(restored); |
| 223 ((delegate_->IsTabStripVisible() && | 226 if (!restored && delegate_->IsTabStripVisible() && |
| 224 !restored && !delegate_->ShouldLeaveOffsetNearTopBorder()) | 227 (!delegate_->ShouldLeaveOffsetNearTopBorder() || IsTitleBarCondensed())) { |
| 225 ? kTabstripTopShadowThickness : 0); | 228 thickness -= kTabstripTopShadowThickness; |
| 229 } |
| 230 return thickness; |
| 226 } | 231 } |
| 227 | 232 |
| 228 int OpaqueBrowserFrameViewLayout::GetTabStripInsetsTop(bool restored) const { | 233 int OpaqueBrowserFrameViewLayout::GetTabStripInsetsTop(bool restored) const { |
| 229 return NonClientTopBorderHeight(restored) + ((!restored && | 234 return NonClientTopBorderHeight(restored) + ((!restored && |
| 230 (!delegate_->ShouldLeaveOffsetNearTopBorder() || | 235 (!delegate_->ShouldLeaveOffsetNearTopBorder() || |
| 236 IsTitleBarCondensed() || |
| 231 delegate_->IsFullscreen())) ? | 237 delegate_->IsFullscreen())) ? |
| 232 0 : kNonClientRestoredExtraThickness); | 238 0 : kNonClientRestoredExtraThickness); |
| 233 } | 239 } |
| 234 | 240 |
| 235 int OpaqueBrowserFrameViewLayout::TitlebarBottomThickness(bool restored) const { | 241 int OpaqueBrowserFrameViewLayout::TitlebarBottomThickness(bool restored) const { |
| 236 return kTitlebarTopAndBottomEdgeThickness + | 242 return kTitlebarTopAndBottomEdgeThickness + |
| 237 ((!restored && delegate_->IsMaximized()) ? 0 : | 243 ((!restored && IsTitleBarCondensed()) ? 0 : |
| 238 views::NonClientFrameView::kClientEdgeThickness); | 244 views::NonClientFrameView::kClientEdgeThickness); |
| 239 } | 245 } |
| 240 | 246 |
| 241 int OpaqueBrowserFrameViewLayout::CaptionButtonY(bool restored) const { | 247 int OpaqueBrowserFrameViewLayout::CaptionButtonY(bool restored) const { |
| 242 // Maximized buttons start at window top, since the window has no border. This | 248 // Maximized buttons start at window top, since the window has no border. This |
| 243 // offset is for the image (the actual clickable bounds extend all the way to | 249 // offset is for the image (the actual clickable bounds extend all the way to |
| 244 // the top to take Fitts' Law into account). | 250 // the top to take Fitts' Law into account). |
| 245 return ((!restored && delegate_->IsMaximized()) ? | 251 return ((!restored && IsTitleBarCondensed()) ? |
| 246 FrameBorderThickness(false) : | 252 FrameBorderThickness(false) : |
| 247 views::NonClientFrameView::kFrameShadowThickness) + extra_caption_y_; | 253 views::NonClientFrameView::kFrameShadowThickness) + extra_caption_y_; |
| 248 } | 254 } |
| 249 | 255 |
| 250 gfx::Rect OpaqueBrowserFrameViewLayout::IconBounds() const { | 256 gfx::Rect OpaqueBrowserFrameViewLayout::IconBounds() const { |
| 251 return window_icon_bounds_; | 257 return window_icon_bounds_; |
| 252 } | 258 } |
| 253 | 259 |
| 254 gfx::Rect OpaqueBrowserFrameViewLayout::CalculateClientAreaBounds( | 260 gfx::Rect OpaqueBrowserFrameViewLayout::CalculateClientAreaBounds( |
| 255 int width, | 261 int width, |
| 256 int height) const { | 262 int height) const { |
| 257 int top_height = NonClientTopBorderHeight(false); | 263 int top_height = NonClientTopBorderHeight(false); |
| 258 int border_thickness = NonClientBorderThickness(); | 264 int border_thickness = NonClientBorderThickness(); |
| 259 return gfx::Rect(border_thickness, top_height, | 265 return gfx::Rect(border_thickness, top_height, |
| 260 std::max(0, width - (2 * border_thickness)), | 266 std::max(0, width - (2 * border_thickness)), |
| 261 std::max(0, height - top_height - border_thickness)); | 267 std::max(0, height - top_height - border_thickness)); |
| 262 } | 268 } |
| 263 | 269 |
| 270 bool OpaqueBrowserFrameViewLayout::IsTitleBarCondensed() const { |
| 271 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 272 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseSystemTitleBar)) |
| 273 return true; |
| 274 #endif |
| 275 |
| 276 return delegate_->IsMaximized(); |
| 277 } |
| 278 |
| 264 /////////////////////////////////////////////////////////////////////////////// | 279 /////////////////////////////////////////////////////////////////////////////// |
| 265 // OpaqueBrowserFrameView, private: | 280 // OpaqueBrowserFrameView, private: |
| 266 | 281 |
| 267 bool OpaqueBrowserFrameViewLayout::ShouldAvatarBeOnRight() const { | 282 bool OpaqueBrowserFrameViewLayout::ShouldAvatarBeOnRight() const { |
| 268 // The avatar should be shown either on the end of the left or the beginning | 283 // The avatar should be shown either on the end of the left or the beginning |
| 269 // of the right depending on which side has fewer buttons. | 284 // of the right depending on which side has fewer buttons. |
| 270 return trailing_buttons_.size() < leading_buttons_.size(); | 285 return trailing_buttons_.size() < leading_buttons_.size(); |
| 271 } | 286 } |
| 272 | 287 |
| 273 int OpaqueBrowserFrameViewLayout::NewTabCaptionSpacing() const { | 288 int OpaqueBrowserFrameViewLayout::NewTabCaptionSpacing() const { |
| 274 return has_trailing_buttons_ | 289 return has_trailing_buttons_ |
| 275 ? (delegate_->IsMaximized() ? kNewTabCaptionMaximizedSpacing | 290 ? (IsTitleBarCondensed() ? kNewTabCaptionCondensedSpacing |
| 276 : kNewTabCaptionRestoredSpacing) | 291 : kNewTabCaptionNormalSpacing) |
| 277 : kNewTabNoCaptionButtonsSpacing; | 292 : kNewTabNoCaptionButtonsSpacing; |
| 278 } | 293 } |
| 279 | 294 |
| 280 void OpaqueBrowserFrameViewLayout::LayoutWindowControls(views::View* host) { | 295 void OpaqueBrowserFrameViewLayout::LayoutWindowControls(views::View* host) { |
| 281 if (!ShouldAddDefaultCaptionButtons()) | 296 if (!ShouldAddDefaultCaptionButtons()) |
| 282 return; | 297 return; |
| 283 | 298 |
| 284 int caption_y = CaptionButtonY(false); | 299 int caption_y = CaptionButtonY(false); |
| 285 | 300 |
| 286 // Keep a list of all buttons that we don't show. | 301 // Keep a list of all buttons that we don't show. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 use_hidden_icon_location = false; | 340 use_hidden_icon_location = false; |
| 326 | 341 |
| 327 // Our frame border has a different "3D look" than Windows'. Theirs has | 342 // Our frame border has a different "3D look" than Windows'. Theirs has |
| 328 // a more complex gradient on the top that they push their icon/title | 343 // a more complex gradient on the top that they push their icon/title |
| 329 // below; then the maximized window cuts this off and the icon/title are | 344 // below; then the maximized window cuts this off and the icon/title are |
| 330 // centered in the remaining space. Because the apparent shape of our | 345 // centered in the remaining space. Because the apparent shape of our |
| 331 // border is simpler, using the same positioning makes things look | 346 // border is simpler, using the same positioning makes things look |
| 332 // slightly uncentered with restored windows, so when the window is | 347 // slightly uncentered with restored windows, so when the window is |
| 333 // restored, instead of calculating the remaining space from below the | 348 // restored, instead of calculating the remaining space from below the |
| 334 // frame border, we calculate from below the 3D edge. | 349 // frame border, we calculate from below the 3D edge. |
| 335 int unavailable_px_at_top = delegate_->IsMaximized() ? | 350 int unavailable_px_at_top = IsTitleBarCondensed() ? |
| 336 frame_thickness : kTitlebarTopAndBottomEdgeThickness; | 351 frame_thickness : kTitlebarTopAndBottomEdgeThickness; |
| 337 // When the icon is shorter than the minimum space we reserve for the | 352 // When the icon is shorter than the minimum space we reserve for the |
| 338 // caption button, we vertically center it. We want to bias rounding to | 353 // caption button, we vertically center it. We want to bias rounding to |
| 339 // put extra space above the icon, since the 3D edge (+ client edge, for | 354 // put extra space above the icon, since the 3D edge (+ client edge, for |
| 340 // restored windows) below looks (to the eye) more like additional space | 355 // restored windows) below looks (to the eye) more like additional space |
| 341 // than does the 3D edge (or nothing at all, for maximized windows) | 356 // than does the 3D edge (or nothing at all, for maximized windows) |
| 342 // above; hence the +1. | 357 // above; hence the +1. |
| 343 int y = unavailable_px_at_top + (NonClientTopBorderHeight(false) - | 358 int y = unavailable_px_at_top + (NonClientTopBorderHeight(false) - |
| 344 unavailable_px_at_top - size - | 359 unavailable_px_at_top - size - |
| 345 TitlebarBottomThickness(false) + 1) / 2; | 360 TitlebarBottomThickness(false) + 1) / 2; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 gfx::ImageSkia incognito_icon = delegate_->GetOTRAvatarIcon(); | 426 gfx::ImageSkia incognito_icon = delegate_->GetOTRAvatarIcon(); |
| 412 | 427 |
| 413 bool avatar_on_right = ShouldAvatarBeOnRight(); | 428 bool avatar_on_right = ShouldAvatarBeOnRight(); |
| 414 int avatar_bottom = GetTabStripInsetsTop(false) + | 429 int avatar_bottom = GetTabStripInsetsTop(false) + |
| 415 delegate_->GetTabStripHeight() - kAvatarBottomSpacing; | 430 delegate_->GetTabStripHeight() - kAvatarBottomSpacing; |
| 416 int avatar_restored_y = avatar_bottom - incognito_icon.height(); | 431 int avatar_restored_y = avatar_bottom - incognito_icon.height(); |
| 417 int avatar_x = avatar_on_right ? | 432 int avatar_x = avatar_on_right ? |
| 418 host->width() - trailing_button_start_ - kAvatarOuterSpacing - | 433 host->width() - trailing_button_start_ - kAvatarOuterSpacing - |
| 419 incognito_icon.width() : | 434 incognito_icon.width() : |
| 420 leading_button_start_ + kAvatarOuterSpacing; | 435 leading_button_start_ + kAvatarOuterSpacing; |
| 421 int avatar_y = delegate_->IsMaximized() ? | 436 int avatar_y = IsTitleBarCondensed() ? |
| 422 (NonClientTopBorderHeight(false) + kTabstripTopShadowThickness) : | 437 (NonClientTopBorderHeight(false) + kTabstripTopShadowThickness) : |
| 423 avatar_restored_y; | 438 avatar_restored_y; |
| 424 avatar_bounds_.SetRect( | 439 avatar_bounds_.SetRect( |
| 425 avatar_x, | 440 avatar_x, |
| 426 avatar_y, | 441 avatar_y, |
| 427 incognito_icon.width(), | 442 incognito_icon.width(), |
| 428 delegate_->ShouldShowAvatar() ? (avatar_bottom - avatar_y) : 0); | 443 delegate_->ShouldShowAvatar() ? (avatar_bottom - avatar_y) : 0); |
| 429 if (avatar_button_) { | 444 if (avatar_button_) { |
| 430 avatar_button_->set_button_on_right(avatar_on_right); | 445 avatar_button_->set_button_on_right(avatar_on_right); |
| 431 avatar_button_->SetBoundsRect(avatar_bounds_); | 446 avatar_button_->SetBoundsRect(avatar_bounds_); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 | 535 |
| 521 button->SetImageAlignment( | 536 button->SetImageAlignment( |
| 522 (alignment == ALIGN_LEADING) ? | 537 (alignment == ALIGN_LEADING) ? |
| 523 views::ImageButton::ALIGN_RIGHT : views::ImageButton::ALIGN_LEFT, | 538 views::ImageButton::ALIGN_RIGHT : views::ImageButton::ALIGN_LEFT, |
| 524 views::ImageButton::ALIGN_BOTTOM); | 539 views::ImageButton::ALIGN_BOTTOM); |
| 525 | 540 |
| 526 // There should always be the same number of non-shadow pixels visible to the | 541 // There should always be the same number of non-shadow pixels visible to the |
| 527 // side of the caption buttons. In maximized mode we extend buttons to the | 542 // side of the caption buttons. In maximized mode we extend buttons to the |
| 528 // screen top and the rightmost button to the screen right (or leftmost button | 543 // screen top and the rightmost button to the screen right (or leftmost button |
| 529 // to the screen left, for left-aligned buttons) to obey Fitts' Law. | 544 // to the screen left, for left-aligned buttons) to obey Fitts' Law. |
| 530 bool is_maximized = delegate_->IsMaximized(); | 545 bool title_bar_condensed = IsTitleBarCondensed(); |
| 531 | 546 |
| 532 // When we are the first button on the leading side and are the close | 547 // When we are the first button on the leading side and are the close |
| 533 // button, we must flip ourselves, because the close button assets have | 548 // button, we must flip ourselves, because the close button assets have |
| 534 // a little notch to fit in the rounded frame. | 549 // a little notch to fit in the rounded frame. |
| 535 button->SetDrawImageMirrored(alignment == ALIGN_LEADING && | 550 button->SetDrawImageMirrored(alignment == ALIGN_LEADING && |
| 536 !has_leading_buttons_ && | 551 !has_leading_buttons_ && |
| 537 button == close_button_); | 552 button == close_button_); |
| 538 // If the window is maximized, align the buttons to its upper edge. | 553 // If the window is maximized, align the buttons to its upper edge. |
| 539 int extra_height = is_maximized ? extra_caption_y_ : 0; | 554 int extra_height = title_bar_condensed ? extra_caption_y_ : 0; |
| 540 | 555 |
| 541 switch (alignment) { | 556 switch (alignment) { |
| 542 case ALIGN_LEADING: { | 557 case ALIGN_LEADING: { |
| 543 if (has_leading_buttons_) | 558 if (has_leading_buttons_) |
| 544 leading_button_start_ += window_caption_spacing_; | 559 leading_button_start_ += window_caption_spacing_; |
| 545 | 560 |
| 546 // If we're the first button on the left and maximized, add width to the | 561 // If we're the first button on the left and maximized, add width to the |
| 547 // right hand side of the screen. | 562 // right hand side of the screen. |
| 548 int extra_width = (is_maximized && !has_leading_buttons_) ? | 563 int extra_width = (title_bar_condensed && !has_leading_buttons_) ? |
| 549 (kFrameBorderThickness - | 564 (kFrameBorderThickness - |
| 550 views::NonClientFrameView::kFrameShadowThickness) : 0; | 565 views::NonClientFrameView::kFrameShadowThickness) : 0; |
| 551 | 566 |
| 552 button->SetBounds( | 567 button->SetBounds( |
| 553 leading_button_start_, | 568 leading_button_start_, |
| 554 caption_y - extra_height, | 569 caption_y - extra_height, |
| 555 button_size.width() + extra_width, | 570 button_size.width() + extra_width, |
| 556 button_size.height() + extra_height); | 571 button_size.height() + extra_height); |
| 557 | 572 |
| 558 leading_button_start_ += extra_width + button_size.width(); | 573 leading_button_start_ += extra_width + button_size.width(); |
| 559 minimum_size_for_buttons_ += extra_width + button_size.width(); | 574 minimum_size_for_buttons_ += extra_width + button_size.width(); |
| 560 has_leading_buttons_ = true; | 575 has_leading_buttons_ = true; |
| 561 break; | 576 break; |
| 562 } | 577 } |
| 563 case ALIGN_TRAILING: { | 578 case ALIGN_TRAILING: { |
| 564 if (has_trailing_buttons_) | 579 if (has_trailing_buttons_) |
| 565 trailing_button_start_ += window_caption_spacing_; | 580 trailing_button_start_ += window_caption_spacing_; |
| 566 | 581 |
| 567 // If we're the first button on the right and maximized, add width to the | 582 // If we're the first button on the right and maximized, add width to the |
| 568 // right hand side of the screen. | 583 // right hand side of the screen. |
| 569 int extra_width = (is_maximized && !has_trailing_buttons_) ? | 584 int extra_width = (title_bar_condensed && !has_trailing_buttons_) ? |
| 570 (kFrameBorderThickness - | 585 (kFrameBorderThickness - |
| 571 views::NonClientFrameView::kFrameShadowThickness) : 0; | 586 views::NonClientFrameView::kFrameShadowThickness) : 0; |
| 572 | 587 |
| 573 button->SetBounds( | 588 button->SetBounds( |
| 574 host->width() - trailing_button_start_ - extra_width - | 589 host->width() - trailing_button_start_ - extra_width - |
| 575 button_size.width(), | 590 button_size.width(), |
| 576 caption_y - extra_height, | 591 caption_y - extra_height, |
| 577 button_size.width() + extra_width, | 592 button_size.width() + extra_width, |
| 578 button_size.height() + extra_height); | 593 button_size.height() + extra_height); |
| 579 | 594 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 | 702 |
| 688 void OpaqueBrowserFrameViewLayout::ViewAdded(views::View* host, | 703 void OpaqueBrowserFrameViewLayout::ViewAdded(views::View* host, |
| 689 views::View* view) { | 704 views::View* view) { |
| 690 SetView(view->id(), view); | 705 SetView(view->id(), view); |
| 691 } | 706 } |
| 692 | 707 |
| 693 void OpaqueBrowserFrameViewLayout::ViewRemoved(views::View* host, | 708 void OpaqueBrowserFrameViewLayout::ViewRemoved(views::View* host, |
| 694 views::View* view) { | 709 views::View* view) { |
| 695 SetView(view->id(), NULL); | 710 SetView(view->id(), NULL); |
| 696 } | 711 } |
| OLD | NEW |