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

Unified Diff: ios/web_view/internal/web_view_web_main_parts.mm

Issue 2894483003: Initialize ios/web_view translate with a system-wide URLRequestContext. (Closed)
Patch Set: Respond to 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web_view/internal/web_view_web_main_parts.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web_view/internal/web_view_web_main_parts.mm
diff --git a/ios/web_view/internal/web_view_web_main_parts.mm b/ios/web_view/internal/web_view_web_main_parts.mm
index 67218afe0a6b1b22d86720341b180db748916461..2551409151279a5295c299943edce6e0fb87f5f3 100644
--- a/ios/web_view/internal/web_view_web_main_parts.mm
+++ b/ios/web_view/internal/web_view_web_main_parts.mm
@@ -4,11 +4,10 @@
#import "ios/web_view/internal/web_view_web_main_parts.h"
-#import <Foundation/Foundation.h>
-
#include "base/base_paths.h"
-#include "base/memory/ptr_util.h"
#include "base/path_service.h"
+#include "ios/web_view/internal/app/application_context.h"
+#include "ios/web_view/internal/translate/web_view_translate_service.h"
#include "ui/base/l10n/l10n_util_mac.h"
#include "ui/base/resource/resource_bundle.h"
@@ -22,11 +21,11 @@ WebViewWebMainParts::WebViewWebMainParts() {}
WebViewWebMainParts::~WebViewWebMainParts() = default;
-void WebViewWebMainParts::PreMainMessageLoopRun() {
- // Initialize resources.
+void WebViewWebMainParts::PreMainMessageLoopStart() {
l10n_util::OverrideLocaleWithCocoaLocale();
ui::ResourceBundle::InitSharedInstanceWithLocale(
std::string(), nullptr, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES);
+
base::FilePath pak_file;
PathService::Get(base::DIR_MODULE, &pak_file);
pak_file = pak_file.Append(FILE_PATH_LITERAL("web_view_resources.pak"));
@@ -34,4 +33,25 @@ void WebViewWebMainParts::PreMainMessageLoopRun() {
pak_file, ui::SCALE_FACTOR_NONE);
}
+void WebViewWebMainParts::PreCreateThreads() {
+ // Initialize local state.
+ PrefService* local_state = ApplicationContext::GetInstance()->GetLocalState();
+ DCHECK(local_state);
+
+ ApplicationContext::GetInstance()->PreCreateThreads();
+}
+
+void WebViewWebMainParts::PreMainMessageLoopRun() {
+ WebViewTranslateService::GetInstance()->Initialize();
+}
+
+void WebViewWebMainParts::PostMainMessageLoopRun() {
+ WebViewTranslateService::GetInstance()->Shutdown();
+ ApplicationContext::GetInstance()->SaveState();
+}
+
+void WebViewWebMainParts::PostDestroyThreads() {
+ ApplicationContext::GetInstance()->PostDestroyThreads();
+}
+
} // namespace ios_web_view
« no previous file with comments | « ios/web_view/internal/web_view_web_main_parts.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698