| 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_dev_tools_discovery_provider.h" | 8 #include "android_webview/browser/aw_dev_tools_discovery_provider.h" |
| 9 #include "android_webview/browser/aw_media_client_android.h" | 9 #include "android_webview/browser/aw_media_client_android.h" |
| 10 #include "android_webview/browser/aw_result_codes.h" | 10 #include "android_webview/browser/aw_result_codes.h" |
| 11 #include "android_webview/browser/deferred_gpu_command_service.h" | 11 #include "android_webview/browser/deferred_gpu_command_service.h" |
| 12 #include "android_webview/common/aw_resource.h" | 12 #include "android_webview/common/aw_resource.h" |
| 13 #include "android_webview/common/aw_switches.h" | 13 #include "android_webview/common/aw_switches.h" |
| 14 #include "base/android/apk_assets.h" | 14 #include "base/android/apk_assets.h" |
| 15 #include "base/android/build_info.h" | 15 #include "base/android/build_info.h" |
| 16 #include "base/android/locale_utils.h" | 16 #include "base/android/locale_utils.h" |
| 17 #include "base/android/memory_pressure_listener_android.h" | 17 #include "base/android/memory_pressure_listener_android.h" |
| 18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
| 19 #include "base/files/file_path.h" | 19 #include "base/files/file_path.h" |
| 20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
| 21 #include "components/crash/content/browser/crash_micro_dump_manager_android.h" |
| 21 #include "content/public/browser/android/synchronous_compositor.h" | 22 #include "content/public/browser/android/synchronous_compositor.h" |
| 22 #include "content/public/browser/render_frame_host.h" | 23 #include "content/public/browser/render_frame_host.h" |
| 23 #include "content/public/browser/render_process_host.h" | 24 #include "content/public/browser/render_process_host.h" |
| 24 #include "content/public/common/content_client.h" | 25 #include "content/public/common/content_client.h" |
| 25 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
| 26 #include "content/public/common/result_codes.h" | 27 #include "content/public/common/result_codes.h" |
| 27 #include "media/base/android/media_client_android.h" | 28 #include "media/base/android/media_client_android.h" |
| 28 #include "net/android/network_change_notifier_factory_android.h" | 29 #include "net/android/network_change_notifier_factory_android.h" |
| 29 #include "net/base/network_change_notifier.h" | 30 #include "net/base/network_change_notifier.h" |
| 30 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // Try to directly mmap the webviewchromium.pak from the apk. Fall back to | 69 // Try to directly mmap the webviewchromium.pak from the apk. Fall back to |
| 69 // load from file, using PATH_SERVICE, otherwise. | 70 // load from file, using PATH_SERVICE, otherwise. |
| 70 base::FilePath pak_file_path; | 71 base::FilePath pak_file_path; |
| 71 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_file_path); | 72 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_file_path); |
| 72 pak_file_path = pak_file_path.AppendASCII("webviewchromium.pak"); | 73 pak_file_path = pak_file_path.AppendASCII("webviewchromium.pak"); |
| 73 ui::LoadMainAndroidPackFile("assets/webviewchromium.pak", pak_file_path); | 74 ui::LoadMainAndroidPackFile("assets/webviewchromium.pak", pak_file_path); |
| 74 | 75 |
| 75 base::android::MemoryPressureListenerAndroid::RegisterSystemCallback( | 76 base::android::MemoryPressureListenerAndroid::RegisterSystemCallback( |
| 76 base::android::AttachCurrentThread()); | 77 base::android::AttachCurrentThread()); |
| 77 DeferredGpuCommandService::SetInstance(); | 78 DeferredGpuCommandService::SetInstance(); |
| 79 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 80 switches::kSingleProcess)) { |
| 81 // Create the renderers crash manager on the UI thread. |
| 82 breakpad::CrashMicroDumpManager::GetInstance(); |
| 83 } |
| 78 | 84 |
| 79 return content::RESULT_CODE_NORMAL_EXIT; | 85 return content::RESULT_CODE_NORMAL_EXIT; |
| 80 } | 86 } |
| 81 | 87 |
| 82 void AwBrowserMainParts::PreMainMessageLoopRun() { | 88 void AwBrowserMainParts::PreMainMessageLoopRun() { |
| 83 browser_context_->PreMainMessageLoopRun(); | 89 browser_context_->PreMainMessageLoopRun(); |
| 84 | 90 |
| 85 AwDevToolsDiscoveryProvider::Install(); | 91 AwDevToolsDiscoveryProvider::Install(); |
| 86 | 92 |
| 87 media::SetMediaClientAndroid( | 93 media::SetMediaClientAndroid( |
| 88 new AwMediaClientAndroid(AwResource::GetConfigKeySystemUuidMapping())); | 94 new AwMediaClientAndroid(AwResource::GetConfigKeySystemUuidMapping())); |
| 89 | 95 |
| 90 content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView(); | 96 content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView(); |
| 91 } | 97 } |
| 92 | 98 |
| 93 void AwBrowserMainParts::PostMainMessageLoopRun() { | 99 void AwBrowserMainParts::PostMainMessageLoopRun() { |
| 94 browser_context_->PostMainMessageLoopRun(); | 100 browser_context_->PostMainMessageLoopRun(); |
| 95 } | 101 } |
| 96 | 102 |
| 97 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { | 103 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { |
| 98 // Android WebView does not use default MessageLoop. It has its own | 104 // Android WebView does not use default MessageLoop. It has its own |
| 99 // Android specific MessageLoop. | 105 // Android specific MessageLoop. |
| 100 return true; | 106 return true; |
| 101 } | 107 } |
| 102 | 108 |
| 103 } // namespace android_webview | 109 } // namespace android_webview |
| OLD | NEW |