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

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

Issue 2555033003: Add ScopedMacRTL class for Cocoa browser RTL testing (Closed)
Patch Set: Whitespace 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/test/scoped_mac_rtl.h ('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>
tapted 2016/12/07 23:20:27 nit: NSUserDefaults is in <Foundation/Foundation.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
19
20 namespace ui {
21
22 ScopedEnableMacRTLLayout::ScopedEnableMacRTLLayout() {
23 scoped_feature_list_.InitAndEnableFeature(ui::kExperimentalMacRTL);
tapted 2016/12/07 23:20:27 nit: remove `ui::`
24 NSUserDefaults* standard_defaults = [NSUserDefaults standardUserDefaults];
25 original_apple_text_direction_ =
26 [standard_defaults boolForKey:kAppleTextDirectionDefaultsKey];
27 original_rtl_writing_direction_ =
28 [standard_defaults boolForKey:kForceRTLWritingDirectionDefaultsKey];
29 [standard_defaults setBool:YES forKey:kAppleTextDirectionDefaultsKey];
30 [standard_defaults setBool:YES forKey:kForceRTLWritingDirectionDefaultsKey];
31 original_locale_ = base::i18n::GetConfiguredLocale();
32 base::i18n::SetICUDefaultLocale("he");
tapted 2016/12/07 23:20:27 "he" looked really weird the first time I saw it b
33 }
34
35 ScopedEnableMacRTLLayout::~ScopedEnableMacRTLLayout() {
36 [[NSUserDefaults standardUserDefaults]
37 setBool:original_apple_text_direction_
38 forKey:kAppleTextDirectionDefaultsKey];
39 [[NSUserDefaults standardUserDefaults]
40 setBool:original_rtl_writing_direction_
41 forKey:kForceRTLWritingDirectionDefaultsKey];
42 base::i18n::SetICUDefaultLocale(original_locale_);
43 }
44
45 } // namespace ui
OLDNEW
« ui/base/test/scoped_mac_rtl.h ('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