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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_layout.mm

Issue 2313723004: cocoa: flip window controls and profile switcher for RTL (Closed)
Patch Set: add ExperimentalMacRTL feature Created 4 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/framed_browser_window.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/mac/mac_util.h" 12 #include "base/mac/mac_util.h"
13 #include "chrome/browser/ui/cocoa/l10n_util.h"
12 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" 14 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
13 15
14 namespace chrome { 16 namespace chrome {
15 17
16 // The height of the tab strip. 18 // The height of the tab strip.
17 const CGFloat kTabStripHeight = 37; 19 const CGFloat kTabStripHeight = 37;
18 20
19 } // namespace chrome 21 } // namespace chrome
20 22
21 namespace { 23 namespace {
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 // overlapping these buttons. 243 // overlapping these buttons.
242 CGFloat maxX = width; 244 CGFloat maxX = width;
243 if (!NSIsEmptyRect(parameters_.fullscreenButtonFrame)) { 245 if (!NSIsEmptyRect(parameters_.fullscreenButtonFrame)) {
244 maxX = NSMinX(parameters_.fullscreenButtonFrame); 246 maxX = NSMinX(parameters_.fullscreenButtonFrame);
245 } 247 }
246 if (parameters_.shouldShowAvatar) { 248 if (parameters_.shouldShowAvatar) {
247 maxX = std::min(maxX, NSMinX(layout.avatarFrame)); 249 maxX = std::min(maxX, NSMinX(layout.avatarFrame));
248 } 250 }
249 layout.rightIndent = width - maxX; 251 layout.rightIndent = width - maxX;
250 252
253 if (cocoa_l10n_util::ExperimentalMacRTLIsEnabled() && base::i18n::IsRTL()) {
254 std::swap(layout.leftIndent, layout.rightIndent);
255 layout.avatarFrame.origin.x =
256 width - parameters_.avatarSize.width - layout.avatarFrame.origin.x;
257 }
258
251 output_.tabStripLayout = layout; 259 output_.tabStripLayout = layout;
252 } 260 }
253 261
254 - (void)computeContentViewLayout { 262 - (void)computeContentViewLayout {
255 chrome::LayoutParameters parameters = parameters_; 263 chrome::LayoutParameters parameters = parameters_;
256 CGFloat maxY = maxY_; 264 CGFloat maxY = maxY_;
257 265
258 // Sanity-check |maxY|. 266 // Sanity-check |maxY|.
259 DCHECK_GE(maxY, 0); 267 DCHECK_GE(maxY, 0);
260 DCHECK_LE(maxY, parameters_.contentViewSize.height + fullscreenYOffset_); 268 DCHECK_LE(maxY, parameters_.contentViewSize.height + fullscreenYOffset_);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 394
387 @end 395 @end
388 396
389 @implementation BrowserWindowLayout (ExposedForTesting) 397 @implementation BrowserWindowLayout (ExposedForTesting)
390 398
391 - (void)setOSYosemiteOrLater:(BOOL)osYosemiteOrLater { 399 - (void)setOSYosemiteOrLater:(BOOL)osYosemiteOrLater {
392 parameters_.isOSYosemiteOrLater = osYosemiteOrLater; 400 parameters_.isOSYosemiteOrLater = osYosemiteOrLater;
393 } 401 }
394 402
395 @end 403 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/framed_browser_window.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698