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 = 1, // Prompt user on whether or not to translate. | |
| 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 - (instancetype)init NS_UNAVAILABLE; | |
|
Eugene But (OOO till 7-30)
2017/05/25 14:38:53
Sorry, for missing this earlier. Per Style Guide,
jzw1
2017/05/25 15:58:03
Done.
| |
| 27 | |
| 28 // Creates a policy with CWVTranslationPolicyAsk and null language. | |
| 29 + (CWVTranslationPolicy*)translationPolicyAsk; | |
| 30 // Creates a policy with CWVTranslationPolicyNever and null language. | |
| 31 + (CWVTranslationPolicy*)translationPolicyNever; | |
| 32 // Creates a policy with CWVTranslationPolicyAuto and the given language. | |
| 33 + (CWVTranslationPolicy*)translationPolicyAutoTranslateToLanguage: | |
| 34 (CWVTranslationLanguage*)language; | |
| 35 | |
| 36 // Policy type. | |
| 37 @property(nonatomic, readonly) CWVTranslationPolicyType type; | |
| 38 | |
| 39 // Indicates the target language to automatically translate to. | |
| 40 // It is nil unless |type| is CWVTranslationPolicyAuto. | |
| 41 @property(nonatomic, nullable, readonly) CWVTranslationLanguage* language; | |
| 42 | |
| 43 @end | |
| 44 | |
| 45 NS_ASSUME_NONNULL_END | |
| 46 | |
| 47 #endif // IOS_WEB_VIEW_PUBLIC_CWV_TRANSLATION_POLICY_H | |
| OLD | NEW |