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_metrics_service_client.h" | 10 #include "android_webview/browser/aw_metrics_service_client.h" |
11 #include "android_webview/browser/aw_result_codes.h" | 11 #include "android_webview/browser/aw_result_codes.h" |
12 #include "android_webview/browser/aw_safe_browsing_config_helper.h" | |
13 #include "android_webview/browser/deferred_gpu_command_service.h" | 12 #include "android_webview/browser/deferred_gpu_command_service.h" |
14 #include "android_webview/browser/net/aw_network_change_notifier_factory.h" | 13 #include "android_webview/browser/net/aw_network_change_notifier_factory.h" |
15 #include "android_webview/common/aw_descriptors.h" | 14 #include "android_webview/common/aw_descriptors.h" |
16 #include "android_webview/common/aw_paths.h" | 15 #include "android_webview/common/aw_paths.h" |
17 #include "android_webview/common/aw_resource.h" | 16 #include "android_webview/common/aw_resource.h" |
18 #include "android_webview/common/aw_switches.h" | 17 #include "android_webview/common/aw_switches.h" |
19 #include "android_webview/common/crash_reporter/aw_microdump_crash_reporter.h" | 18 #include "android_webview/common/crash_reporter/aw_microdump_crash_reporter.h" |
20 #include "base/android/apk_assets.h" | 19 #include "base/android/apk_assets.h" |
21 #include "base/android/build_info.h" | 20 #include "base/android/build_info.h" |
22 #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... |
128 base::FilePath crash_dir; | 127 base::FilePath crash_dir; |
129 if (PathService::Get(android_webview::DIR_CRASH_DUMPS, &crash_dir)) { | 128 if (PathService::Get(android_webview::DIR_CRASH_DUMPS, &crash_dir)) { |
130 if (!base::PathExists(crash_dir)) | 129 if (!base::PathExists(crash_dir)) |
131 base::CreateDirectory(crash_dir); | 130 base::CreateDirectory(crash_dir); |
132 breakpad::CrashDumpObserver::GetInstance()->RegisterClient( | 131 breakpad::CrashDumpObserver::GetInstance()->RegisterClient( |
133 base::MakeUnique<breakpad::CrashDumpManager>( | 132 base::MakeUnique<breakpad::CrashDumpManager>( |
134 crash_dir, kAndroidMinidumpDescriptor)); | 133 crash_dir, kAndroidMinidumpDescriptor)); |
135 } | 134 } |
136 } | 135 } |
137 | 136 |
138 if (AwSafeBrowsingConfigHelper::GetSafeBrowsingEnabled()) { | 137 // We need to create the safe browsing specific directory even if the |
139 base::FilePath safe_browsing_dir; | 138 // AwSafeBrowsingConfigHelper::GetSafeBrowsingEnabled() is false |
140 if (PathService::Get(android_webview::DIR_SAFE_BROWSING, | 139 // initially, because safe browsing can be enabled later at runtime |
141 &safe_browsing_dir)) { | 140 // on a per-webview basis. |
142 if (!base::PathExists(safe_browsing_dir)) | 141 base::FilePath safe_browsing_dir; |
143 base::CreateDirectory(safe_browsing_dir); | 142 if (PathService::Get(android_webview::DIR_SAFE_BROWSING, |
144 } | 143 &safe_browsing_dir)) { |
| 144 if (!base::PathExists(safe_browsing_dir)) |
| 145 base::CreateDirectory(safe_browsing_dir); |
145 } | 146 } |
146 | 147 |
147 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 148 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
148 switches::kWebViewSandboxedRenderer)) { | 149 switches::kWebViewSandboxedRenderer)) { |
149 // Create the renderers crash manager on the UI thread. | 150 // Create the renderers crash manager on the UI thread. |
150 breakpad::CrashDumpObserver::GetInstance()->RegisterClient( | 151 breakpad::CrashDumpObserver::GetInstance()->RegisterClient( |
151 base::MakeUnique<AwBrowserTerminator>()); | 152 base::MakeUnique<AwBrowserTerminator>()); |
152 } | 153 } |
153 | 154 |
154 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 155 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 13 matching lines...) Expand all Loading... |
168 content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView(); | 169 content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView(); |
169 } | 170 } |
170 | 171 |
171 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { | 172 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { |
172 // Android WebView does not use default MessageLoop. It has its own | 173 // Android WebView does not use default MessageLoop. It has its own |
173 // Android specific MessageLoop. | 174 // Android specific MessageLoop. |
174 return true; | 175 return true; |
175 } | 176 } |
176 | 177 |
177 } // namespace android_webview | 178 } // namespace android_webview |
OLD | NEW |