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

Side by Side Diff: ios/web_view/internal/web_view_web_main_parts.mm

Issue 2800433002: Remove CWVDelegate. (Closed)
Patch Set: Respond to comments. Created 3 years, 8 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
« no previous file with comments | « ios/web_view/internal/web_view_web_main_parts.h ('k') | ios/web_view/public/cwv.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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> 7 #import <Foundation/Foundation.h>
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "components/translate/core/browser/translate_download_manager.h" 12 #include "components/translate/core/browser/translate_download_manager.h"
13 #include "ios/web_view/internal/web_view_browser_state.h" 13 #include "ios/web_view/internal/web_view_browser_state.h"
14 #import "ios/web_view/public/cwv_delegate.h"
15 #include "ui/base/l10n/l10n_util_mac.h" 14 #include "ui/base/l10n/l10n_util_mac.h"
16 #include "ui/base/resource/resource_bundle.h" 15 #include "ui/base/resource/resource_bundle.h"
17 16
18 #if !defined(__has_feature) || !__has_feature(objc_arc) 17 #if !defined(__has_feature) || !__has_feature(objc_arc)
19 #error "This file requires ARC support." 18 #error "This file requires ARC support."
20 #endif 19 #endif
21 20
22 namespace ios_web_view { 21 namespace ios_web_view {
23 22
24 WebViewWebMainParts::WebViewWebMainParts(id<CWVDelegate> delegate) { 23 WebViewWebMainParts::WebViewWebMainParts() {}
25 delegate_ = delegate;
26 }
27 24
28 WebViewWebMainParts::~WebViewWebMainParts() = default; 25 WebViewWebMainParts::~WebViewWebMainParts() = default;
29 26
30 void WebViewWebMainParts::PreMainMessageLoopRun() { 27 void WebViewWebMainParts::PreMainMessageLoopRun() {
31 // Initialize resources. 28 // Initialize resources.
32 l10n_util::OverrideLocaleWithCocoaLocale(); 29 l10n_util::OverrideLocaleWithCocoaLocale();
33 ui::ResourceBundle::InitSharedInstanceWithLocale( 30 ui::ResourceBundle::InitSharedInstanceWithLocale(
34 std::string(), nullptr, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES); 31 std::string(), nullptr, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES);
35 base::FilePath pak_file; 32 base::FilePath pak_file;
36 PathService::Get(base::DIR_MODULE, &pak_file); 33 PathService::Get(base::DIR_MODULE, &pak_file);
37 pak_file = pak_file.Append(FILE_PATH_LITERAL("web_view_resources.pak")); 34 pak_file = pak_file.Append(FILE_PATH_LITERAL("web_view_resources.pak"));
38 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( 35 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
39 pak_file, ui::SCALE_FACTOR_NONE); 36 pak_file, ui::SCALE_FACTOR_NONE);
40 37
41 browser_state_ = base::MakeUnique<WebViewBrowserState>(false); 38 browser_state_ = base::MakeUnique<WebViewBrowserState>(false);
42 off_the_record_browser_state_ = base::MakeUnique<WebViewBrowserState>(true); 39 off_the_record_browser_state_ = base::MakeUnique<WebViewBrowserState>(true);
43 40
44 // Initialize translate. 41 // Initialize translate.
45 translate::TranslateDownloadManager* download_manager = 42 translate::TranslateDownloadManager* download_manager =
46 translate::TranslateDownloadManager::GetInstance(); 43 translate::TranslateDownloadManager::GetInstance();
47 // TODO(crbug.com/679895): See if we need the system request context here. 44 // TODO(crbug.com/679895): See if we need the system request context here.
48 download_manager->set_request_context(browser_state_->GetRequestContext()); 45 download_manager->set_request_context(browser_state_->GetRequestContext());
49 // TODO(crbug.com/679895): Bring up application locale correctly. 46 // TODO(crbug.com/679895): Bring up application locale correctly.
50 download_manager->set_application_locale(l10n_util::GetLocaleOverride()); 47 download_manager->set_application_locale(l10n_util::GetLocaleOverride());
51 download_manager->language_list()->SetResourceRequestsAllowed(true); 48 download_manager->language_list()->SetResourceRequestsAllowed(true);
52 } 49 }
53 50
54 } // namespace ios_web_view 51 } // namespace ios_web_view
OLDNEW
« no previous file with comments | « ios/web_view/internal/web_view_web_main_parts.h ('k') | ios/web_view/public/cwv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698