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

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

Issue 2643773005: Upstream ios/web_view source code. (Closed)
Patch Set: Created 3 years, 11 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
Index: ios/web_view/internal/criwv_web_main_parts.mm
diff --git a/ios/web_view/internal/criwv_web_main_parts.mm b/ios/web_view/internal/criwv_web_main_parts.mm
new file mode 100644
index 0000000000000000000000000000000000000000..7465a08331c36afb7378599bc1ebcb244768c7da
--- /dev/null
+++ b/ios/web_view/internal/criwv_web_main_parts.mm
@@ -0,0 +1,46 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/web_view/internal/criwv_web_main_parts.h"
+
+#include "base/base_paths.h"
+#include "base/path_service.h"
+#include "components/translate/core/browser/translate_download_manager.h"
+#include "ios/web_view/internal/criwv_browser_state.h"
+#import "ios/web_view/public/criwv_delegate.h"
+#include "ui/base/l10n/l10n_util_mac.h"
+#include "ui/base/resource/resource_bundle.h"
+
+namespace ios_web_view {
+
+CRIWVWebMainParts::CRIWVWebMainParts(id<CRIWVDelegate> delegate) {
+ delegate_ = delegate;
+}
+
+CRIWVWebMainParts::~CRIWVWebMainParts() {}
+
+void CRIWVWebMainParts::PreMainMessageLoopRun() {
+ // Initialize resources.
+ l10n_util::OverrideLocaleWithCocoaLocale();
+ ui::ResourceBundle::InitSharedInstanceWithLocale(
+ "", NULL, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES);
sdefresne 2017/01/20 10:28:12 s/""/std::string()/
michaeldo 2017/01/24 22:35:25 Done in dep CL.
+ base::FilePath pak_file;
+ PathService::Get(base::DIR_MODULE, &pak_file);
+ pak_file = pak_file.Append("web_view_resources.pak");
sdefresne 2017/01/20 10:28:12 nit: pak_file = pak_file.Append(FILE_PATH_LITERAL(
michaeldo 2017/01/24 22:35:25 Done in dep CL.
+ ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
+ pak_file, ui::SCALE_FACTOR_NONE);
+
+ browser_state_.reset(new CRIWVBrowserState);
sdefresne 2017/01/20 10:28:12 nit: browser_state_ = base::MakeUnique<CRIWVBrowse
michaeldo 2017/01/24 22:35:25 Done in dep CL.
+
+ // Initialize translate.
+ translate::TranslateDownloadManager* download_manager =
+ translate::TranslateDownloadManager::GetInstance();
+ // TODO(crbug.com/679895): See if we need the system request context here.
+ download_manager->set_request_context(browser_state_->GetRequestContext());
+ // TODO(crbug.com/679895): Bring up application locale correctly.
+ download_manager->set_application_locale(l10n_util::GetLocaleOverride());
+ download_manager->language_list()->SetResourceRequestsAllowed(true);
+}
+
+} // namespace ios_web_view

Powered by Google App Engine
This is Rietveld 408576698