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

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

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
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 <ChromeWebView/cwv_export.h> 8 #import <ChromeWebView/cwv_export.h>
9 #import <Foundation/Foundation.h> 9 #import <Foundation/Foundation.h>
10 10
11 NS_ASSUME_NONNULL_BEGIN 11 NS_ASSUME_NONNULL_BEGIN
12 12
13 @class CWVTranslationLanguage; 13 @class CWVTranslationLanguage;
14 @class CWVTranslationPolicy;
14 @protocol CWVTranslationControllerDelegate; 15 @protocol CWVTranslationControllerDelegate;
15 16
16 // The error domain for translation errors. 17 // The error domain for translation errors.
17 extern NSErrorDomain const CWVTranslationErrorDomain; 18 extern NSErrorDomain const CWVTranslationErrorDomain;
18 19
19 // Possible error codes during translation. 20 // Possible error codes during translation.
20 // No connectivity. 21 // No connectivity.
21 extern const NSInteger CWVTranslationErrorNetwork; 22 extern const NSInteger CWVTranslationErrorNetwork;
22 // The translation script failed to initialize. 23 // The translation script failed to initialize.
23 extern const NSInteger CWVTranslationErrorInitializationError; 24 extern const NSInteger CWVTranslationErrorInitializationError;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 toLanguage:(CWVTranslationLanguage*)targetLanguage; 58 toLanguage:(CWVTranslationLanguage*)targetLanguage;
58 59
59 // Reverts any translations done back to the original page language. 60 // Reverts any translations done back to the original page language.
60 // Note that the original page language may be different from |sourceLanguage| 61 // Note that the original page language may be different from |sourceLanguage|
61 // passed to |translatePageFromLanguage:toLanguage:| above. 62 // passed to |translatePageFromLanguage:toLanguage:| above.
62 // This must not be called before the |delegate| receives 63 // This must not be called before the |delegate| receives
63 // |translationController:didFinishLanguageDetectionWithResult:error:|. 64 // |translationController:didFinishLanguageDetectionWithResult:error:|.
64 // TODO(crbug.com/706289): Document what happens if you call this out of order. 65 // TODO(crbug.com/706289): Document what happens if you call this out of order.
65 - (void)revertTranslation; 66 - (void)revertTranslation;
66 67
68 // Sets or retrieves translation policies associated with a specified language.
69 // |pageLanguage| should be the language code of the language.
Eugene But (OOO till 7-30) 2017/05/12 14:39:20 Do you want to use nullable annotations? Please do
jzw1 2017/05/15 02:43:31 The entire thing is wrapped in assume nonnull, whi
70 - (void)setTranslationPolicy:(CWVTranslationPolicy*)policy
71 forPageLanguage:(CWVTranslationLanguage*)pageLanguage;
72 - (CWVTranslationPolicy*)translationPolicyForPageLanguage:
73 (CWVTranslationLanguage*)pageLanguage;
74
75 // Sets or retrieves translation policies associated with a specified page.
76 // |pageHost| should be the hostname of the website.
77 - (void)setTranslationPolicy:(CWVTranslationPolicy*)policy
78 forPageHost:(NSString*)pageHost;
79 - (CWVTranslationPolicy*)translationPolicyForPageHost:(NSString*)pageHost;
80
67 @end 81 @end
68 82
69 NS_ASSUME_NONNULL_END 83 NS_ASSUME_NONNULL_END
70 84
71 #endif // IOS_WEB_VIEW_PUBLIC_CWV_TRANSLATION_CONTROLLER_H 85 #endif // IOS_WEB_VIEW_PUBLIC_CWV_TRANSLATION_CONTROLLER_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698