Chromium Code Reviews| 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_policy.h" | |
| 6 | |
| 7 #import "ios/web_view/public/cwv_translation_language.h" | |
| 8 | |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 10 #error "This file requires ARC support." | |
| 11 #endif | |
| 12 | |
| 13 @interface CWVTranslationPolicy () | |
| 14 // Redefined to allow setters for private use. | |
| 15 @property(nonatomic, assign) CWVTranslationPolicyType type; | |
| 16 @property(nonatomic, strong) CWVTranslationLanguage* language; | |
|
michaeldo
2017/05/12 15:29:09
please explicitly specify "readwrite" here
jzw1
2017/05/15 02:43:30
Done.
| |
| 17 @end | |
| 18 | |
| 19 @implementation CWVTranslationPolicy | |
| 20 | |
| 21 @synthesize language = _language; | |
| 22 @synthesize type = _type; | |
| 23 | |
| 24 + (CWVTranslationPolicy*)translationPolicyAsk { | |
| 25 CWVTranslationPolicy* policy = [[CWVTranslationPolicy alloc] init]; | |
| 26 policy.type = CWVTranslationPolicyAsk; | |
| 27 return policy; | |
| 28 } | |
| 29 | |
| 30 + (CWVTranslationPolicy*)translationPolicyNever { | |
| 31 CWVTranslationPolicy* policy = [[CWVTranslationPolicy alloc] init]; | |
| 32 policy.type = CWVTranslationPolicyNever; | |
| 33 return policy; | |
| 34 } | |
| 35 | |
| 36 + (CWVTranslationPolicy*)translationPolicyAutoTranslateToLanguage: | |
| 37 (CWVTranslationLanguage*)language { | |
| 38 CWVTranslationPolicy* policy = [[CWVTranslationPolicy alloc] init]; | |
| 39 policy.type = CWVTranslationPolicyAuto; | |
| 40 policy.language = language; | |
| 41 return policy; | |
| 42 } | |
| 43 | |
| 44 @end | |
| OLD | NEW |