| 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..41b6c1fd15107a9fd00a08f37ae725934f2ecb1c 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/command_line.h"
|
| #include "base/path_service.h"
|
| +#include "ios/web_view/internal/app/application_context_impl.h"
|
| #include "ui/base/l10n/l10n_util_mac.h"
|
| #include "ui/base/resource/resource_bundle.h"
|
|
|
| @@ -18,15 +17,17 @@
|
|
|
| namespace ios_web_view {
|
|
|
| -WebViewWebMainParts::WebViewWebMainParts() {}
|
| +WebViewWebMainParts::WebViewWebMainParts(
|
| + const base::CommandLine& parsed_command_line)
|
| + : parsed_command_line_(parsed_command_line) {}
|
|
|
| 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 +35,24 @@ void WebViewWebMainParts::PreMainMessageLoopRun() {
|
| pak_file, ui::SCALE_FACTOR_NONE);
|
| }
|
|
|
| +void WebViewWebMainParts::PreCreateThreads() {
|
| + application_context_.reset(new ApplicationContextImpl(
|
| + parsed_command_line_, l10n_util::GetLocaleOverride()));
|
| + DCHECK_EQ(application_context_.get(), GetApplicationContext());
|
| +
|
| + // Initialize local state.
|
| + DCHECK(application_context_->GetLocalState());
|
| +
|
| + application_context_->PreCreateThreads();
|
| +}
|
| +
|
| +void WebViewWebMainParts::PostMainMessageLoopRun() {
|
| + // TODO(crbug.com/723869): Shutdown translate.
|
| + application_context_->SaveState();
|
| +}
|
| +
|
| +void WebViewWebMainParts::PostDestroyThreads() {
|
| + application_context_->PostDestroyThreads();
|
| +}
|
| +
|
| } // namespace ios_web_view
|
|
|