| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/web_view/internal/criwv_web_main_parts.h" |
| 6 |
| 7 #include "base/base_paths.h" |
| 8 #include "base/path_service.h" |
| 9 #include "components/translate/core/browser/translate_download_manager.h" |
| 10 #include "ios/web_view/internal/criwv_browser_state.h" |
| 11 #import "ios/web_view/public/criwv_delegate.h" |
| 12 #include "ui/base/l10n/l10n_util_mac.h" |
| 13 #include "ui/base/resource/resource_bundle.h" |
| 14 |
| 15 namespace ios_web_view { |
| 16 |
| 17 CRIWVWebMainParts::CRIWVWebMainParts(id<CRIWVDelegate> delegate) { |
| 18 delegate_ = delegate; |
| 19 } |
| 20 |
| 21 CRIWVWebMainParts::~CRIWVWebMainParts() {} |
| 22 |
| 23 void CRIWVWebMainParts::PreMainMessageLoopRun() { |
| 24 // Initialize resources. |
| 25 l10n_util::OverrideLocaleWithCocoaLocale(); |
| 26 ui::ResourceBundle::InitSharedInstanceWithLocale( |
| 27 "", NULL, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES); |
| 28 base::FilePath pak_file; |
| 29 PathService::Get(base::DIR_MODULE, &pak_file); |
| 30 pak_file = pak_file.Append("web_view_resources.pak"); |
| 31 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
| 32 pak_file, ui::SCALE_FACTOR_NONE); |
| 33 |
| 34 browser_state_.reset(new CRIWVBrowserState); |
| 35 |
| 36 // Initialize translate. |
| 37 translate::TranslateDownloadManager* download_manager = |
| 38 translate::TranslateDownloadManager::GetInstance(); |
| 39 // TODO(crbug.com/679895): See if we need the system request context here. |
| 40 download_manager->set_request_context(browser_state_->GetRequestContext()); |
| 41 // TODO(crbug.com/679895): Bring up application locale correctly. |
| 42 download_manager->set_application_locale(l10n_util::GetLocaleOverride()); |
| 43 download_manager->language_list()->SetResourceRequestsAllowed(true); |
| 44 } |
| 45 |
| 46 } // namespace ios_web_view |
| OLD | NEW |