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

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

Issue 2873763003: Rename and move ExperimentalMacRTL flag (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/l10n_util.h" 5 #import "chrome/browser/ui/cocoa/l10n_util.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
11 #include "chrome/common/chrome_features.h"
11 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw eaker.h" 12 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw eaker.h"
12 13
13 namespace cocoa_l10n_util { 14 namespace cocoa_l10n_util {
14 15
15 NSInteger CompareFrameY(id view1, id view2, void* context) { 16 NSInteger CompareFrameY(id view1, id view2, void* context) {
16 CGFloat y1 = NSMinY([view1 frame]); 17 CGFloat y1 = NSMinY([view1 frame]);
17 CGFloat y2 = NSMinY([view2 frame]); 18 CGFloat y2 = NSMinY([view2 frame]);
18 if (y1 < y2) 19 if (y1 < y2)
19 return NSOrderedAscending; 20 return NSOrderedAscending;
20 else if (y1 > y2) 21 else if (y1 > y2)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 78
78 NSString* TooltipForURLAndTitle(NSString* url, NSString* title) { 79 NSString* TooltipForURLAndTitle(NSString* url, NSString* title) {
79 if ([title length] == 0) 80 if ([title length] == 0)
80 return url; 81 return url;
81 else if ([url length] == 0 || [url isEqualToString:title]) 82 else if ([url length] == 0 || [url isEqualToString:title])
82 return title; 83 return title;
83 else 84 else
84 return [NSString stringWithFormat:@"%@\n%@", title, url]; 85 return [NSString stringWithFormat:@"%@\n%@", title, url];
85 } 86 }
86 87
87 const base::Feature kExperimentalMacRTL{"ExperimentalMacRTL",
88 base::FEATURE_DISABLED_BY_DEFAULT};
89
90 bool ShouldDoExperimentalRTLLayout() { 88 bool ShouldDoExperimentalRTLLayout() {
91 return base::i18n::IsRTL() && 89 return base::i18n::IsRTL() && base::FeatureList::IsEnabled(features::kMacRTL);
92 base::FeatureList::IsEnabled(kExperimentalMacRTL);
93 } 90 }
94 91
95 bool ShouldFlipWindowControlsInRTL() { 92 bool ShouldFlipWindowControlsInRTL() {
96 return ShouldDoExperimentalRTLLayout() && base::mac::IsAtLeastOS10_12(); 93 return ShouldDoExperimentalRTLLayout() && base::mac::IsAtLeastOS10_12();
97 } 94 }
98 95
99 // TODO(lgrey): Remove these when all builds are on 10.12 SDK. 96 // TODO(lgrey): Remove these when all builds are on 10.12 SDK.
100 #if defined(MAC_OS_X_VERSION_10_12) && \ 97 #if defined(MAC_OS_X_VERSION_10_12) && \
101 (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12) 98 (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12)
102 #warning LeadingCellImagePosition/TrailingCellImagePosition \ 99 #warning LeadingCellImagePosition/TrailingCellImagePosition \
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 fromRect:NSMakeRect(0, 0, size.width, size.height) 135 fromRect:NSMakeRect(0, 0, size.width, size.height)
139 operation:NSCompositeSourceOver 136 operation:NSCompositeSourceOver
140 fraction:1.0]; 137 fraction:1.0];
141 138
142 [flipped_image unlockFocus]; 139 [flipped_image unlockFocus];
143 140
144 return flipped_image; 141 return flipped_image;
145 } 142 }
146 143
147 } // namespace cocoa_l10n_util 144 } // namespace cocoa_l10n_util
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/l10n_util.h ('k') | chrome/browser/ui/cocoa/test/scoped_force_rtl_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698