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

Side by Side Diff: ios/web_view/internal/cwv_preferences.mm

Issue 2983453002: Expose way to enable/disable translate. (Closed)
Patch Set: addressed michaeldo's comments Created 3 years, 5 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
« no previous file with comments | « ios/web_view/BUILD.gn ('k') | ios/web_view/internal/cwv_preferences_internal.h » ('j') | 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 2017 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 #import "ios/web_view/internal/cwv_preferences_internal.h"
6
7 #include "components/prefs/pref_service.h"
8 #include "components/translate/core/browser/translate_pref_names.h"
9 #include "components/translate/core/browser/translate_prefs.h"
10 #include "ios/web_view/internal/pref_names.h"
11
12 #if !defined(__has_feature) || !__has_feature(objc_arc)
13 #error "This file requires ARC support."
14 #endif
15
16 @implementation CWVPreferences {
17 PrefService* _prefService;
18 }
19
20 - (instancetype)initWithPrefService:(PrefService*)prefService {
21 self = [super init];
22 if (self) {
23 _prefService = prefService;
24 }
25 return self;
26 }
27
28 #pragma mark - Public Methods
29
30 - (void)setTranslationEnabled:(BOOL)enabled {
31 _prefService->SetBoolean(prefs::kEnableTranslate, enabled);
32 }
33
34 - (BOOL)isTranslationEnabled {
35 return _prefService->GetBoolean(prefs::kEnableTranslate);
36 }
37
38 - (void)resetTranslationSettings {
39 translate::TranslatePrefs translatePrefs(
40 _prefService, prefs::kAcceptLanguages,
41 /*preferred_languages_pref=*/nullptr);
42 translatePrefs.ResetToDefaults();
43 }
44
45 @end
OLDNEW
« no previous file with comments | « ios/web_view/BUILD.gn ('k') | ios/web_view/internal/cwv_preferences_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698