| OLD | NEW |
| 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" | |
| 8 #include "base/mac/mac_util.h" | |
| 9 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 11 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" | 9 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" |
| 12 | 10 |
| 13 namespace cocoa_l10n_util { | 11 namespace cocoa_l10n_util { |
| 14 | 12 |
| 15 NSInteger CompareFrameY(id view1, id view2, void* context) { | 13 NSInteger CompareFrameY(id view1, id view2, void* context) { |
| 16 CGFloat y1 = NSMinY([view1 frame]); | 14 CGFloat y1 = NSMinY([view1 frame]); |
| 17 CGFloat y2 = NSMinY([view2 frame]); | 15 CGFloat y2 = NSMinY([view2 frame]); |
| 18 if (y1 < y2) | 16 if (y1 < y2) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 75 |
| 78 NSString* TooltipForURLAndTitle(NSString* url, NSString* title) { | 76 NSString* TooltipForURLAndTitle(NSString* url, NSString* title) { |
| 79 if ([title length] == 0) | 77 if ([title length] == 0) |
| 80 return url; | 78 return url; |
| 81 else if ([url length] == 0 || [url isEqualToString:title]) | 79 else if ([url length] == 0 || [url isEqualToString:title]) |
| 82 return title; | 80 return title; |
| 83 else | 81 else |
| 84 return [NSString stringWithFormat:@"%@\n%@", title, url]; | 82 return [NSString stringWithFormat:@"%@\n%@", title, url]; |
| 85 } | 83 } |
| 86 | 84 |
| 87 const base::Feature kExperimentalMacRTL{"ExperimentalMacRTL", | |
| 88 base::FEATURE_DISABLED_BY_DEFAULT}; | |
| 89 | |
| 90 bool ShouldDoExperimentalRTLLayout() { | |
| 91 return base::i18n::IsRTL() && | |
| 92 base::FeatureList::IsEnabled(kExperimentalMacRTL); | |
| 93 } | |
| 94 | |
| 95 bool ShouldFlipWindowControlsInRTL() { | |
| 96 return ShouldDoExperimentalRTLLayout() && base::mac::IsAtLeastOS10_12(); | |
| 97 } | |
| 98 | |
| 99 } // namespace cocoa_l10n_util | 85 } // namespace cocoa_l10n_util |
| OLD | NEW |