| 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/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/mac/mac_util.h" | 11 #include "base/mac/mac_util.h" |
| 12 #include "chrome/browser/ui/cocoa/l10n_util.h" | |
| 13 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 12 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 13 #import "ui/base/cocoa/rtl_feature.h" |
| 14 | 14 |
| 15 namespace chrome { | 15 namespace chrome { |
| 16 | 16 |
| 17 // The height of the tab strip. | 17 // The height of the tab strip. |
| 18 const CGFloat kTabStripHeight = 37; | 18 const CGFloat kTabStripHeight = 37; |
| 19 | 19 |
| 20 bool ShouldUseFullSizeContentView() { | 20 bool ShouldUseFullSizeContentView() { |
| 21 // Chrome has added a subview above the window's content view, which the | 21 // Chrome has added a subview above the window's content view, which the |
| 22 // Appkit warns about at runtime. This was done to make sure that window | 22 // Appkit warns about at runtime. This was done to make sure that window |
| 23 // buttons are always displayed above the content. Presumably, doing so may | 23 // buttons are always displayed above the content. Presumably, doing so may |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 // overlapping these buttons. | 257 // overlapping these buttons. |
| 258 CGFloat maxX = width; | 258 CGFloat maxX = width; |
| 259 if (!NSIsEmptyRect(parameters_.fullscreenButtonFrame)) { | 259 if (!NSIsEmptyRect(parameters_.fullscreenButtonFrame)) { |
| 260 maxX = NSMinX(parameters_.fullscreenButtonFrame); | 260 maxX = NSMinX(parameters_.fullscreenButtonFrame); |
| 261 } | 261 } |
| 262 if (parameters_.shouldShowAvatar) { | 262 if (parameters_.shouldShowAvatar) { |
| 263 maxX = std::min(maxX, NSMinX(layout.avatarFrame)); | 263 maxX = std::min(maxX, NSMinX(layout.avatarFrame)); |
| 264 } | 264 } |
| 265 layout.trailingIndent = width - maxX; | 265 layout.trailingIndent = width - maxX; |
| 266 | 266 |
| 267 if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) { | 267 if (ui::ShouldDoExperimentalRTLLayout()) { |
| 268 if (cocoa_l10n_util::ShouldFlipWindowControlsInRTL()) | 268 if (ui::ShouldFlipWindowControlsInRTL()) |
| 269 layout.avatarFrame.origin.x = | 269 layout.avatarFrame.origin.x = |
| 270 width - parameters_.avatarSize.width - layout.avatarFrame.origin.x; | 270 width - parameters_.avatarSize.width - layout.avatarFrame.origin.x; |
| 271 else | 271 else |
| 272 std::swap(layout.leadingIndent, layout.trailingIndent); | 272 std::swap(layout.leadingIndent, layout.trailingIndent); |
| 273 } | 273 } |
| 274 | 274 |
| 275 output_.tabStripLayout = layout; | 275 output_.tabStripLayout = layout; |
| 276 } | 276 } |
| 277 | 277 |
| 278 - (void)computeContentViewLayout { | 278 - (void)computeContentViewLayout { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 | 415 |
| 416 @end | 416 @end |
| 417 | 417 |
| 418 @implementation BrowserWindowLayout (ExposedForTesting) | 418 @implementation BrowserWindowLayout (ExposedForTesting) |
| 419 | 419 |
| 420 - (void)setOSYosemiteOrLater:(BOOL)osYosemiteOrLater { | 420 - (void)setOSYosemiteOrLater:(BOOL)osYosemiteOrLater { |
| 421 parameters_.isOSYosemiteOrLater = osYosemiteOrLater; | 421 parameters_.isOSYosemiteOrLater = osYosemiteOrLater; |
| 422 } | 422 } |
| 423 | 423 |
| 424 @end | 424 @end |
| OLD | NEW |