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_browser_terminator.h" |
9 #include "android_webview/browser/aw_content_browser_client.h" | 9 #include "android_webview/browser/aw_content_browser_client.h" |
10 #include "android_webview/browser/aw_result_codes.h" | 10 #include "android_webview/browser/aw_result_codes.h" |
| 11 #include "android_webview/browser/aw_safe_browsing_config_helper.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_descriptors.h" | 14 #include "android_webview/common/aw_descriptors.h" |
14 #include "android_webview/common/aw_paths.h" | 15 #include "android_webview/common/aw_paths.h" |
15 #include "android_webview/common/aw_resource.h" | 16 #include "android_webview/common/aw_resource.h" |
16 #include "android_webview/common/aw_switches.h" | 17 #include "android_webview/common/aw_switches.h" |
17 #include "android_webview/common/crash_reporter/aw_microdump_crash_reporter.h" | 18 #include "android_webview/common/crash_reporter/aw_microdump_crash_reporter.h" |
18 #include "base/android/apk_assets.h" | 19 #include "base/android/apk_assets.h" |
19 #include "base/android/build_info.h" | 20 #include "base/android/build_info.h" |
20 #include "base/android/locale_utils.h" | 21 #include "base/android/locale_utils.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 base::FilePath crash_dir; | 127 base::FilePath crash_dir; |
127 if (PathService::Get(android_webview::DIR_CRASH_DUMPS, &crash_dir)) { | 128 if (PathService::Get(android_webview::DIR_CRASH_DUMPS, &crash_dir)) { |
128 if (!base::PathExists(crash_dir)) | 129 if (!base::PathExists(crash_dir)) |
129 base::CreateDirectory(crash_dir); | 130 base::CreateDirectory(crash_dir); |
130 breakpad::CrashDumpObserver::GetInstance()->RegisterClient( | 131 breakpad::CrashDumpObserver::GetInstance()->RegisterClient( |
131 base::MakeUnique<breakpad::CrashDumpManager>( | 132 base::MakeUnique<breakpad::CrashDumpManager>( |
132 crash_dir, kAndroidMinidumpDescriptor)); | 133 crash_dir, kAndroidMinidumpDescriptor)); |
133 } | 134 } |
134 } | 135 } |
135 | 136 |
| 137 if (AwSafeBrowsingConfigHelper::GetSafeBrowsingEnabled()) { |
| 138 base::FilePath safe_browsing_dir; |
| 139 if (PathService::Get(android_webview::DIR_SAFE_BROWSING, |
| 140 &safe_browsing_dir)) { |
| 141 if (!base::PathExists(safe_browsing_dir)) |
| 142 base::CreateDirectory(safe_browsing_dir); |
| 143 } |
| 144 } |
| 145 |
136 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 146 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
137 switches::kWebViewSandboxedRenderer)) { | 147 switches::kWebViewSandboxedRenderer)) { |
138 // Create the renderers crash manager on the UI thread. | 148 // Create the renderers crash manager on the UI thread. |
139 breakpad::CrashDumpObserver::GetInstance()->RegisterClient( | 149 breakpad::CrashDumpObserver::GetInstance()->RegisterClient( |
140 base::MakeUnique<AwBrowserTerminator>()); | 150 base::MakeUnique<AwBrowserTerminator>()); |
141 } | 151 } |
142 | 152 |
143 return content::RESULT_CODE_NORMAL_EXIT; | 153 return content::RESULT_CODE_NORMAL_EXIT; |
144 } | 154 } |
145 | 155 |
146 void AwBrowserMainParts::PreMainMessageLoopRun() { | 156 void AwBrowserMainParts::PreMainMessageLoopRun() { |
147 browser_client_->InitBrowserContext()->PreMainMessageLoopRun(); | 157 browser_client_->InitBrowserContext()->PreMainMessageLoopRun(); |
148 | 158 |
149 device::GeolocationProvider::SetGeolocationDelegate( | 159 device::GeolocationProvider::SetGeolocationDelegate( |
150 new AwGeolocationDelegate()); | 160 new AwGeolocationDelegate()); |
151 | 161 |
152 content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView(); | 162 content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView(); |
153 } | 163 } |
154 | 164 |
155 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { | 165 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { |
156 // Android WebView does not use default MessageLoop. It has its own | 166 // Android WebView does not use default MessageLoop. It has its own |
157 // Android specific MessageLoop. | 167 // Android specific MessageLoop. |
158 return true; | 168 return true; |
159 } | 169 } |
160 | 170 |
161 } // namespace android_webview | 171 } // namespace android_webview |
OLD | NEW |