| 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 17ed9e99831dac924f91ad294a7bd0d3526293d2..26c2df5564829cae7dce1438f99e6f1241a67607 100644
|
| --- a/ios/web_view/internal/translate/cwv_translation_controller.mm
|
| +++ b/ios/web_view/internal/translate/cwv_translation_controller.mm
|
| @@ -11,6 +11,7 @@
|
| #include "base/strings/sys_string_conversions.h"
|
| #include "components/translate/core/browser/translate_download_manager.h"
|
| #include "components/translate/core/browser/translate_manager.h"
|
| +#include "components/translate/core/browser/translate_pref_names.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"
|
| @@ -79,6 +80,22 @@ const NSInteger CWVTranslationErrorScriptLoadError =
|
| translatePrefs.ResetToDefaults();
|
| }
|
|
|
| ++ (BOOL)isTranslateEnabled {
|
| + CWVWebViewConfiguration* configuration =
|
| + [CWVWebViewConfiguration defaultConfiguration];
|
| + PrefService* prefService = configuration.browserState->GetPrefs();
|
| + translate::TranslatePrefs translatePrefs(prefService, prefs::kAcceptLanguages,
|
| + nullptr);
|
| + return translatePrefs.IsEnabled();
|
| +}
|
| +
|
| ++ (void)setTranslateEnabled:(BOOL)enabled {
|
| + CWVWebViewConfiguration* configuration =
|
| + [CWVWebViewConfiguration defaultConfiguration];
|
| + PrefService* prefService = configuration.browserState->GetPrefs();
|
| + prefService->SetBoolean(prefs::kEnableTranslate, enabled);
|
| +}
|
| +
|
| #pragma mark - Internal Methods
|
|
|
| - (void)setWebState:(web::WebState*)webState {
|
|
|