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

Unified Diff: ios/web_view/internal/translate/cwv_translation_controller.mm

Issue 2965303002: Expose method to reset translate settings. (Closed)
Patch Set: move to class method 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 side-by-side diff with in-line comments
Download patch
Index: ios/web_view/internal/translate/cwv_translation_controller.mm
diff --git a/ios/web_view/internal/translate/cwv_translation_controller.mm b/ios/web_view/internal/translate/cwv_translation_controller.mm
index c62a8680ebdcd0ba3acbb29eda254f5df42185f6..5f680e65bcbc90ae55ce25cc53384a079f98a861 100644
--- a/ios/web_view/internal/translate/cwv_translation_controller.mm
+++ b/ios/web_view/internal/translate/cwv_translation_controller.mm
@@ -11,8 +11,11 @@
#include "base/strings/sys_string_conversions.h"
#include "components/translate/core/browser/translate_download_manager.h"
#include "components/translate/core/browser/translate_manager.h"
+#import "ios/web_view/internal/cwv_web_view_configuration_internal.h"
+#include "ios/web_view/internal/pref_names.h"
#import "ios/web_view/internal/translate/cwv_translation_language_internal.h"
#import "ios/web_view/internal/translate/web_view_translate_client.h"
+#include "ios/web_view/internal/web_view_browser_state.h"
#import "ios/web_view/public/cwv_translation_controller_delegate.h"
#import "ios/web_view/public/cwv_translation_policy.h"
#include "ui/base/l10n/l10n_util.h"
@@ -65,6 +68,16 @@ const NSInteger CWVTranslationErrorScriptLoadError =
@synthesize supportedLanguagesByCode = _supportedLanguagesByCode;
@synthesize webState = _webState;
+#pragma mark - Class Methods
+
++ (void)resetTranslationPolicies {
+ ios_web_view::WebViewBrowserState* browserState =
+ [CWVWebViewConfiguration defaultConfiguration].browserState;
michaeldo 2017/07/07 18:16:01 Sorry I didn't think of this before, but will this
Eugene But (OOO till 7-30) 2017/07/07 20:10:28 What if clients want to reset policies for incogni
jzw1 2017/07/08 01:09:41 OK guys I've changed it so: 1. global instance for
Eugene But (OOO till 7-30) 2017/07/10 16:17:43 All methods related to translate policies are inst
jzw1 2017/07/10 18:51:40 The reason is because you can't get to an instance
+ translate::TranslatePrefs translatePrefs(browserState->GetPrefs(),
+ prefs::kAcceptLanguages, nullptr);
+ translatePrefs.ResetToDefaults();
+}
+
#pragma mark - Internal Methods
- (void)setWebState:(web::WebState*)webState {
« no previous file with comments | « ios/web_view/internal/cwv_web_view_configuration.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