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

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

Issue 2555033003: Add ScopedMacRTL class for Cocoa browser RTL testing (Closed)
Patch Set: Add to deps AFTER deps exists 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 #include "base/i18n/rtl.h"
8 #include "ui/base/cocoa/rtl_util.h"
9
10 namespace {
11 NSString* const kAppleTextDirectionDefaultsKey = @"AppleTextDirection";
12 NSString* const kForceRTLWritingDirectionDefaultsKey =
13 @"NSForceRightToLeftWritingDirection";
14 } // namespace
Robert Sesek 2016/12/07 16:09:59 nit: blank line after
15 namespace cocoa_rtl_util {
Robert Sesek 2016/12/07 16:09:59 nit: blank lines around inside of the namespace
16 ScopedMacRTL::ScopedMacRTL() {
17 scoped_feature_list_.InitAndEnableFeature(
18 cocoa_rtl_util::kExperimentalMacRTL);
19 NSUserDefaults* standard_defaults = [NSUserDefaults standardUserDefaults];
20 original_apple_text_direction_ =
21 [standard_defaults boolForKey:kAppleTextDirectionDefaultsKey];
22 original_rtl_writing_direction_ =
23 [standard_defaults boolForKey:kForceRTLWritingDirectionDefaultsKey];
24 [standard_defaults setBool:YES forKey:kAppleTextDirectionDefaultsKey];
25 [standard_defaults setBool:YES forKey:kForceRTLWritingDirectionDefaultsKey];
26 original_locale_ = base::i18n::GetConfiguredLocale();
27 base::i18n::SetICUDefaultLocale("he");
28 }
Robert Sesek 2016/12/07 16:09:59 nit: blank line after
29 ScopedMacRTL::~ScopedMacRTL() {
30 [[NSUserDefaults standardUserDefaults]
31 setBool:original_apple_text_direction_
32 forKey:kAppleTextDirectionDefaultsKey];
33 [[NSUserDefaults standardUserDefaults]
34 setBool:original_rtl_writing_direction_
35 forKey:kForceRTLWritingDirectionDefaultsKey];
36 base::i18n::SetICUDefaultLocale(original_locale_);
37 }
38
39 } // namespace cocoa_rtl_util
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