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

Side by Side Diff: ios/web_view/public/cwv_translation_controller.h

Issue 2983453002: Expose way to enable/disable translate. (Closed)
Patch Set: addressed michaeldo's comments Created 3 years, 5 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
« no previous file with comments | « ios/web_view/public/cwv_preferences.h ('k') | ios/web_view/public/cwv_web_view_configuration.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef IOS_WEB_VIEW_PUBLIC_CWV_TRANSLATION_CONTROLLER_H 5 #ifndef IOS_WEB_VIEW_PUBLIC_CWV_TRANSLATION_CONTROLLER_H
6 #define IOS_WEB_VIEW_PUBLIC_CWV_TRANSLATION_CONTROLLER_H 6 #define IOS_WEB_VIEW_PUBLIC_CWV_TRANSLATION_CONTROLLER_H
7 7
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 9
10 #import "cwv_export.h" 10 #import "cwv_export.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 @interface CWVTranslationController : NSObject 45 @interface CWVTranslationController : NSObject
46 46
47 // Delegate to receive translation callbacks. 47 // Delegate to receive translation callbacks.
48 @property(nullable, nonatomic, weak) id<CWVTranslationControllerDelegate> 48 @property(nullable, nonatomic, weak) id<CWVTranslationControllerDelegate>
49 delegate; 49 delegate;
50 50
51 // The set of supported languages for translation. 51 // The set of supported languages for translation.
52 @property(nonatomic, readonly) 52 @property(nonatomic, readonly)
53 NSSet<CWVTranslationLanguage*>* supportedLanguages; 53 NSSet<CWVTranslationLanguage*>* supportedLanguages;
54 54
55 // Resets all translation policies to default (CWVTranslationPolicyAsk).
56 // Only resets non-incognito settings.
57 + (void)resetTranslationPolicies;
58
59 // Begins translation on the current page from |sourceLanguage| to 55 // Begins translation on the current page from |sourceLanguage| to
60 // |targetLanguage|. These language parameters must be chosen from 56 // |targetLanguage|. These language parameters must be chosen from
61 // |supportedLanguages|. Set |userInitiated| to YES if translation 57 // |supportedLanguages|. Set |userInitiated| to YES if translation
62 // is a result of explicit user action. |userInitiated| will be 58 // is a result of explicit user action. |userInitiated| will be
63 // passed along to the CWVTranslationControllerDelegate methods. 59 // passed along to the CWVTranslationControllerDelegate methods.
64 // Results in a No-op if there is no current page. 60 // Results in a No-op if there is no current page.
65 - (void)translatePageFromLanguage:(CWVTranslationLanguage*)sourceLanguage 61 - (void)translatePageFromLanguage:(CWVTranslationLanguage*)sourceLanguage
66 toLanguage:(CWVTranslationLanguage*)targetLanguage 62 toLanguage:(CWVTranslationLanguage*)targetLanguage
67 userInitiated:(BOOL)userInitiated; 63 userInitiated:(BOOL)userInitiated;
68 64
69 // Reverts any translations done back to the original page language. 65 // Reverts any translations done back to the original page language.
70 // Note that the original page language may be different from |sourceLanguage| 66 // Note that the original page language may be different from |sourceLanguage|
71 // passed to |translatePageFromLanguage:toLanguage:userInitiated:| above. 67 // passed to |translatePageFromLanguage:toLanguage:userInitiated:| above.
72 // Results in No-op if the page was never translated. 68 // Results in No-op if the page was never translated.
73 - (void)revertTranslation; 69 - (void)revertTranslation;
74 70
75 // Sets or retrieves translation policies associated with a specified language. 71 // Sets or retrieves translation policies associated with a specified language.
76 // |pageLanguage| should be the language code of the language. 72 // |pageLanguage| should be the language code of the language.
77 // Not supported in incognito mode.
78 - (void)setTranslationPolicy:(CWVTranslationPolicy*)policy 73 - (void)setTranslationPolicy:(CWVTranslationPolicy*)policy
79 forPageLanguage:(CWVTranslationLanguage*)pageLanguage; 74 forPageLanguage:(CWVTranslationLanguage*)pageLanguage;
80 - (CWVTranslationPolicy*)translationPolicyForPageLanguage: 75 - (CWVTranslationPolicy*)translationPolicyForPageLanguage:
81 (CWVTranslationLanguage*)pageLanguage; 76 (CWVTranslationLanguage*)pageLanguage;
82 77
83 // Sets or retrieves translation policies associated with a specified page. 78 // Sets or retrieves translation policies associated with a specified page.
84 // |pageHost| should be the hostname of the website. Must not be empty. 79 // |pageHost| should be the hostname of the website. Must not be empty.
85 // Not supported in incognito mode.
86 - (void)setTranslationPolicy:(CWVTranslationPolicy*)policy 80 - (void)setTranslationPolicy:(CWVTranslationPolicy*)policy
87 forPageHost:(NSString*)pageHost; 81 forPageHost:(NSString*)pageHost;
88 - (CWVTranslationPolicy*)translationPolicyForPageHost:(NSString*)pageHost; 82 - (CWVTranslationPolicy*)translationPolicyForPageHost:(NSString*)pageHost;
89 83
90 @end 84 @end
91 85
92 NS_ASSUME_NONNULL_END 86 NS_ASSUME_NONNULL_END
93 87
94 #endif // IOS_WEB_VIEW_PUBLIC_CWV_TRANSLATION_CONTROLLER_H 88 #endif // IOS_WEB_VIEW_PUBLIC_CWV_TRANSLATION_CONTROLLER_H
OLDNEW
« no previous file with comments | « ios/web_view/public/cwv_preferences.h ('k') | ios/web_view/public/cwv_web_view_configuration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698