Index: ios/web_view/internal/cwv_web_view_configuration.mm |
diff --git a/ios/web_view/internal/cwv_web_view_configuration.mm b/ios/web_view/internal/cwv_web_view_configuration.mm |
index bd677f49a2b86c7fd42172b5fcd52758f9a42243..70a72ead3816bcfce3eede3fa1ee88e2a52fe894 100644 |
--- a/ios/web_view/internal/cwv_web_view_configuration.mm |
+++ b/ios/web_view/internal/cwv_web_view_configuration.mm |
@@ -9,11 +9,11 @@ |
#include "base/threading/thread_restrictions.h" |
#include "components/translate/core/browser/translate_download_manager.h" |
#include "ios/web/public/app/web_main.h" |
+#include "ios/web_view/internal/app/application_context.h" |
#import "ios/web_view/internal/cwv_user_content_controller_internal.h" |
#import "ios/web_view/internal/web_view_browser_state.h" |
#import "ios/web_view/internal/web_view_web_client.h" |
#import "ios/web_view/internal/web_view_web_main_delegate.h" |
-#include "ui/base/l10n/l10n_util_mac.h" |
#if !defined(__has_feature) || !__has_feature(objc_arc) |
#error "This file requires ARC support." |
@@ -60,6 +60,15 @@ |
webMainDelegate = base::MakeUnique<ios_web_view::WebViewWebMainDelegate>(); |
web::WebMainParams params(webMainDelegate.get()); |
webMain = base::MakeUnique<web::WebMain>(params); |
+ |
+ // Initialize translate. |
+ translate::TranslateDownloadManager* downloadManager = |
+ translate::TranslateDownloadManager::GetInstance(); |
+ downloadManager->set_request_context( |
+ ios_web_view::GetApplicationContext()->GetSystemURLRequestContext()); |
+ downloadManager->set_application_locale( |
+ ios_web_view::GetApplicationContext()->GetApplicationLocale()); |
+ downloadManager->language_list()->SetResourceRequestsAllowed(true); |
}); |
} |
@@ -69,15 +78,6 @@ |
if (self) { |
_browserState = std::move(browserState); |
- // Initialize translate. |
- translate::TranslateDownloadManager* downloadManager = |
- translate::TranslateDownloadManager::GetInstance(); |
- // TODO(crbug.com/710948): Use global request context here. |
- downloadManager->set_request_context(_browserState->GetRequestContext()); |
- // TODO(crbug.com/679895): Bring up application locale correctly. |
- downloadManager->set_application_locale(l10n_util::GetLocaleOverride()); |
- downloadManager->language_list()->SetResourceRequestsAllowed(true); |
- |
_userContentController = |
[[CWVUserContentController alloc] initWithConfiguration:self]; |
} |