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

Side by Side Diff: android_webview/browser/aw_browser_main_parts.cc

Issue 2248743002: Fix missing monochrome resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rethink: change webview resource files to match chrome Created 4 years, 4 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 | « android_webview/BUILD.gn ('k') | ui/base/resource/resource_bundle_android.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "android_webview/browser/aw_browser_main_parts.h" 5 #include "android_webview/browser/aw_browser_main_parts.h"
6 6
7 #include "android_webview/browser/aw_browser_context.h" 7 #include "android_webview/browser/aw_browser_context.h"
8 #include "android_webview/browser/aw_content_browser_client.h" 8 #include "android_webview/browser/aw_content_browser_client.h"
9 #include "android_webview/browser/aw_dev_tools_discovery_provider.h" 9 #include "android_webview/browser/aw_dev_tools_discovery_provider.h"
10 #include "android_webview/browser/aw_result_codes.h" 10 #include "android_webview/browser/aw_result_codes.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 DCHECK(!main_message_loop_.get()); 92 DCHECK(!main_message_loop_.get());
93 main_message_loop_.reset(new base::MessageLoopForUI); 93 main_message_loop_.reset(new base::MessageLoopForUI);
94 base::MessageLoopForUI::current()->Start(); 94 base::MessageLoopForUI::current()->Start();
95 } 95 }
96 96
97 int AwBrowserMainParts::PreCreateThreads() { 97 int AwBrowserMainParts::PreCreateThreads() {
98 ui::SetLocalePaksStoredInApk(true); 98 ui::SetLocalePaksStoredInApk(true);
99 std::string locale = ui::ResourceBundle::InitSharedInstanceWithLocale( 99 std::string locale = ui::ResourceBundle::InitSharedInstanceWithLocale(
100 base::android::GetDefaultLocale(), 100 base::android::GetDefaultLocale(),
101 NULL, 101 NULL,
102 ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES); 102 ui::ResourceBundle::LOAD_COMMON_RESOURCES);
103 if (locale.empty()) { 103 if (locale.empty()) {
104 LOG(WARNING) << "Failed to load locale .pak from the apk. " 104 LOG(WARNING) << "Failed to load locale .pak from the apk. "
105 "Bringing up WebView without any locale"; 105 "Bringing up WebView without any locale";
106 } 106 }
107 base::i18n::SetICUDefaultLocale(locale); 107 base::i18n::SetICUDefaultLocale(locale);
108 108
109 // Try to directly mmap the webviewchromium.pak from the apk. Fall back to 109 // Try to directly mmap the resources.pak from the apk. Fall back to load
110 // load from file, using PATH_SERVICE, otherwise. 110 // from file, using PATH_SERVICE, otherwise.
111 base::FilePath base_pak_file_path; 111 base::FilePath pak_file_path;
112 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &base_pak_file_path); 112 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_file_path);
113 // If Webview is a separate APK from Chrome then it uses webviewchromium.pak 113 pak_file_path = pak_file_path.AppendASCII("resources.pak");
114 base::FilePath webview_pak_file_path = base_pak_file_path.AppendASCII( 114 ui::LoadMainAndroidPackFile("assets/resources.pak", pak_file_path);
115 "webviewchromium.pak");
116 if (!ui::LoadMainAndroidPackFile("assets/webviewchromium.pak",
117 webview_pak_file_path)) {
118 // If it the same APK as Chrome (Monochrome) then it shares resources.pak
119 base::FilePath chromium_pak_file_path = base_pak_file_path.AppendASCII(
120 "resources.pak");
121 ui::LoadMainAndroidPackFile("assets/resources.pak", chromium_pak_file_path);
122 }
123 115
124 base::android::MemoryPressureListenerAndroid::RegisterSystemCallback( 116 base::android::MemoryPressureListenerAndroid::RegisterSystemCallback(
125 base::android::AttachCurrentThread()); 117 base::android::AttachCurrentThread());
126 DeferredGpuCommandService::SetInstance(); 118 DeferredGpuCommandService::SetInstance();
127 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 119 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
128 switches::kSingleProcess)) { 120 switches::kSingleProcess)) {
129 // Create the renderers crash manager on the UI thread. 121 // Create the renderers crash manager on the UI thread.
130 breakpad::CrashMicroDumpManager::GetInstance(); 122 breakpad::CrashMicroDumpManager::GetInstance();
131 } 123 }
132 124
(...skipping 11 matching lines...) Expand all
144 content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView(); 136 content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView();
145 } 137 }
146 138
147 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { 139 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) {
148 // Android WebView does not use default MessageLoop. It has its own 140 // Android WebView does not use default MessageLoop. It has its own
149 // Android specific MessageLoop. 141 // Android specific MessageLoop.
150 return true; 142 return true;
151 } 143 }
152 144
153 } // namespace android_webview 145 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/BUILD.gn ('k') | ui/base/resource/resource_bundle_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698