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 #ifndef IOS_WEB_VIEW_PUBLIC_CWV_TRANSLATION_POLICY_H | |
| 6 #define IOS_WEB_VIEW_PUBLIC_CWV_TRANSLATION_POLICY_H | |
| 7 | |
| 8 #import <ChromeWebView/cwv_export.h> | |
| 9 #import <Foundation/Foundation.h> | |
| 10 | |
| 11 NS_ASSUME_NONNULL_BEGIN | |
| 12 | |
| 13 @class CWVTranslationLanguage; | |
| 14 | |
| 15 typedef NS_ENUM(NSInteger, CWVTranslationPolicyType) { | |
| 16 CWVTranslationPolicyAsk, // Prompt user on whether or not to translate. | |
|
Eugene But (OOO till 7-30)
2017/05/11 15:48:59
nit: It's a good practice to initialize first enum
jzw1
2017/05/12 03:46:46
Done.
| |
| 17 CWVTranslationPolicyNever, // Never translate. | |
| 18 CWVTranslationPolicyAuto // Automatically translate according to policy. | |
| 19 }; | |
| 20 | |
| 21 // Represents a translation policy that can associated with another object like | |
| 22 // a language or website hostname. | |
| 23 CWV_EXPORT | |
| 24 @interface CWVTranslationPolicy : NSObject | |
| 25 | |
| 26 // Convenience constructors. | |
|
Eugene But (OOO till 7-30)
2017/05/11 15:48:59
Technically Objective-C does not have constructors
jzw1
2017/05/12 03:46:47
Done.
| |
| 27 + (CWVTranslationPolicy*)translationPolicyAsk; | |
| 28 + (CWVTranslationPolicy*)translationPolicyNever; | |
| 29 + (CWVTranslationPolicy*)translationPolicyAutoTranslateToLanguage: | |
| 30 (CWVTranslationLanguage*)language; | |
| 31 | |
| 32 // Policy type. | |
| 33 @property(nonatomic, readonly) CWVTranslationPolicyType type; | |
| 34 | |
|
Eugene But (OOO till 7-30)
2017/05/11 15:48:59
- (instancetype)init NS_UNAVAILABLE;
jzw1
2017/05/12 03:46:47
Is there a way to have this and still allow the im
michaeldo
2017/05/12 15:29:08
It should be defined here as unavailable. Usually
jzw1
2017/05/15 02:43:27
Sounds good. Thanks.
| |
| 35 // Indicates the target language to automatically translate to. | |
| 36 // Nil unless |type| is CWVTranslationPolicyAuto. | |
|
Eugene But (OOO till 7-30)
2017/05/11 15:48:59
nit: s/Nil/nil
Uppercase Nil is a real thing whic
jzw1
2017/05/12 03:46:47
Done.
Eugene But (OOO till 7-30)
2017/05/12 14:39:19
FYI: There is still uppercase Nil
jzw1
2017/05/15 02:43:27
Done.
| |
| 37 @property(nonatomic, readonly) CWVTranslationLanguage* language; | |
| 38 | |
| 39 @end | |
| 40 | |
| 41 NS_ASSUME_NONNULL_END | |
| 42 | |
| 43 #endif // IOS_WEB_VIEW_PUBLIC_CWV_TRANSLATION_POLICY_H | |
| OLD | NEW |