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

Side by Side Diff: ios/web_view/internal/translate/cwv_translation_policy.mm

Issue 2872083003: Added translation policy API. (Closed)
Patch Set: addressed michael and eugene comments 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 unified diff | Download patch
OLDNEW
(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 #import "ios/web_view/public/cwv_translation_policy.h"
6
7 #import "ios/web_view/public/cwv_translation_language.h"
8
9 #if !defined(__has_feature) || !__has_feature(objc_arc)
10 #error "This file requires ARC support."
11 #endif
12
13 @interface CWVTranslationPolicy ()
14 // Redefined to allow setters for private use.
15 @property(nonatomic, assign) CWVTranslationPolicyType type;
16 @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.
17 @end
18
19 @implementation CWVTranslationPolicy
20
21 @synthesize language = _language;
22 @synthesize type = _type;
23
24 + (CWVTranslationPolicy*)translationPolicyAsk {
25 CWVTranslationPolicy* policy = [[CWVTranslationPolicy alloc] init];
26 policy.type = CWVTranslationPolicyAsk;
27 return policy;
28 }
29
30 + (CWVTranslationPolicy*)translationPolicyNever {
31 CWVTranslationPolicy* policy = [[CWVTranslationPolicy alloc] init];
32 policy.type = CWVTranslationPolicyNever;
33 return policy;
34 }
35
36 + (CWVTranslationPolicy*)translationPolicyAutoTranslateToLanguage:
37 (CWVTranslationLanguage*)language {
38 CWVTranslationPolicy* policy = [[CWVTranslationPolicy alloc] init];
39 policy.type = CWVTranslationPolicyAuto;
40 policy.language = language;
41 return policy;
42 }
43
44 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698