Chromium Code Reviews| Index: ios/web_view/internal/translate/cwv_translation_policy.mm |
| diff --git a/ios/web_view/internal/translate/cwv_translation_policy.mm b/ios/web_view/internal/translate/cwv_translation_policy.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5c0f2711069332a5e54b49495c688825a68d4a71 |
| --- /dev/null |
| +++ b/ios/web_view/internal/translate/cwv_translation_policy.mm |
| @@ -0,0 +1,44 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#import "ios/web_view/public/cwv_translation_policy.h" |
| + |
| +#import "ios/web_view/public/cwv_translation_language.h" |
| + |
| +#if !defined(__has_feature) || !__has_feature(objc_arc) |
| +#error "This file requires ARC support." |
| +#endif |
| + |
| +@interface CWVTranslationPolicy () |
| +// Redefined to allow setters for private use. |
| +@property(nonatomic, assign) CWVTranslationPolicyType type; |
| +@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.
|
| +@end |
| + |
| +@implementation CWVTranslationPolicy |
| + |
| +@synthesize language = _language; |
| +@synthesize type = _type; |
| + |
| ++ (CWVTranslationPolicy*)translationPolicyAsk { |
| + CWVTranslationPolicy* policy = [[CWVTranslationPolicy alloc] init]; |
| + policy.type = CWVTranslationPolicyAsk; |
| + return policy; |
| +} |
| + |
| ++ (CWVTranslationPolicy*)translationPolicyNever { |
| + CWVTranslationPolicy* policy = [[CWVTranslationPolicy alloc] init]; |
| + policy.type = CWVTranslationPolicyNever; |
| + return policy; |
| +} |
| + |
| ++ (CWVTranslationPolicy*)translationPolicyAutoTranslateToLanguage: |
| + (CWVTranslationLanguage*)language { |
| + CWVTranslationPolicy* policy = [[CWVTranslationPolicy alloc] init]; |
| + policy.type = CWVTranslationPolicyAuto; |
| + policy.language = language; |
| + return policy; |
| +} |
| + |
| +@end |