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