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

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

Issue 2983453002: Expose way to enable/disable translate. (Closed)
Patch Set: comment non obvious param 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 17ed9e99831dac924f91ad294a7bd0d3526293d2..a5c03fd680674c8e39e60c9b6de8233be4794de0 100644
--- a/ios/web_view/internal/translate/cwv_translation_controller.mm
+++ b/ios/web_view/internal/translate/cwv_translation_controller.mm
@@ -12,10 +12,8 @@
#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"
@@ -68,17 +66,6 @@ const NSInteger CWVTranslationErrorScriptLoadError =
@synthesize supportedLanguagesByCode = _supportedLanguagesByCode;
@synthesize webState = _webState;
-#pragma mark - Class Methods
-
-+ (void)resetTranslationPolicies {
- CWVWebViewConfiguration* configuration =
- [CWVWebViewConfiguration defaultConfiguration];
- PrefService* prefService = configuration.browserState->GetPrefs();
- translate::TranslatePrefs translatePrefs(prefService, prefs::kAcceptLanguages,
- nullptr);
- translatePrefs.ResetToDefaults();
-}
-
#pragma mark - Internal Methods
- (void)setWebState:(web::WebState*)webState {
@@ -169,7 +156,6 @@ const NSInteger CWVTranslationErrorScriptLoadError =
- (void)setTranslationPolicy:(CWVTranslationPolicy*)policy
forPageLanguage:(CWVTranslationLanguage*)pageLanguage {
- DCHECK(!_webState->GetBrowserState()->IsOffTheRecord());
std::string languageCode = base::SysNSStringToUTF8(pageLanguage.languageCode);
switch (policy.type) {
case CWVTranslationPolicyAsk: {
@@ -213,7 +199,6 @@ const NSInteger CWVTranslationErrorScriptLoadError =
- (void)setTranslationPolicy:(CWVTranslationPolicy*)policy
forPageHost:(NSString*)pageHost {
- DCHECK(!_webState->GetBrowserState()->IsOffTheRecord());
DCHECK(pageHost.length);
switch (policy.type) {
case CWVTranslationPolicyAsk: {

Powered by Google App Engine
This is Rietveld 408576698