Chromium Code Reviews| Index: ios/web_view/public/cwv_translation_policy.h |
| diff --git a/ios/web_view/public/cwv_translation_policy.h b/ios/web_view/public/cwv_translation_policy.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..79c8cd473a2b9037f5d630fd9d258b31e1e3f16d |
| --- /dev/null |
| +++ b/ios/web_view/public/cwv_translation_policy.h |
| @@ -0,0 +1,43 @@ |
| +// 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. |
| + |
| +#ifndef IOS_WEB_VIEW_PUBLIC_CWV_TRANSLATION_POLICY_H |
| +#define IOS_WEB_VIEW_PUBLIC_CWV_TRANSLATION_POLICY_H |
| + |
| +#import <ChromeWebView/cwv_export.h> |
| +#import <Foundation/Foundation.h> |
| + |
| +NS_ASSUME_NONNULL_BEGIN |
| + |
| +@class CWVTranslationLanguage; |
| + |
| +typedef NS_ENUM(NSInteger, CWVTranslationPolicyType) { |
| + 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.
|
| + CWVTranslationPolicyNever, // Never translate. |
| + CWVTranslationPolicyAuto // Automatically translate according to policy. |
| +}; |
| + |
| +// Represents a translation policy that can associated with another object like |
| +// a language or website hostname. |
| +CWV_EXPORT |
| +@interface CWVTranslationPolicy : NSObject |
| + |
| +// 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.
|
| ++ (CWVTranslationPolicy*)translationPolicyAsk; |
| ++ (CWVTranslationPolicy*)translationPolicyNever; |
| ++ (CWVTranslationPolicy*)translationPolicyAutoTranslateToLanguage: |
| + (CWVTranslationLanguage*)language; |
| + |
| +// Policy type. |
| +@property(nonatomic, readonly) CWVTranslationPolicyType type; |
| + |
|
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.
|
| +// Indicates the target language to automatically translate to. |
| +// 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.
|
| +@property(nonatomic, readonly) CWVTranslationLanguage* language; |
| + |
| +@end |
| + |
| +NS_ASSUME_NONNULL_END |
| + |
| +#endif // IOS_WEB_VIEW_PUBLIC_CWV_TRANSLATION_POLICY_H |