Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: ios/web_view/public/cwv_translation_policy.h

Issue 2872083003: Added translation policy API. (Closed)
Patch Set: added page host translation policies Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..a6c8f4382a75c4b554d2530877a2f76452fb92bf
--- /dev/null
+++ b/ios/web_view/public/cwv_translation_policy.h
@@ -0,0 +1,42 @@
+// 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.
+ 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.
++ (CWVTranslationPolicy*)translationPolicyAsk;
++ (CWVTranslationPolicy*)translationPolicyNever;
++ (CWVTranslationPolicy*)translationPolicyAutoTranslateToLanguage:
+ (CWVTranslationLanguage*)language;
+
+// Policy type.
+@property(nonatomic, readonly) CWVTranslationPolicyType type;
+
+// Nil unless |type| is CWVTranslationPolicyAuto.
Hiroshi Ichikawa 2017/05/10 08:36:56 Can you add a comment that this is the language it
jzw1 2017/05/11 03:03:17 I'll just add some cmoments.
+@property(nonatomic, readonly) CWVTranslationLanguage* language;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif // IOS_WEB_VIEW_PUBLIC_CWV_TRANSLATION_POLICY_H

Powered by Google App Engine
This is Rietveld 408576698