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

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

Issue 2872083003: Added translation policy API. (Closed)
Patch Set: updated 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 @implementation CWVTranslationPolicy
14
15 @synthesize language = _language;
16 @synthesize type = _type;
17
18 + (CWVTranslationPolicy*)translationPolicyAsk {
19 CWVTranslationPolicy* policy = [[CWVTranslationPolicy alloc] init];
20 policy->_type = CWVTranslationPolicyAsk;
Eugene But (OOO till 7-30) 2017/05/11 15:48:59 alloc/init can return null and this will crash. Do
jzw1 2017/05/12 03:46:46 Done.
21 return policy;
22 }
23
24 + (CWVTranslationPolicy*)translationPolicyNever {
25 CWVTranslationPolicy* policy = [[CWVTranslationPolicy alloc] init];
26 policy->_type = CWVTranslationPolicyNever;
michaeldo 2017/05/11 23:51:33 Can you use synthesized setters instead? I don't k
jzw1 2017/05/12 03:46:46 Done.
27 return policy;
28 }
29
30 + (CWVTranslationPolicy*)translationPolicyAutoTranslateToLanguage:
31 (CWVTranslationLanguage*)language {
32 CWVTranslationPolicy* policy = [[CWVTranslationPolicy alloc] init];
33 policy->_type = CWVTranslationPolicyAuto;
34 policy->_language = language;
35 return policy;
36 }
37
38 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698