| 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 "base/command_line.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/ui/layout_constants.h" | 10 #include "chrome/browser/ui/layout_constants.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 int CaptionLeft() const { | 181 int CaptionLeft() const { |
| 182 return kWindowWidth - | 182 return kWindowWidth - |
| 183 (delegate_->IsMaximized() ? kMaximizedExtraCloseWidth | 183 (delegate_->IsMaximized() ? kMaximizedExtraCloseWidth |
| 184 : OBFVL::kFrameBorderThickness) - | 184 : OBFVL::kFrameBorderThickness) - |
| 185 kCaptionButtonsWidth - OBFVL::kCaptionSpacing; | 185 kCaptionButtonsWidth - OBFVL::kCaptionSpacing; |
| 186 } | 186 } |
| 187 | 187 |
| 188 int IconAndTitleY() const { | 188 int IconAndTitleY() const { |
| 189 // This approximates the real positioning algorithm, which is complicated. | 189 // This approximates the real positioning algorithm, which is complicated. |
| 190 int total_vertical_padding = | 190 const int unavailable_px_at_top = |
| 191 (delegate_->IsMaximized() || !delegate_->ShouldShowCaptionButtons()) ? | 191 delegate_->IsMaximized() ? 0 : OBFVL::kTitlebarTopEdgeThickness; |
| 192 (kCaptionButtonHeight - delegate_->GetIconSize()) : | 192 return (unavailable_px_at_top + CaptionY() + kCaptionButtonHeight + |
| 193 (OBFVL::kFrameBorderThickness + OBFVL::kTitlebarTopEdgeThickness); | 193 OBFVL::kCaptionButtonBottomPadding - delegate_->GetIconSize()) / 2; |
| 194 return (total_vertical_padding + 1) / 2; | |
| 195 } | 194 } |
| 196 | 195 |
| 197 void ExpectCaptionButtons(bool caption_buttons_on_left, int extra_height) { | 196 void ExpectCaptionButtons(bool caption_buttons_on_left, int extra_height) { |
| 198 if (!delegate_->ShouldShowCaptionButtons()) { | 197 if (!delegate_->ShouldShowCaptionButtons()) { |
| 199 EXPECT_FALSE(maximize_button_->visible()); | 198 EXPECT_FALSE(maximize_button_->visible()); |
| 200 EXPECT_FALSE(minimize_button_->visible()); | 199 EXPECT_FALSE(minimize_button_->visible()); |
| 201 EXPECT_FALSE(restore_button_->visible()); | 200 EXPECT_FALSE(restore_button_->visible()); |
| 202 EXPECT_FALSE(close_button_->visible()); | 201 EXPECT_FALSE(close_button_->visible()); |
| 203 return; | 202 return; |
| 204 } | 203 } |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 | 435 |
| 437 for (int i = 0; i < 2; ++i) { | 436 for (int i = 0; i < 2; ++i) { |
| 438 root_view_->Layout(); | 437 root_view_->Layout(); |
| 439 SCOPED_TRACE(i == 0 ? "Window is restored" : "Window is maximized"); | 438 SCOPED_TRACE(i == 0 ? "Window is restored" : "Window is maximized"); |
| 440 ExpectCaptionButtons(false, 0); | 439 ExpectCaptionButtons(false, 0); |
| 441 ExpectTabStripAndMinimumSize(false); | 440 ExpectTabStripAndMinimumSize(false); |
| 442 ExpectAvatar(); | 441 ExpectAvatar(); |
| 443 delegate_->set_maximized(true); | 442 delegate_->set_maximized(true); |
| 444 } | 443 } |
| 445 } | 444 } |
| OLD | NEW |