| 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 | 395 |
| 396 try { | 396 try { |
| 397 LibraryLoader.get(LibraryProcessType.PROCESS_WEBVIEW).ensureInitiali
zed(); | 397 LibraryLoader.get(LibraryProcessType.PROCESS_WEBVIEW).ensureInitiali
zed(); |
| 398 } catch (ProcessInitException e) { | 398 } catch (ProcessInitException e) { |
| 399 throw new RuntimeException("Error initializing WebView library", e); | 399 throw new RuntimeException("Error initializing WebView library", e); |
| 400 } | 400 } |
| 401 | 401 |
| 402 PathService.override(PathService.DIR_MODULE, "/system/lib/"); | 402 PathService.override(PathService.DIR_MODULE, "/system/lib/"); |
| 403 PathService.override(DIR_RESOURCE_PAKS_ANDROID, "/system/framework/webvi
ew/paks"); | 403 PathService.override(DIR_RESOURCE_PAKS_ANDROID, "/system/framework/webvi
ew/paks"); |
| 404 | 404 |
| 405 final Context context = ContextUtils.getApplicationContext(); |
| 406 // Future calls to PlatformServiceBridge.getInstance() rely on it having
been created here. |
| 407 PlatformServiceBridge.getOrCreateInstance(context); |
| 408 |
| 405 // Make sure that ResourceProvider is initialized before starting the br
owser process. | 409 // Make sure that ResourceProvider is initialized before starting the br
owser process. |
| 406 final PackageInfo webViewPackageInfo = WebViewFactory.getLoadedPackageIn
fo(); | 410 final PackageInfo webViewPackageInfo = WebViewFactory.getLoadedPackageIn
fo(); |
| 407 final String webViewPackageName = webViewPackageInfo.packageName; | 411 final String webViewPackageName = webViewPackageInfo.packageName; |
| 408 final Context context = ContextUtils.getApplicationContext(); | |
| 409 setUpResources(webViewPackageInfo, context); | 412 setUpResources(webViewPackageInfo, context); |
| 410 initPlatSupportLibrary(); | 413 initPlatSupportLibrary(); |
| 411 doNetworkInitializations(context); | 414 doNetworkInitializations(context); |
| 412 final boolean isExternalService = true; | 415 final boolean isExternalService = true; |
| 413 AwBrowserProcess.configureChildProcessLauncher(webViewPackageName, isExt
ernalService); | 416 AwBrowserProcess.configureChildProcessLauncher(webViewPackageName, isExt
ernalService); |
| 414 AwBrowserProcess.start(); | 417 AwBrowserProcess.start(); |
| 415 | 418 |
| 416 final boolean enableMinidumpUploadingForTesting = CommandLine.getInstanc
e().hasSwitch( | 419 final boolean enableMinidumpUploadingForTesting = CommandLine.getInstanc
e().hasSwitch( |
| 417 CommandLineUtil.CRASH_UPLOADS_ENABLED_FOR_TESTING_SWITCH); | 420 CommandLineUtil.CRASH_UPLOADS_ENABLED_FOR_TESTING_SWITCH); |
| 418 if (enableMinidumpUploadingForTesting) { | 421 if (enableMinidumpUploadingForTesting) { |
| 419 AwBrowserProcess.handleMinidumps(webViewPackageName, true /* enabled
*/); | 422 AwBrowserProcess.handleMinidumps(webViewPackageName, true /* enabled
*/); |
| 420 } | 423 } |
| 421 | 424 |
| 422 // Actions conditioned on whether the Android Checkbox is toggled on | 425 PlatformServiceBridge.getInstance().queryMetricsSetting(new ValueCallbac
k<Boolean>() { |
| 423 PlatformServiceBridge.getInstance(context) | 426 // Actions conditioned on whether the Android Checkbox is toggled on |
| 424 .queryMetricsSetting(new ValueCallback<Boolean>() { | 427 public void onReceiveValue(Boolean enabled) { |
| 425 public void onReceiveValue(Boolean enabled) { | 428 ThreadUtils.assertOnUiThread(); |
| 426 ThreadUtils.assertOnUiThread(); | 429 AwMetricsServiceClient.setConsentSetting(context, enabled); |
| 427 AwMetricsServiceClient.setConsentSetting(context, enable
d); | |
| 428 | 430 |
| 429 if (!enableMinidumpUploadingForTesting) { | 431 if (!enableMinidumpUploadingForTesting) { |
| 430 AwBrowserProcess.handleMinidumps(webViewPackageName,
enabled); | 432 AwBrowserProcess.handleMinidumps(webViewPackageName, enabled
); |
| 431 } | 433 } |
| 432 } | 434 } |
| 433 }); | 435 }); |
| 434 | 436 |
| 435 if (CommandLineUtil.isBuildDebuggable()) { | 437 if (CommandLineUtil.isBuildDebuggable()) { |
| 436 setWebContentsDebuggingEnabled(true); | 438 setWebContentsDebuggingEnabled(true); |
| 437 } | 439 } |
| 438 | 440 |
| 439 TraceEvent.setATraceEnabled(mWebViewDelegate.isTraceTagEnabled()); | 441 TraceEvent.setATraceEnabled(mWebViewDelegate.isTraceTagEnabled()); |
| 440 mWebViewDelegate.setOnTraceEnabledChangeListener( | 442 mWebViewDelegate.setOnTraceEnabledChangeListener( |
| 441 new WebViewDelegate.OnTraceEnabledChangeListener() { | 443 new WebViewDelegate.OnTraceEnabledChangeListener() { |
| 442 @Override | 444 @Override |
| 443 public void onTraceEnabledChange(boolean enabled) { | 445 public void onTraceEnabledChange(boolean enabled) { |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 WebViewDelegate getWebViewDelegate() { | 693 WebViewDelegate getWebViewDelegate() { |
| 692 return mWebViewDelegate; | 694 return mWebViewDelegate; |
| 693 } | 695 } |
| 694 | 696 |
| 695 // The method to support unreleased Android. | 697 // The method to support unreleased Android. |
| 696 WebViewContentsClientAdapter createWebViewContentsClientAdapter(WebView webV
iew, | 698 WebViewContentsClientAdapter createWebViewContentsClientAdapter(WebView webV
iew, |
| 697 Context context) { | 699 Context context) { |
| 698 return new WebViewContentsClientAdapter(webView, context, mWebViewDelega
te); | 700 return new WebViewContentsClientAdapter(webView, context, mWebViewDelega
te); |
| 699 } | 701 } |
| 700 } | 702 } |
| OLD | NEW |