OLD | NEW |
---|---|
(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/public/cwv_translation_configuration.h" | |
6 #import "ios/web_view/internal/translate/cwv_translation_configuration_internal. h" | |
7 | |
8 #include "components/prefs/pref_service.h" | |
9 #include "components/translate/core/browser/translate_pref_names.h" | |
10 #include "components/translate/core/browser/translate_prefs.h" | |
11 #include "ios/web_view/internal/pref_names.h" | |
12 | |
13 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
14 #error "This file requires ARC support." | |
15 #endif | |
16 | |
17 @implementation CWVTranslationConfiguration { | |
18 PrefService* _prefService; | |
19 } | |
20 | |
21 @dynamic enabled; | |
22 | |
23 - (instancetype)initWithPrefService:(PrefService*)prefService { | |
24 self = [super init]; | |
25 if (self) { | |
26 _prefService = prefService; | |
27 } | |
28 return self; | |
29 } | |
30 | |
31 #pragma mark - Public Methods | |
32 | |
33 - (void)setEnabled:(BOOL)enabled { | |
34 _prefService->SetBoolean(prefs::kEnableTranslate, enabled); | |
35 } | |
36 | |
37 - (BOOL)enabled { | |
38 return _prefService->GetBoolean(prefs::kEnableTranslate); | |
39 } | |
40 | |
41 - (void)reset { | |
42 translate::TranslatePrefs translatePrefs(_prefService, | |
43 prefs::kAcceptLanguages, nullptr); | |
Eugene But (OOO till 7-30)
2017/07/14 00:22:42
nit: Do you want to document nullptr with comments
jzw1
2017/07/14 02:09:49
I think it's OK to omit. The initializer in transl
Hiroshi Ichikawa
2017/07/14 02:55:49
No, it should be still commented. It can be like t
| |
44 translatePrefs.ResetToDefaults(); | |
45 } | |
46 | |
47 @end | |
OLD | NEW |