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_browser_terminator.h" |
8 #include "android_webview/browser/aw_content_browser_client.h" | 9 #include "android_webview/browser/aw_content_browser_client.h" |
9 #include "android_webview/browser/aw_result_codes.h" | 10 #include "android_webview/browser/aw_result_codes.h" |
10 #include "android_webview/browser/deferred_gpu_command_service.h" | 11 #include "android_webview/browser/deferred_gpu_command_service.h" |
11 #include "android_webview/browser/net/aw_network_change_notifier_factory.h" | 12 #include "android_webview/browser/net/aw_network_change_notifier_factory.h" |
12 #include "android_webview/common/aw_resource.h" | 13 #include "android_webview/common/aw_resource.h" |
13 #include "android_webview/common/aw_switches.h" | 14 #include "android_webview/common/aw_switches.h" |
14 #include "base/android/apk_assets.h" | 15 #include "base/android/apk_assets.h" |
15 #include "base/android/build_info.h" | 16 #include "base/android/build_info.h" |
16 #include "base/android/locale_utils.h" | 17 #include "base/android/locale_utils.h" |
17 #include "base/android/memory_pressure_listener_android.h" | 18 #include "base/android/memory_pressure_listener_android.h" |
18 #include "base/command_line.h" | 19 #include "base/command_line.h" |
19 #include "base/files/file_path.h" | 20 #include "base/files/file_path.h" |
20 #include "base/i18n/rtl.h" | 21 #include "base/i18n/rtl.h" |
21 #include "base/path_service.h" | 22 #include "base/path_service.h" |
22 #include "components/crash/content/browser/crash_micro_dump_manager_android.h" | 23 #include "components/crash/content/browser/crash_dump_observer_android.h" |
23 #include "content/public/browser/android/synchronous_compositor.h" | 24 #include "content/public/browser/android/synchronous_compositor.h" |
24 #include "content/public/browser/render_frame_host.h" | 25 #include "content/public/browser/render_frame_host.h" |
25 #include "content/public/browser/render_process_host.h" | 26 #include "content/public/browser/render_process_host.h" |
26 #include "content/public/common/content_client.h" | 27 #include "content/public/common/content_client.h" |
27 #include "content/public/common/content_switches.h" | 28 #include "content/public/common/content_switches.h" |
28 #include "content/public/common/result_codes.h" | 29 #include "content/public/common/result_codes.h" |
29 #include "device/geolocation/access_token_store.h" | 30 #include "device/geolocation/access_token_store.h" |
30 #include "device/geolocation/geolocation_delegate.h" | 31 #include "device/geolocation/geolocation_delegate.h" |
31 #include "device/geolocation/geolocation_provider.h" | 32 #include "device/geolocation/geolocation_provider.h" |
32 #include "net/android/network_change_notifier_factory_android.h" | 33 #include "net/android/network_change_notifier_factory_android.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // Try to directly mmap the resources.pak from the apk. Fall back to load | 108 // Try to directly mmap the resources.pak from the apk. Fall back to load |
108 // from file, using PATH_SERVICE, otherwise. | 109 // from file, using PATH_SERVICE, otherwise. |
109 base::FilePath pak_file_path; | 110 base::FilePath pak_file_path; |
110 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_file_path); | 111 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_file_path); |
111 pak_file_path = pak_file_path.AppendASCII("resources.pak"); | 112 pak_file_path = pak_file_path.AppendASCII("resources.pak"); |
112 ui::LoadMainAndroidPackFile("assets/resources.pak", pak_file_path); | 113 ui::LoadMainAndroidPackFile("assets/resources.pak", pak_file_path); |
113 | 114 |
114 base::android::MemoryPressureListenerAndroid::RegisterSystemCallback( | 115 base::android::MemoryPressureListenerAndroid::RegisterSystemCallback( |
115 base::android::AttachCurrentThread()); | 116 base::android::AttachCurrentThread()); |
116 DeferredGpuCommandService::SetInstance(); | 117 DeferredGpuCommandService::SetInstance(); |
| 118 breakpad::CrashDumpObserver::Create(); |
117 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 119 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
118 switches::kSingleProcess)) { | 120 switches::kSingleProcess)) { |
119 // Create the renderers crash manager on the UI thread. | 121 // Create the renderers crash manager on the UI thread. |
120 breakpad::CrashMicroDumpManager::GetInstance(); | 122 breakpad::CrashDumpObserver::GetInstance()->RegisterClient( |
| 123 base::MakeUnique<AwBrowserTerminator>()); |
121 } | 124 } |
122 | 125 |
123 return content::RESULT_CODE_NORMAL_EXIT; | 126 return content::RESULT_CODE_NORMAL_EXIT; |
124 } | 127 } |
125 | 128 |
126 void AwBrowserMainParts::PreMainMessageLoopRun() { | 129 void AwBrowserMainParts::PreMainMessageLoopRun() { |
127 browser_client_->InitBrowserContext()->PreMainMessageLoopRun(); | 130 browser_client_->InitBrowserContext()->PreMainMessageLoopRun(); |
128 | 131 |
129 device::GeolocationProvider::SetGeolocationDelegate( | 132 device::GeolocationProvider::SetGeolocationDelegate( |
130 new AwGeolocationDelegate()); | 133 new AwGeolocationDelegate()); |
131 | 134 |
132 content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView(); | 135 content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView(); |
133 } | 136 } |
134 | 137 |
135 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { | 138 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { |
136 // Android WebView does not use default MessageLoop. It has its own | 139 // Android WebView does not use default MessageLoop. It has its own |
137 // Android specific MessageLoop. | 140 // Android specific MessageLoop. |
138 return true; | 141 return true; |
139 } | 142 } |
140 | 143 |
141 } // namespace android_webview | 144 } // namespace android_webview |
OLD | NEW |