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

Side by Side 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: Remove unneeded deps. Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/web_view/internal/web_view_web_main_parts.h" 5 #import "ios/web_view/internal/web_view_web_main_parts.h"
6 6
7 #import <Foundation/Foundation.h>
8
9 #include "base/base_paths.h" 7 #include "base/base_paths.h"
10 #include "base/memory/ptr_util.h"
11 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "ios/web_view/internal/app/application_context.h"
12 #include "ui/base/l10n/l10n_util_mac.h" 10 #include "ui/base/l10n/l10n_util_mac.h"
13 #include "ui/base/resource/resource_bundle.h" 11 #include "ui/base/resource/resource_bundle.h"
14 12
15 #if !defined(__has_feature) || !__has_feature(objc_arc) 13 #if !defined(__has_feature) || !__has_feature(objc_arc)
16 #error "This file requires ARC support." 14 #error "This file requires ARC support."
17 #endif 15 #endif
18 16
19 namespace ios_web_view { 17 namespace ios_web_view {
20 18
21 WebViewWebMainParts::WebViewWebMainParts() {} 19 WebViewWebMainParts::WebViewWebMainParts() {}
22 20
23 WebViewWebMainParts::~WebViewWebMainParts() = default; 21 WebViewWebMainParts::~WebViewWebMainParts() = default;
24 22
25 void WebViewWebMainParts::PreMainMessageLoopRun() { 23 void WebViewWebMainParts::PreMainMessageLoopStart() {
26 // Initialize resources.
27 l10n_util::OverrideLocaleWithCocoaLocale(); 24 l10n_util::OverrideLocaleWithCocoaLocale();
28 ui::ResourceBundle::InitSharedInstanceWithLocale( 25 ui::ResourceBundle::InitSharedInstanceWithLocale(
29 std::string(), nullptr, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES); 26 std::string(), nullptr, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES);
27
30 base::FilePath pak_file; 28 base::FilePath pak_file;
31 PathService::Get(base::DIR_MODULE, &pak_file); 29 PathService::Get(base::DIR_MODULE, &pak_file);
32 pak_file = pak_file.Append(FILE_PATH_LITERAL("web_view_resources.pak")); 30 pak_file = pak_file.Append(FILE_PATH_LITERAL("web_view_resources.pak"));
33 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( 31 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
34 pak_file, ui::SCALE_FACTOR_NONE); 32 pak_file, ui::SCALE_FACTOR_NONE);
35 } 33 }
36 34
35 void WebViewWebMainParts::PreCreateThreads() {
36 // Initialize local state.
37 DCHECK(ApplicationContext::GetInstance()->GetLocalState());
38
39 ApplicationContext::GetInstance()->PreCreateThreads();
40 }
41
42 void WebViewWebMainParts::PostMainMessageLoopRun() {
43 // TODO(crbug.com/723869): Shutdown translate.
44 ApplicationContext::GetInstance()->SaveState();
45 }
46
47 void WebViewWebMainParts::PostDestroyThreads() {
48 ApplicationContext::GetInstance()->PostDestroyThreads();
49 }
50
37 } // namespace ios_web_view 51 } // namespace ios_web_view
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698