| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "chrome/browser/ui/cocoa/browser_window_layout.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_layout.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "base/i18n/rtl.h" | |
| 11 #include "base/logging.h" | 10 #include "base/logging.h" |
| 12 #include "base/mac/mac_util.h" | 11 #include "base/mac/mac_util.h" |
| 13 #include "chrome/browser/ui/cocoa/l10n_util.h" | 12 #include "chrome/browser/ui/cocoa/l10n_util.h" |
| 14 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 13 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 15 | 14 |
| 16 namespace chrome { | 15 namespace chrome { |
| 17 | 16 |
| 18 // The height of the tab strip. | 17 // The height of the tab strip. |
| 19 const CGFloat kTabStripHeight = 37; | 18 const CGFloat kTabStripHeight = 37; |
| 20 | 19 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // overlapping these buttons. | 242 // overlapping these buttons. |
| 244 CGFloat maxX = width; | 243 CGFloat maxX = width; |
| 245 if (!NSIsEmptyRect(parameters_.fullscreenButtonFrame)) { | 244 if (!NSIsEmptyRect(parameters_.fullscreenButtonFrame)) { |
| 246 maxX = NSMinX(parameters_.fullscreenButtonFrame); | 245 maxX = NSMinX(parameters_.fullscreenButtonFrame); |
| 247 } | 246 } |
| 248 if (parameters_.shouldShowAvatar) { | 247 if (parameters_.shouldShowAvatar) { |
| 249 maxX = std::min(maxX, NSMinX(layout.avatarFrame)); | 248 maxX = std::min(maxX, NSMinX(layout.avatarFrame)); |
| 250 } | 249 } |
| 251 layout.rightIndent = width - maxX; | 250 layout.rightIndent = width - maxX; |
| 252 | 251 |
| 253 if (cocoa_l10n_util::ExperimentalMacRTLIsEnabled() && base::i18n::IsRTL()) { | 252 if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) { |
| 254 std::swap(layout.leftIndent, layout.rightIndent); | 253 std::swap(layout.leftIndent, layout.rightIndent); |
| 255 layout.avatarFrame.origin.x = | 254 layout.avatarFrame.origin.x = |
| 256 width - parameters_.avatarSize.width - layout.avatarFrame.origin.x; | 255 width - parameters_.avatarSize.width - layout.avatarFrame.origin.x; |
| 257 } | 256 } |
| 258 | 257 |
| 259 output_.tabStripLayout = layout; | 258 output_.tabStripLayout = layout; |
| 260 } | 259 } |
| 261 | 260 |
| 262 - (void)computeContentViewLayout { | 261 - (void)computeContentViewLayout { |
| 263 chrome::LayoutParameters parameters = parameters_; | 262 chrome::LayoutParameters parameters = parameters_; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 | 395 |
| 397 @end | 396 @end |
| 398 | 397 |
| 399 @implementation BrowserWindowLayout (ExposedForTesting) | 398 @implementation BrowserWindowLayout (ExposedForTesting) |
| 400 | 399 |
| 401 - (void)setOSYosemiteOrLater:(BOOL)osYosemiteOrLater { | 400 - (void)setOSYosemiteOrLater:(BOOL)osYosemiteOrLater { |
| 402 parameters_.isOSYosemiteOrLater = osYosemiteOrLater; | 401 parameters_.isOSYosemiteOrLater = osYosemiteOrLater; |
| 403 } | 402 } |
| 404 | 403 |
| 405 @end | 404 @end |
| OLD | NEW |