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

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

Issue 2872083003: Added translation policy API. (Closed)
Patch Set: sync 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 // Internal initializer.
15 - (instancetype)initWithType:(CWVTranslationPolicyType)type
16 language:(CWVTranslationLanguage*)language
17 NS_DESIGNATED_INITIALIZER;
18 @end
19
20 @implementation CWVTranslationPolicy
21
22 @synthesize language = _language;
23 @synthesize type = _type;
24
25 - (instancetype)initWithType:(CWVTranslationPolicyType)type
26 language:(CWVTranslationLanguage*)language {
27 self = [super init];
28 if (self) {
29 _type = type;
30 _language = language;
31 }
32 return self;
33 }
34
35 + (CWVTranslationPolicy*)translationPolicyAsk {
36 return [[CWVTranslationPolicy alloc] initWithType:CWVTranslationPolicyAsk
37 language:nil];
38 }
39
40 + (CWVTranslationPolicy*)translationPolicyNever {
41 return [[CWVTranslationPolicy alloc] initWithType:CWVTranslationPolicyNever
42 language:nil];
43 }
44
45 + (CWVTranslationPolicy*)translationPolicyAutoTranslateToLanguage:
46 (CWVTranslationLanguage*)language {
47 return [[CWVTranslationPolicy alloc] initWithType:CWVTranslationPolicyAuto
48 language:language];
49 }
50
51 @end
OLDNEW
« no previous file with comments | « ios/web_view/internal/translate/cwv_translation_language.mm ('k') | ios/web_view/public/cwv_translation_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698