Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 NULL, | 101 NULL, |
| 102 ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES); | 102 ui::ResourceBundle::DO_NOT_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 webviewchromium.pak from the apk. Fall back to |
| 110 // load from file, using PATH_SERVICE, otherwise. | 110 // load from file, using PATH_SERVICE, otherwise. |
| 111 base::FilePath pak_file_path; | 111 base::FilePath base_pak_file_path; |
| 112 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_file_path); | 112 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &base_pak_file_path); |
| 113 pak_file_path = pak_file_path.AppendASCII("webviewchromium.pak"); | 113 // If Webview is a separate APK from Chrome then it uses webviewchromium.pak |
| 114 ui::LoadMainAndroidPackFile("assets/webviewchromium.pak", pak_file_path); | 114 base::FilePath webview_pak_file_path = base_pak_file_path.AppendASCII( |
| 115 "webviewchromium.pak"); | |
| 116 if (!ui::LoadMainAndroidPackFile("assets/webviewchromium.pak", | |
|
Torne
2016/08/10 13:52:54
We don't have to do this in this CL, but how diffi
aberent
2016/08/10 16:04:20
I don't know; I considered investigating and decid
| |
| 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 } | |
| 115 | 123 |
| 116 base::android::MemoryPressureListenerAndroid::RegisterSystemCallback( | 124 base::android::MemoryPressureListenerAndroid::RegisterSystemCallback( |
| 117 base::android::AttachCurrentThread()); | 125 base::android::AttachCurrentThread()); |
| 118 DeferredGpuCommandService::SetInstance(); | 126 DeferredGpuCommandService::SetInstance(); |
| 119 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 127 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 120 switches::kSingleProcess)) { | 128 switches::kSingleProcess)) { |
| 121 // Create the renderers crash manager on the UI thread. | 129 // Create the renderers crash manager on the UI thread. |
| 122 breakpad::CrashMicroDumpManager::GetInstance(); | 130 breakpad::CrashMicroDumpManager::GetInstance(); |
| 123 } | 131 } |
| 124 | 132 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 136 content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView(); | 144 content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView(); |
| 137 } | 145 } |
| 138 | 146 |
| 139 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { | 147 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { |
| 140 // Android WebView does not use default MessageLoop. It has its own | 148 // Android WebView does not use default MessageLoop. It has its own |
| 141 // Android specific MessageLoop. | 149 // Android specific MessageLoop. |
| 142 return true; | 150 return true; |
| 143 } | 151 } |
| 144 | 152 |
| 145 } // namespace android_webview | 153 } // namespace android_webview |
| OLD | NEW |