OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 package com.android.webview.chromium; | 5 package com.android.webview.chromium; |
6 | 6 |
7 import android.Manifest; | 7 import android.Manifest; |
8 import android.app.ActivityManager; | 8 import android.app.ActivityManager; |
9 import android.content.ComponentCallbacks2; | 9 import android.content.ComponentCallbacks2; |
10 import android.content.Context; | 10 import android.content.Context; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 * implementation classes. | 78 * implementation classes. |
79 */ | 79 */ |
80 @SuppressWarnings("deprecation") | 80 @SuppressWarnings("deprecation") |
81 public class WebViewChromiumFactoryProvider implements WebViewFactoryProvider { | 81 public class WebViewChromiumFactoryProvider implements WebViewFactoryProvider { |
82 private static final String TAG = "WebViewChromiumFactoryProvider"; | 82 private static final String TAG = "WebViewChromiumFactoryProvider"; |
83 | 83 |
84 private static final String CHROMIUM_PREFS_NAME = "WebViewChromiumPrefs"; | 84 private static final String CHROMIUM_PREFS_NAME = "WebViewChromiumPrefs"; |
85 private static final String VERSION_CODE_PREF = "lastVersionCodeUsed"; | 85 private static final String VERSION_CODE_PREF = "lastVersionCodeUsed"; |
86 private static final String COMMAND_LINE_FILE = "/data/local/tmp/webview-com
mand-line"; | 86 private static final String COMMAND_LINE_FILE = "/data/local/tmp/webview-com
mand-line"; |
87 private static final String HTTP_AUTH_DATABASE_FILE = "http_auth.db"; | 87 private static final String HTTP_AUTH_DATABASE_FILE = "http_auth.db"; |
| 88 // same switch as kEnableCrashReporterForTesting in //base/base_switches.h |
| 89 public static final String CRASH_UPLOADS_ENABLED_FOR_TESTING_SWITCH = |
| 90 "enable-crash-reporter-for-testing"; |
88 | 91 |
89 private class WebViewChromiumRunQueue { | 92 private class WebViewChromiumRunQueue { |
90 public WebViewChromiumRunQueue() { | 93 public WebViewChromiumRunQueue() { |
91 mQueue = new ConcurrentLinkedQueue<Runnable>(); | 94 mQueue = new ConcurrentLinkedQueue<Runnable>(); |
92 } | 95 } |
93 | 96 |
94 public void addTask(Runnable task) { | 97 public void addTask(Runnable task) { |
95 mQueue.add(task); | 98 mQueue.add(task); |
96 if (WebViewChromiumFactoryProvider.this.hasStarted()) { | 99 if (WebViewChromiumFactoryProvider.this.hasStarted()) { |
97 ThreadUtils.runOnUiThread(new Runnable() { | 100 ThreadUtils.runOnUiThread(new Runnable() { |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 402 |
400 // Make sure that ResourceProvider is initialized before starting the br
owser process. | 403 // Make sure that ResourceProvider is initialized before starting the br
owser process. |
401 final String webViewPackageName = WebViewFactory.getLoadedPackageInfo().
packageName; | 404 final String webViewPackageName = WebViewFactory.getLoadedPackageInfo().
packageName; |
402 final Context context = ContextUtils.getApplicationContext(); | 405 final Context context = ContextUtils.getApplicationContext(); |
403 setUpResources(webViewPackageName, context); | 406 setUpResources(webViewPackageName, context); |
404 initPlatSupportLibrary(); | 407 initPlatSupportLibrary(); |
405 initNetworkChangeNotifier(context); | 408 initNetworkChangeNotifier(context); |
406 final boolean isExternalService = true; | 409 final boolean isExternalService = true; |
407 AwBrowserProcess.configureChildProcessLauncher(webViewPackageName, isExt
ernalService); | 410 AwBrowserProcess.configureChildProcessLauncher(webViewPackageName, isExt
ernalService); |
408 AwBrowserProcess.start(); | 411 AwBrowserProcess.start(); |
409 AwBrowserProcess.handleMinidumps(webViewPackageName); | |
410 | 412 |
| 413 final boolean enableMinidumpUploadingForTesting = CommandLine.getInstanc
e().hasSwitch( |
| 414 CRASH_UPLOADS_ENABLED_FOR_TESTING_SWITCH); |
| 415 if (enableMinidumpUploadingForTesting) { |
| 416 AwBrowserProcess.handleMinidumps(webViewPackageName, true /* enabled
*/); |
| 417 } |
| 418 |
| 419 // Actions conditioned on whether the Android Checkbox is toggled on |
411 PlatformServiceBridge.getInstance(context) | 420 PlatformServiceBridge.getInstance(context) |
412 .queryMetricsSetting(new ValueCallback<Boolean>() { | 421 .queryMetricsSetting(new ValueCallback<Boolean>() { |
413 public void onReceiveValue(Boolean enabled) { | 422 public void onReceiveValue(Boolean enabled) { |
414 ThreadUtils.assertOnUiThread(); | 423 ThreadUtils.assertOnUiThread(); |
415 AwMetricsServiceClient.setConsentSetting(context, enable
d); | 424 AwMetricsServiceClient.setConsentSetting(context, enable
d); |
| 425 |
| 426 if (!enableMinidumpUploadingForTesting) { |
| 427 AwBrowserProcess.handleMinidumps(webViewPackageName,
enabled); |
| 428 } |
416 } | 429 } |
417 }); | 430 }); |
418 | 431 |
419 if (isBuildDebuggable()) { | 432 if (isBuildDebuggable()) { |
420 setWebContentsDebuggingEnabled(true); | 433 setWebContentsDebuggingEnabled(true); |
421 } | 434 } |
422 | 435 |
423 TraceEvent.setATraceEnabled(mWebViewDelegate.isTraceTagEnabled()); | 436 TraceEvent.setATraceEnabled(mWebViewDelegate.isTraceTagEnabled()); |
424 mWebViewDelegate.setOnTraceEnabledChangeListener( | 437 mWebViewDelegate.setOnTraceEnabledChangeListener( |
425 new WebViewDelegate.OnTraceEnabledChangeListener() { | 438 new WebViewDelegate.OnTraceEnabledChangeListener() { |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 WebViewDelegate getWebViewDelegate() { | 682 WebViewDelegate getWebViewDelegate() { |
670 return mWebViewDelegate; | 683 return mWebViewDelegate; |
671 } | 684 } |
672 | 685 |
673 // The method to support unreleased Android. | 686 // The method to support unreleased Android. |
674 WebViewContentsClientAdapter createWebViewContentsClientAdapter(WebView webV
iew, | 687 WebViewContentsClientAdapter createWebViewContentsClientAdapter(WebView webV
iew, |
675 Context context) { | 688 Context context) { |
676 return new WebViewContentsClientAdapter(webView, context, mWebViewDelega
te); | 689 return new WebViewContentsClientAdapter(webView, context, mWebViewDelega
te); |
677 } | 690 } |
678 } | 691 } |
OLD | NEW |