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

Side by Side Diff: ui/base/test/scoped_mac_rtl.mm

Issue 2555033003: Add ScopedMacRTL class for Cocoa browser RTL testing (Closed)
Patch Set: Review comments Created 4 years 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
« ui/base/cocoa/rtl_feature.mm ('K') | « ui/base/test/scoped_mac_rtl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/base/test/scoped_mac_rtl.h"
6
7 #import <Cocoa/Cocoa.h>
8
9 #include "base/i18n/rtl.h"
10 #include "ui/base/cocoa/rtl_feature.h"
11
12 namespace {
13
14 NSString* const kAppleTextDirectionDefaultsKey = @"AppleTextDirection";
15 NSString* const kForceRTLWritingDirectionDefaultsKey =
16 @"NSForceRightToLeftWritingDirection";
17
18 } // namespace
Robert Sesek 2016/12/07 19:21:01 nit: blank line after
lgrey 2016/12/07 19:34:21 Done.
19 namespace ui {
20
21 ScopedEnableMacRTLLayout::ScopedEnableMacRTLLayout() {
22 scoped_feature_list_.InitAndEnableFeature(ui::kExperimentalMacRTL);
23 NSUserDefaults* standard_defaults = [NSUserDefaults standardUserDefaults];
24 original_apple_text_direction_ =
25 [standard_defaults boolForKey:kAppleTextDirectionDefaultsKey];
26 original_rtl_writing_direction_ =
27 [standard_defaults boolForKey:kForceRTLWritingDirectionDefaultsKey];
28 [standard_defaults setBool:YES forKey:kAppleTextDirectionDefaultsKey];
29 [standard_defaults setBool:YES forKey:kForceRTLWritingDirectionDefaultsKey];
30 original_locale_ = base::i18n::GetConfiguredLocale();
31 base::i18n::SetICUDefaultLocale("he");
32 }
Robert Sesek 2016/12/07 19:21:01 nit: blank line after
lgrey 2016/12/07 19:34:21 Done.
33 ScopedEnableMacRTLLayout::~ScopedEnableMacRTLLayout() {
34 [[NSUserDefaults standardUserDefaults]
35 setBool:original_apple_text_direction_
36 forKey:kAppleTextDirectionDefaultsKey];
37 [[NSUserDefaults standardUserDefaults]
38 setBool:original_rtl_writing_direction_
39 forKey:kForceRTLWritingDirectionDefaultsKey];
40 base::i18n::SetICUDefaultLocale(original_locale_);
41 }
42
43 } // namespace ui
OLDNEW
« ui/base/cocoa/rtl_feature.mm ('K') | « ui/base/test/scoped_mac_rtl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698